Compare commits

...

3 Commits

5 changed files with 35 additions and 6 deletions

View File

@@ -63,3 +63,8 @@ create on 20-3-2025 by Désiré Werner Menrath
- clidmanager.sh: Fixed menu navigation loop by using 'exec' for submenu return
- update_dyndns.sh: Added script for DynDNS protection and iptables management
- clidmanager.sh: Extended menu with Authelia Watcher Manager options
### Added
02-02-2026
- clidmanager.sh: Added menu option [9] to edit Caddyfile

View File

@@ -32,6 +32,7 @@ five=$(echo -e $YELLOW"5"$LBLUE)
six=$(echo -e $YELLOW"6"$LBLUE)
seven=$(echo -e $YELLOW"7"$LBLUE)
eight=$(echo -e $YELLOW"8"$LBLUE)
nine=$(echo -e $YELLOW"9"$LBLUE)
list_dir_with_numbers() {
unset dcname
@@ -168,6 +169,18 @@ edit_yml() {
sudo clidmanager.sh
}
edit_caddyfile() {
clear
echo -e ""$NORMAL
echo -e $BLUE" -----$(gettext "Edit Caddyfile")-----"
echo -e $GREEN"$(gettext "Editing /opt/containers/caddy-proxy/caddy/Caddyfile")"$NORMAL
echo -e ""$ZYAN
nano /opt/containers/caddy-proxy/caddy/Caddyfile
sudo clidmanager.sh
}
all_stop() {
docker stop $(docker ps -a -q)
@@ -200,10 +213,11 @@ watcher_management() {
echo "CHECK_INTERVAL=300"
echo "SEND_WELCOME_NOTIFICATION=1"
echo "SEND_WATCHER_START_NOTIFICATION=1"
echo "SEND_UPDATE_NOTIFICATION=1"
} > "$ENV_PATH"
else
# Ensure rows before write
for var in MY_DOMAIN CHECK_INTERVAL SEND_WELCOME_NOTIFICATION SEND_WATCHER_START_NOTIFICATION; do
for var in MY_DOMAIN CHECK_INTERVAL SEND_WELCOME_NOTIFICATION SEND_WATCHER_START_NOTIFICATION SEND_UPDATE_NOTIFICATION; do
grep -q "^$var=" "$ENV_PATH" || echo "$var=" >> "$ENV_PATH"
done
# Set standard value when empty
@@ -297,6 +311,7 @@ watcher_management() {
read -p "$(gettext "New Interval (seconds, default 300): ")" NEW_INT
read -p "$(gettext "Send Welcome Notification? (1=Yes, 0=No): ")" NEW_WELCOME
read -p "$(gettext "Send Container Start Notification? (1=Yes, 0=No): ")" NEW_START
read -p "$(gettext "Send IP Update Notification? (1=Yes, 0=No): ")" NEW_UPDATE
# Domain Update
[ -n "$NEW_DOM" ] && sed -i "s|^MY_DOMAIN=.*|MY_DOMAIN=\"$NEW_DOM\"|" "$ENV_PATH"
@@ -310,6 +325,9 @@ watcher_management() {
# Watcher Start Notification Update
[ -n "$NEW_START" ] && sed -i "s/^SEND_WATCHER_START_NOTIFICATION=.*/SEND_WATCHER_START_NOTIFICATION=$NEW_START/" "$ENV_PATH"
# Update Notification Update
[ -n "$NEW_UPDATE" ] && sed -i "s/^SEND_UPDATE_NOTIFICATION=.*/SEND_UPDATE_NOTIFICATION=$NEW_UPDATE/" "$ENV_PATH"
echo -e "${GREEN}$(gettext "Settings saved.")${NORMAL}"
pkill -f "update_dyndns.sh" > /dev/null 2>&1
/usr/local/bin/update_dyndns.sh > /dev/null 2>&1 &
@@ -339,10 +357,11 @@ main_menu() {
echo -e "[$six] $(gettext "Start all containers")"
echo -e "[$seven] $(gettext "Authelia Watcher Manager")"
echo -e "[$eight] $(gettext "Show running containers")"
echo -e "[$nine] $(gettext "Edit Caddyfile")"
echo "======================================="
echo "$info"
echo "$info2"
read -n 1 -s -r -p "$(gettext "Choose 1-8: ")" entry
read -n 1 -s -r -p "$(gettext "Choose 1-9: ")" entry
case $entry in
1) newdir; exit ;;
@@ -353,6 +372,7 @@ main_menu() {
6) all_start; exit ;;
7) watcher_management; exit ;;
8) list_containers; exit ;;
9) edit_caddyfile; exit ;;
*) clear; exit ;;
esac
done

Binary file not shown.

Binary file not shown.

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