Rozdiely pre scripts/shell/firewall/fw-universal.sh medzi verziami 2.122 a 2.123
| verzia 2.122, 2020/09/17 18:58:29 |
verzia 2.123, 2023/11/08 22:29:04 |
|
|
| # Licensed under terms of GNU General Public License. |
# Licensed under terms of GNU General Public License. |
| # All rights reserved. |
# All rights reserved. |
| # |
# |
| # $Platon: scripts/shell/firewall/fw-universal.sh,v 2.121 2019/10/08 22:25:30 nepto Exp $ |
# $Platon: scripts/shell/firewall/fw-universal.sh,v 2.122 2020/09/17 18:58:29 nepto Exp $ |
| # |
# |
| # Changelog: |
# Changelog: |
| # 2003-10-24 - created |
# 2003-10-24 - created |
| Riadok 772 do_ban_single_ip() |
|
| Riadok 772 do_ban_single_ip() |
|
| done |
done |
| } # }}} |
} # }}} |
| |
|
| |
do_unban_single_ip() |
| |
{ # {{{ |
| |
if [ -z "$1" ]; then |
| |
print_info "do_unban_single_ip(): empty banned_ip"; |
| |
return; |
| |
fi |
| |
for banned_ip in $*; do |
| |
$IPTABLES -D INPUT -s $banned_ip -j DROP; |
| |
done |
| |
} # }}} |
| |
|
| bann_ip_adresses() |
bann_ip_adresses() |
| { # {{{ |
{ # {{{ |
| # |
# |
| Riadok 1664 add_banned_ip() |
|
| Riadok 1675 add_banned_ip() |
|
| rm -f $TMPFILE |
rm -f $TMPFILE |
| } # }}} |
} # }}} |
| |
|
| |
del_banned_ip() |
| |
{ # {{{ |
| |
for IP in $*; do |
| |
LINE=`sed -n "\|^${IP}|=" $DEFAULT_FIREWALL_CONFIG_DIR/BANNED_IP.conf`; |
| |
sed -i.bak "$((LINE-1)),$((LINE))d" $DEFAULT_FIREWALL_CONFIG_DIR/BANNED_IP.conf; |
| |
done |
| |
} # }}} |
| |
|
| deploy_block() |
deploy_block() |
| { # {{{ |
{ # {{{ |
| if [ -z "$*" ]; then |
if [ -z "$*" ]; then |
|
|
| fi |
fi |
| done |
done |
| ;; |
;; |
| |
unblock) |
| |
shift; |
| |
for banned_ip in $*; do |
| |
check_banned_ip "$banned_ip"; |
| |
if [ "$?" -eq 0 ]; then |
| |
print_info "Unblocking IP address: $banned_ip"; |
| |
del_banned_ip "$banned_ip"; |
| |
do_unban_single_ip "$banned_ip"; |
| |
else |
| |
print_info "IP address is not blocked: $banned_ip"; |
| |
retcode=1; |
| |
fi |
| |
done |
| |
;; |
| update) |
update) |
| update; |
update; |
| ;; |
;; |
Platon Group <platon@platon.sk> http://platon.sk/
|
|