Improve unban script

This commit is contained in:
2024-06-30 20:04:48 -04:00
parent 4e3407843a
commit 877c65e2c1
2 changed files with 9 additions and 5 deletions

View File

@@ -9,10 +9,16 @@ parent=${parent%/*}
is_root
[[ $# -lt 1 ]] && echo "Must provide an IP address" && exit 1
echo "This script supports one optional argument, an IP address"
IPADDRESS="$1"
if [[ $# -eq 1 ]]; then
ip_address="$1"
else
prompt ip_address
fi
fail2ban-client set sshd unbanip "$IPADDRESS"
if fail2ban-client set sshd unbanip "$ip_address"; then
echo "IP address $ip_address unbanned"
fi
exit $?