aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/bbfw.conf-example.in5
-rwxr-xr-xsrc/bbfw.in24
2 files changed, 24 insertions, 5 deletions
diff --git a/src/bbfw.conf-example.in b/src/bbfw.conf-example.in
index ec70086..867cb91 100644
--- a/src/bbfw.conf-example.in
+++ b/src/bbfw.conf-example.in
@@ -34,4 +34,9 @@
34# firewall_dir = @sysconfdir@/firewall.d 34# firewall_dir = @sysconfdir@/firewall.d
35 35
36 36
37# The `quiet` option surpresses normal output of bbfw. To enable quiet mode,
38# uncomment the line below and change the value to 'yes'.
39# quiet = no
40
41
37# end of configuration 42# end of configuration
diff --git a/src/bbfw.in b/src/bbfw.in
index 60ea7b1..288b51a 100755
--- a/src/bbfw.in
+++ b/src/bbfw.in
@@ -80,6 +80,7 @@ export PATH
80# determine prefix of conf files 80# determine prefix of conf files
81FW_PREFIX=@sysconfdir@/firewall.d/ 81FW_PREFIX=@sysconfdir@/firewall.d/
82FW_CONF=@sysconfdir@/bbfw.conf 82FW_CONF=@sysconfdir@/bbfw.conf
83FW_QUIET=no
83 84
84 85
85########### 86###########
@@ -181,7 +182,7 @@ run_hook()
181 return 0; 182 return 0;
182 fi 183 fi
183 184
184 if test ! -z "${DESC}";then 185 if test ! -z "${DESC}" && test -z "${FW_QUIET}";then
185 echo "${DESC}" 186 echo "${DESC}"
186 fi 187 fi
187 188
@@ -199,7 +200,7 @@ load()
199 return 0; 200 return 0;
200 fi 201 fi
201 202
202 if test ! -z "${DESC}";then 203 if test ! -z "${DESC}" && test -z "${FW_QUIET}";then
203 echo "${DESC}" 204 echo "${DESC}"
204 fi 205 fi
205 206
@@ -281,7 +282,9 @@ stop() {
281 run_hook stop ${FW_PREFIX}/pre-hook "running local pre-hook stop ..." 282 run_hook stop ${FW_PREFIX}/pre-hook "running local pre-hook stop ..."
282 283
283 for TABLE in $(iptables-save |grep '^*' |sed -e 's/^*//g' |sort);do 284 for TABLE in $(iptables-save |grep '^*' |sed -e 's/^*//g' |sort);do
284 echo "Flushing rules from ${TABLE} table (IPv4)" 285 if test -z "${FW_QUIET}";then
286 echo "Flushing rules from ${TABLE} table (IPv4)"
287 fi
285 for CHAIN in $(iptables-save -t ${TABLE} |grep '^:' |cut -d: -f2 |grep -v ' - ' |cut -d\ -f1);do 288 for CHAIN in $(iptables-save -t ${TABLE} |grep '^:' |cut -d: -f2 |grep -v ' - ' |cut -d\ -f1);do
286 iptables -t ${TABLE} -P ${CHAIN} ACCEPT 289 iptables -t ${TABLE} -P ${CHAIN} ACCEPT
287 done 290 done
@@ -292,7 +295,9 @@ stop() {
292 done 2> /dev/null 295 done 2> /dev/null
293 296
294 for TABLE in $(iptables-save |grep '^*' |sed -e 's/^*//g' |sort);do 297 for TABLE in $(iptables-save |grep '^*' |sed -e 's/^*//g' |sort);do
295 echo "Flushing rules from ${TABLE} table (IPv6)" 298 if test -z "${FW_QUIET}";then
299 echo "Flushing rules from ${TABLE} table (IPv6)"
300 fi
296 for CHAIN in $(ip6tables-save -t ${TABLE} |grep '^:' |cut -d: -f2 |grep -v ' - ' |cut -d\ -f1);do 301 for CHAIN in $(ip6tables-save -t ${TABLE} |grep '^:' |cut -d: -f2 |grep -v ' - ' |cut -d\ -f1);do
297 ip6tables -t ${TABLE} -P ${CHAIN} ACCEPT 302 ip6tables -t ${TABLE} -P ${CHAIN} ACCEPT
298 done 303 done
@@ -302,7 +307,9 @@ stop() {
302 done 307 done
303 done 2> /dev/null 308 done 2> /dev/null
304 309
305 echo "Destroying all IP sets ..." 310 if test -z "${FW_QUIET}";then
311 echo "Destroying all IP sets ..."
312 fi
306 for SET in $(ipset save |grep '^create' |grep ' list:' |awk '{print$2}');do 313 for SET in $(ipset save |grep '^create' |grep ' list:' |awk '{print$2}');do
307 ipset destroy "${SET}" 314 ipset destroy "${SET}"
308 done 315 done
@@ -326,6 +333,7 @@ stop() {
326 333
327# sets options from configuration file 334# sets options from configuration file
328FW_PREFIX="$( config_option firewall_dir "${FW_PREFIX}" )" 335FW_PREFIX="$( config_option firewall_dir "${FW_PREFIX}" )"
336FW_QUIET="$( config_option quiet "${FW_QUIET}" A-Z a-z )"
329 337
330 338
331# checks and normalizes options 339# checks and normalizes options
@@ -333,6 +341,12 @@ if test ! -d "${FW_PREFIX}";then
333 echo "${PROGRAM_NAME}: ${FW_PREFIX}: firewall directory does not exist" 1>&2 341 echo "${PROGRAM_NAME}: ${FW_PREFIX}: firewall directory does not exist" 1>&2
334 exit 1 342 exit 1
335fi 343fi
344if test "x${FW_QUIET}" == "xno";then
345 unset FW_QUIET
346elsif test "x${FW_QUIET}" != "xno";then
347 echo "${PROGRAM_NAME}: invalid value for option 'quiet'" 1>&2
348 exit 1
349fi
336 350
337 351
338case "$1" in 352case "$1" in