fix own ip address to whitelist

This commit is contained in:
2026-02-01 22:07:38 +01:00
parent 5d0d4fe2f1
commit 91e1a9c675

View File

@@ -23,9 +23,14 @@ while true; do
CURRENT_IP=$(dig +short "$MY_DOMAIN" | tail -n1)
if [ -n "$CURRENT_IP" ]; then
# Ensure IP is always in whitelist (Self-healing)
grep -Fxq "$CURRENT_IP" "$WHITELIST_FILE" 2>/dev/null || echo "$CURRENT_IP" >> "$WHITELIST_FILE"
IS_STARTUP=false
# 1. Welcome Notification on First Success
if [ "$FIRST_RUN" = true ] && [ "$SEND_WELCOME_NOTIFICATION" = "1" ]; then
if [ -n "$GOTIFY_URL" ]; then
if [ "$FIRST_RUN" = true ]; then
IS_STARTUP=true
if [ "$SEND_WELCOME_NOTIFICATION" = "1" ] && [ -n "$GOTIFY_URL" ]; then
MSG="DynDNS protection active for $MY_DOMAIN. Your IP $CURRENT_IP is now automatically whitelisted."
curl -s -o /dev/null -H "Content-Type: application/json" -X POST "$GOTIFY_URL" \
-d "{\"title\": \"DynDNS Manager\", \"message\": \"$MSG\", \"priority\": 2}"
@@ -37,7 +42,6 @@ while true; do
LAST_IP=$(cat "$CACHE_FILE" 2>/dev/null)
if [ "$CURRENT_IP" != "$LAST_IP" ]; then
[ -n "$LAST_IP" ] && sed -i "/^$LAST_IP$/d" "$WHITELIST_FILE"
grep -Fxq "$CURRENT_IP" "$WHITELIST_FILE" || echo "$CURRENT_IP" >> "$WHITELIST_FILE"
# Clean host iptables
while iptables -L INPUT -n | grep -q "$CURRENT_IP"; do
@@ -46,7 +50,7 @@ while true; do
echo "$CURRENT_IP" > "$CACHE_FILE"
if [ "$FIRST_RUN" = false ] && [ -n "$GOTIFY_URL" ]; then
if [ "$IS_STARTUP" = false ] && [ -n "$GOTIFY_URL" ] && [ "${SEND_UPDATE_NOTIFICATION:-1}" = "1" ]; then
curl -s -o /dev/null -H "Content-Type: application/json" -X POST "$GOTIFY_URL" \
-d "{\"title\": \"DynDNS Update\", \"message\": \"New IP $CURRENT_IP whitelisted.\", \"priority\": 2}"
fi