mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-27 00:29:02 +01:00
01e38957e0
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3297 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
23 lines
754 B
Plaintext
23 lines
754 B
Plaintext
#
|
|
# Shorewall version 3.2 -- Extension Script to create Limit action.
|
|
#
|
|
# /usr/share/shorewall/Limit
|
|
##############################################################################
|
|
|
|
set -- $(separate_list $TAG)
|
|
|
|
[ $# -eq 3 ] || fatal_error "Rule must include <set name>,<max connections>,<interval> as the log tag"
|
|
|
|
run_iptables -A $CHAIN -m recent --name $1 --set
|
|
|
|
if [ -n "$LEVEL" ]; then
|
|
run_iptables -N $CHAIN%
|
|
log_rule_limit $LEVEL $CHAIN% $1 DROP "" "" -A
|
|
run_iptables -A $CHAIN% -j DROP
|
|
run_iptables -A $CHAIN -m recent --name $1 --update --seconds $3 --hitcount $(( $2 + 1 )) -j $CHAIN%
|
|
else
|
|
run_iptables -A $CHAIN -m recent --update --name $1 --seconds $3 --hitcount $(( $2 + 1 )) -j DROP
|
|
fi
|
|
|
|
run_iptables -A $CHAIN -j ACCEPT
|