summaryrefslogtreecommitdiff
path: root/functions/disable_ip.sh
diff options
context:
space:
mode:
Diffstat (limited to 'functions/disable_ip.sh')
-rw-r--r--functions/disable_ip.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/functions/disable_ip.sh b/functions/disable_ip.sh
new file mode 100644
index 0000000..0021b74
--- /dev/null
+++ b/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."
+}