diff options
Diffstat (limited to 'vps/functions/disable_ip.sh')
-rw-r--r-- | vps/functions/disable_ip.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/vps/functions/disable_ip.sh b/vps/functions/disable_ip.sh new file mode 100644 index 0000000..0021b74 --- /dev/null +++ b/vps/functions/disable_ip.sh @@ -0,0 +1,18 @@ +disable_ip() { + local ip="$1" + + if [[ -z "$ip" ]]; then + echo "[!] No IP specified." + exit 1 + fi + + echo "[*] Disabling access to VPS with IP: $ip" + + # Block all traffic to/from that IP via iptables + iptables -A INPUT -s "$ip" -j DROP + iptables -A OUTPUT -d "$ip" -j DROP + + echo "$ip - disabled on $(date)" >> /var/log/genesis-disabled.log + + echo "[✓] $ip has been blocked and logged." +} |