2023-10-05 16:51:06 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
URL=kiel.csprung.de
|
2024-01-27 14:43:50 +01:00
|
|
|
SERVER_DIR=/opt/container-server
|
2023-10-05 16:51:06 +02:00
|
|
|
|
2024-01-27 14:43:50 +01:00
|
|
|
cd $SERVER_DIR
|
2023-10-05 16:51:06 +02:00
|
|
|
NEW_IP=$(nslookup -type=a $URL | awk '/^Address: / { print $2 ; exit }')
|
|
|
|
OLD_IP=$(awk -F '=' '/^FAIL2BAN_IGNORED_IP/{ print $2 }' .env)
|
|
|
|
|
|
|
|
if [ "$NEW_IP" != "$OLD_IP" ]; then
|
|
|
|
echo "Found new IP: $URL = $OLD_IP -> $NEW_IP"
|
|
|
|
sed -i -e "s/\(FAIL2BAN_IGNORED_IP\)=.*/\1=$NEW_IP/" .env
|
|
|
|
task compose:restart -- fail2ban
|
|
|
|
fi
|