-mkdir -pv $(DESTDIR)$(tmpfilesdir)
-mkdir -pv $(DESTDIR)$(datadir)/firewall
+ install -m 755 -v firewall-config $(DESTDIR)$(sbindir)
install -m 755 -v firewall6 $(DESTDIR)$(sbindir)
install -m 755 -v firewall4 $(DESTDIR)$(sbindir)
install -m 755 -v network $(DESTDIR)$(sbindir)
--- /dev/null
+#!/bin/bash
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2012 IPFire Network Development Team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+. /usr/lib/network/functions
+
+# Read firewall configuration.
+firewall_config_read
+
+firewall_cli_config "$@"
+
+exit ${EXIT_ERROR}
. /usr/lib/network/functions
# Read firewall configuration.
-firewall_config_read "ipv4"
+firewall_config_read
firewall_cli "ipv4" "$@"
. /usr/lib/network/functions
# Read firewall configuration.
-firewall_config_read "ipv6"
+firewall_config_read
firewall_cli "ipv6" "$@"
firewall_cli_panic "${protocol}" "$@"
;;
- config)
- firewall_cli_config "${protocol}" $@
- ;;
-
zone)
firewall_cli_zone $@
;;
}
function firewall_cli_config() {
- local protocol="${1}"
- assert isset protocol
- shift
-
if cli_help_requested $@; then
- cli_usage root-config
+ cli_show_man firewall-config
exit ${EXIT_OK}
fi
if [ -n "${1}" ]; then
config_set "$@"
- firewall_config_write "${protocol}"
+ firewall_config_write
else
- firewall_config_print "${protocol}"
+ firewall_config_print
fi
}
config_print ${NETWORK_CONFIG_FILE_PARAMS}
}
-function firewall_config_file() {
- local protocol="${1}"
- assert isset protocol
-
- local file
- case "${protocol}" in
- ipv6)
- file="${FIREWALL6_CONFIG_FILE}"
- ;;
- ipv4)
- file="${FIREWALL4_CONFIG_FILE}"
- ;;
- esac
- assert isset file
-
- print "${file}"
- return ${EXIT_OK}
-}
-
-function firewall_config_env() {
- local protocol="${1}"
- assert isset protocol
-
- case "${protocol}" in
- ipv6)
- file="${FIREWALL6_CONFIG_FILE}"
- params="${FIREWALL6_CONFIG_PARAMS}"
- ;;
- ipv4)
- file="${FIREWALL4_CONFIG_FILE}"
- params="${FIREWALL4_CONFIG_PARAMS}"
- ;;
- esac
- assert isset file
- assert isset params
-}
-
function firewall_config_read() {
- local file params
- firewall_config_env "$@"
-
- config_read "${file}" "${params}"
+ config_read "${FIREWALL_CONFIG_FILE}" "${FIREWALL_CONFIG_PARAMS}"
}
function firewall_config_write() {
- local file params
- firewall_config_env "$@"
-
- config_write "${file}" "${params}"
+ config_write "${FIREWALL_CONFIG_FILE}" "${FIREWALL_CONFIG_PARAMS}"
}
function firewall_config_print() {
- local file params
- firewall_config_env "$@"
-
- config_print "${params}"
+ config_print "${FIREWALL_CONFIG_PARAMS}"
}
FIREWALL_CONFIG_DIR="/etc/firewall"
FIREWALL_ZONES_DIR="${FIREWALL_CONFIG_DIR}/zones"
-FIREWALL4_CONFIG_FILE="${FIREWALL_CONFIG_DIR}/config4"
-FIREWALL6_CONFIG_FILE="${FIREWALL_CONFIG_DIR}/config6"
+FIREWALL_CONFIG_FILE="${FIREWALL_CONFIG_DIR}/config"
FIREWALL_CONFIG_RULES="${FIREWALL_CONFIG_DIR}/rules"
FIREWALL_MACROS_DIRS="${FIREWALL_CONFIG_DIR}/macros"
FIREWALL_DEFAULT_TTL="64"
FIREWALL_CONFIG_PARAMS="${FIREWALL_CONFIG_PARAMS} FIREWALL_DEFAULT_TTL"
-FIREWALL4_CONFIG_PARAMS="${FIREWALL_CONFIG_PARAMS}"
-FIREWALL6_CONFIG_PARAMS="${FIREWALL_CONFIG_PARAMS}"
-
FIREWALL_SUPPORTED_PROTOCOLS="tcp udp icmp igmp esp ah gre"
FIREWALL_PROTOCOLS_SUPPORTING_PORTS="tcp udp"
. /usr/lib/network/functions
+# Read firewall configuration.
+firewall_config_read
+
# Initialize kernel parameters for the firewall.
firewall_kernel_init