25 lines
565 B
Bash
Executable File
25 lines
565 B
Bash
Executable File
#!/bin/bash
|
|
|
|
#Use ./unbanipcloud.sh <ip>
|
|
echo $#
|
|
|
|
JAIL_NAME=$ES7_F2B_JAIL_NAME
|
|
REMOTE_SERVER="estudiset.nextcloud.handycat"
|
|
UNBAN_IP=$1
|
|
|
|
if [ $# -eq 0 ]; then
|
|
echo "Falta la IP a desbloquejar com a argument. Per exemple: $0 X.X.X.X"
|
|
exit 1
|
|
elif [ $# -eq 2 ]; then
|
|
JAIL_NAME=$2
|
|
fi
|
|
|
|
# unban with fail2ban
|
|
out=$(ssh $REMOTE_SERVER "sudo fail2ban-client set $JAIL_NAME unbanip $UNBAN_IP")
|
|
|
|
if [ "$out" -eq "1" ]; then
|
|
echo "La IP [$UNBAN_IP] s'ha desbloquejat correctament"
|
|
else
|
|
echo "No s'ha trobat la IP [$UNBAN_IP] a la llista de bloquejos"
|
|
fi
|