Skip to content
Snippets Groups Projects
Verified Commit f6d53c23 authored by David Beniamine's avatar David Beniamine
Browse files

Update unban.sh with new fail2ban commands

parent bc4f2f53
No related branches found
No related tags found
No related merge requests found
...@@ -8,23 +8,13 @@ then ...@@ -8,23 +8,13 @@ then
exit 1 exit 1
fi fi
ip=$1 ip=$1
nojail=true
# Trying to remove from all jails # Trying to remove from all jails
for jail in $(fail2ban-client status | grep 'Jail list' | \ fail2ban-client unban $ip
sed -e 's/.*list:\s*//' -e 's/,//g') if [ $? -eq 1 ]; then
do echo "$ip unbanned"
echo "Looking for $ip in jail $jail" else
fail2ban-client set $jail unbanip $ip > /dev/null 2>&1 echo "$ip was not banned"
if [ $? -eq 0 ]
then
echo "ip removed from jail $jail"
nojail=false
fi
done
if $nojail
then
echo "$ip wasn't in any jail"
fi fi
# To avoid mail report # To avoid mail report
sed -i "/Ban $ip/d" /var/log/fail2ban.log sed -i "/Ban $ip/d" /var/log/fail2ban.log
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment