aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid M. Syzdek <syzdek@bindlebinaries.com>2019-07-29 13:33:26 -0800
committerDavid M. Syzdek <syzdek@bindlebinaries.com>2019-07-29 13:33:26 -0800
commitb03c3fbf638847ba1bc2463aa97f5ac00cf3e8aa (patch)
tree8889a87df3149565b0ef90595d9995826fe278aa
parent412c3f95e5392a182e8616313731f4553546913b (diff)
downloadbbfw-b03c3fbf638847ba1bc2463aa97f5ac00cf3e8aa.tar.gz
bbfw-b03c3fbf638847ba1bc2463aa97f5ac00cf3e8aa.tar.bz2
bbfw-b03c3fbf638847ba1bc2463aa97f5ac00cf3e8aa.tar.xz
bbfw-b03c3fbf638847ba1bc2463aa97f5ac00cf3e8aa.zip
adding verbose config option
-rw-r--r--src/bbfw.conf-example.in6
-rwxr-xr-xsrc/bbfw.in14
2 files changed, 18 insertions, 2 deletions
diff --git a/src/bbfw.conf-example.in b/src/bbfw.conf-example.in
index 867cb91..e8a62fa 100644
--- a/src/bbfw.conf-example.in
+++ b/src/bbfw.conf-example.in
@@ -39,4 +39,10 @@
39# quiet = no 39# quiet = no
40 40
41 41
42# The `verbose` option enables verbose output for utilities which support
43# verbose flags (currently only iptables). To enable verbose output,
44# uncomment the line below and change the value to 'yes'.
45# verbose = yes
46
47
42# end of configuration 48# end of configuration
diff --git a/src/bbfw.in b/src/bbfw.in
index f2a5f61..ae5ce9a 100755
--- a/src/bbfw.in
+++ b/src/bbfw.in
@@ -81,6 +81,7 @@ export PATH
81FW_PREFIX=@sysconfdir@/firewall.d/ 81FW_PREFIX=@sysconfdir@/firewall.d/
82FW_CONF=@sysconfdir@/bbfw.conf 82FW_CONF=@sysconfdir@/bbfw.conf
83FW_QUIET=no 83FW_QUIET=no
84FW_VERBOSE=no
84 85
85 86
86########### 87###########
@@ -206,8 +207,8 @@ load()
206 207
207 case "${TYPE}" in 208 case "${TYPE}" in
208 'ipset') clean_file ${FILE} |ipset -! restore;; 209 'ipset') clean_file ${FILE} |ipset -! restore;;
209 'iptables') clean_file ${FILE} |iptables-restore -n;; 210 'iptables') clean_file ${FILE} |iptables-restore -n ${FW_VERBOSE};;
210 'ip6tables') clean_file ${FILE} |ip6tables-restore -n;; 211 'ip6tables') clean_file ${FILE} |ip6tables-restore -n ${FW_VERBOSE};;
211 *) ;; 212 *) ;;
212 esac 213 esac
213} 214}
@@ -351,6 +352,7 @@ stop() {
351# sets options from configuration file 352# sets options from configuration file
352FW_PREFIX="$( config_option firewall_dir "${FW_PREFIX}" )" 353FW_PREFIX="$( config_option firewall_dir "${FW_PREFIX}" )"
353FW_QUIET="$( config_option quiet "${FW_QUIET}" A-Z a-z )" 354FW_QUIET="$( config_option quiet "${FW_QUIET}" A-Z a-z )"
355FW_VERBOSE="$( config_option verbose "${FW_VERBOSE}" A-Z a-z )"
354 356
355 357
356# checks and normalizes options 358# checks and normalizes options
@@ -360,6 +362,14 @@ elsif test "x${FW_QUIET}" != "xno";then
360 echo "${PROGRAM_NAME}: invalid value for option 'quiet'" 1>&2 362 echo "${PROGRAM_NAME}: invalid value for option 'quiet'" 1>&2
361 exit 1 363 exit 1
362fi 364fi
365if test "x${FW_VERBOSE}" == "xno";then
366 unset FW_VERBOSE
367elsif test "x${FW_VERBOSE}" != "xno";then
368 echo "${PROGRAM_NAME}: invalid value for verbose 'quiet'" 1>&2
369 exit 1
370else
371 FW_VERBOSE=-v
372fi
363 373
364 374
365case "$1" in 375case "$1" in