Update manage_iptables
This commit is contained in:
parent
3fdfd426d3
commit
60ecfa59aa
@ -110,10 +110,18 @@ check_ip_in_fail2ban() {
|
|||||||
fi
|
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
|
# Function to remove an IP address from Fail2ban
|
||||||
remove_ip_from_fail2ban() {
|
remove_ip_from_fail2ban() {
|
||||||
read -p "Enter the IP address to remove from Fail2ban: " ip_address
|
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
|
if sudo fail2ban-client status "$jail_name" | grep -q "$ip_address"; then
|
||||||
sudo fail2ban-client set "$jail_name" unbanip "$ip_address"
|
sudo fail2ban-client set "$jail_name" unbanip "$ip_address"
|
||||||
echo "IP address $ip_address has been removed from Fail2ban in jail $jail_name."
|
echo "IP address $ip_address has been removed from Fail2ban in jail $jail_name."
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user