From 60ecfa59aa99c7d0c7291e2d3ee6a5cc07f433c2 Mon Sep 17 00:00:00 2001 From: vijay Date: Thu, 8 May 2025 03:03:41 +0000 Subject: [PATCH] Update manage_iptables --- manage_iptables | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/manage_iptables b/manage_iptables index 6a266d5..ca1c597 100644 --- a/manage_iptables +++ b/manage_iptables @@ -110,10 +110,18 @@ check_ip_in_fail2ban() { fi } +# Function to list available Fail2ban jails +list_fail2ban_jails() { + echo "Available Fail2ban jails:" + sudo fail2ban-client status | grep "Jail list" | awk -F ": " '{print $2}' | tr ',' '\n' | sed 's/ //g' +} + # Function to remove an IP address from Fail2ban remove_ip_from_fail2ban() { read -p "Enter the IP address to remove from Fail2ban: " ip_address - read -p "Enter the jail name (e.g., sshd, http-get-dos): " jail_name + list_fail2ban_jails + read -p "Select a jail from the list above: " jail_name + if sudo fail2ban-client status "$jail_name" | grep -q "$ip_address"; then sudo fail2ban-client set "$jail_name" unbanip "$ip_address" echo "IP address $ip_address has been removed from Fail2ban in jail $jail_name."