Improve unban script
This commit is contained in:
@@ -5,8 +5,6 @@
|
|||||||
parent="${BASH_SOURCE[0]}"
|
parent="${BASH_SOURCE[0]}"
|
||||||
parent=${parent%/*}
|
parent=${parent%/*}
|
||||||
|
|
||||||
unset user
|
|
||||||
|
|
||||||
[[ -f $parent/script-functions ]] && . "$parent"/script-functions || exit 1
|
[[ -f $parent/script-functions ]] && . "$parent"/script-functions || exit 1
|
||||||
|
|
||||||
is_root
|
is_root
|
||||||
|
|||||||
@@ -9,10 +9,16 @@ parent=${parent%/*}
|
|||||||
|
|
||||||
is_root
|
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 $?
|
exit $?
|
||||||
Reference in New Issue
Block a user