Add 'blacklist!' command.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2020-06-06 10:13:46 -07:00
parent 527533ecb6
commit 07160c5ed1
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10
3 changed files with 14 additions and 5 deletions

View File

@ -3642,7 +3642,11 @@ blacklist_command() {
;; ;;
esac esac
if [ $COMMAND = 'blacklist!' ]; then
timeout='timeout 0'
else
echo "$@" | fgrep -q ' timeout ' || timeout="timeout $g_dbltimeout" echo "$@" | fgrep -q ' timeout ' || timeout="timeout $g_dbltimeout"
fi
if $IPSET -A $g_blacklistipset $@ $timeout -exist; then if $IPSET -A $g_blacklistipset $@ $timeout -exist; then
local message local message
@ -4716,7 +4720,7 @@ shorewall_cli() {
fatal_error "$g_product is not running" fatal_error "$g_product is not running"
fi fi
;; ;;
blacklist) blacklist|blacklist!)
only_root only_root
get_config Yes get_config Yes
shift shift

View File

@ -48,7 +48,7 @@
<arg>options</arg> <arg>options</arg>
<arg choice="plain"><option>blacklist</option></arg> <arg choice="plain"><option>blacklist[!]</option></arg>
<arg <arg
choice="plain"><replaceable>address</replaceable><arg><replaceable>option</replaceable> choice="plain"><replaceable>address</replaceable><arg><replaceable>option</replaceable>
@ -1151,7 +1151,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">blacklist</emphasis> <term><emphasis role="bold">blacklist[!]</emphasis>
<replaceable>address</replaceable> [ <replaceable>option</replaceable> <replaceable>address</replaceable> [ <replaceable>option</replaceable>
... ]</term> ... ]</term>
@ -1172,6 +1172,11 @@
<programlisting> shorewall blacklist 192.0.2.22 timeout 0</programlisting> <programlisting> shorewall blacklist 192.0.2.22 timeout 0</programlisting>
<para>Beginning with Shorewall 5.2.5, the above command can be
shortened to:</para>
<programlisting> shorewall blacklist! 192.0.2.22</programlisting>
<para>If the <option>disconnect</option> option is specified in the <para>If the <option>disconnect</option> option is specified in the
DYNAMIC_BLACKLISTING setting, then the effective VERBOSITY DYNAMIC_BLACKLISTING setting, then the effective VERBOSITY
determines the amount of information displayed:</para> determines the amount of information displayed:</para>

View File

@ -338,7 +338,7 @@ get_config() {
if [ -n "$DYNAMIC_BLACKLIST" -a "$(id -u)" = 0 ]; then if [ -n "$DYNAMIC_BLACKLIST" -a "$(id -u)" = 0 ]; then
case $COMMAND in case $COMMAND in
blacklist|allow|drop|logdrop|reject) blacklist*|allow|drop|logdrop|reject)
setup_dbl setup_dbl
;; ;;
esac esac