2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2012 IPFire Network Development Team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 .
/usr
/lib
/network
/functions
24 function cli_start
() {
36 function cli_panic
() {
37 if cli_help_requested $@
; then
38 cli_show_man firewall-panic
43 while [ $# -gt 0 ]; do
46 if ip_is_valid
${1}; then
47 admin_hosts
="${admin_hosts} ${1}"
49 warning
"Invalid IP address: ${1}"
56 firewall_panic
${admin_hosts}
59 function cli_config
() {
60 if cli_help_requested $@
; then
65 if [ -n "${1}" ]; then
74 if cli_help_requested $@
; then
75 cli_show_man firewall-zone
79 if zone_name_is_valid
${1}; then
84 # Check if the given zone exists.
85 if ! zone_exists
${zone}; then
86 error
"Zone '${zone}' does not exist."
87 cli_run_help firewall zone
92 # Process the given action.
95 cli_zone_edit
${zone} $@
98 cli_zone_status
${zone} $@
101 # Print the raw configuration settings.
103 firewall_zone_print
${zone} $@
108 error
"Unrecognized action: ${action}"
109 cli_run_help firewall zone
120 firewall_zone_reset $@
125 error
"Unrecognized action: ${action}"
126 cli_run_help firewall zone
134 # Show firewall zone conifguration.
135 function cli_zone_status
() {
140 firewall_zone_read
${zone}
142 cli_headline
1 "Zone ${zone} (policy ${POLICY})"
143 cli_print_fmt1
1 "Masquerade" "$(cli_print_bool ${MASQUERADE})"
151 # Edit firewall zone configuration.
152 function cli_zone_edit
() {
153 firewall_zone_edit $@
158 # Parse the command line
159 while [ $# -gt 0 ]; do
163 log DEBUG
"Enabled debugging mode"
170 [ -n "${action}" ] && break
173 # Process the given action
175 start|restart|reload
)
205 error
"Invalid command given: ${action}"
207 exit ${EXIT_CONF_ERROR}