Обновить server/ip-blocker.sh

This commit is contained in:
2026-04-15 11:26:55 +00:00
parent deecba131b
commit 62e41c1e8e

View File

@@ -11,6 +11,8 @@ fi
BAN_CMD=/usr/local/bin/ban-ip
UNBAN_CMD=/usr/local/bin/unban-ip
IPTABLES_CMD="/usr/sbin/iptables"
# Скрипт: ban-ip
cat > "$BAN_CMD" <<"EOF"
#!/bin/bash
@@ -19,7 +21,7 @@ if [ $# -ne 1 ]; then
exit 1
fi
IP="$1"
iptables -I INPUT -s "$IP" -j DROP
$IPTABLES_CMD -I INPUT -s "$IP" -j DROP
echo "Забанен IP $IP (iptables)"
EOF
@@ -31,7 +33,7 @@ if [ $# -ne 1 ]; then
exit 1
fi
IP="$1"
iptables -D INPUT -s "$IP" -j DROP
$IPTABLES_CMD -D INPUT -s "$IP" -j DROP
echo "Разбанен IP $IP (iptables)"
EOF