From 3ce92b739443433168d5d720e59dbb057ce04c1d Mon Sep 17 00:00:00 2001 From: aki Date: Sat, 26 Apr 2025 00:45:53 +0800 Subject: [PATCH] fix(authelia): Add Redis password configuration to Authelia setup script --- update-setup.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/update-setup.sh b/update-setup.sh index 50a459f..4cf4d36 100644 --- a/update-setup.sh +++ b/update-setup.sh @@ -231,6 +231,7 @@ update_authelia_config() { if [ -f "$ENV_FILE" ]; then TAILNET_DOMAIN=$(grep -o "TAILSCALE_TAILNET_DOMAIN=.*" "$ENV_FILE" | cut -d'=' -f2 | tr -d '"' | tr -d "'") TAILSCALE_HOSTNAME=$(grep -o "TAILSCALE_HOSTNAME=.*" "$ENV_FILE" | cut -d'=' -f2 | tr -d '"' | tr -d "'") + REDIS_PASSWORD=$(grep -o "AUTHELIA_REDIS_PASSWORD=.*" "$ENV_FILE" | cut -d'=' -f2 | tr -d '"' | tr -d "'") if [ -n "$TAILNET_DOMAIN" ] && [ -n "$TAILSCALE_HOSTNAME" ]; then # Use the full Tailnet domain (e.g., "example.ts.net") for cookies @@ -246,10 +247,21 @@ update_authelia_config() { # For URLs, use the full hostname sed -i "s/https:\/\/tailscale-nas.your-tailnet.ts.net/https:\/\/$TAILSCALE_HOSTNAME.$TAILNET_DOMAIN/g" "$AUTHELIA_CONFIG" + # Ensure Redis password is set correctly + if [ -n "$REDIS_PASSWORD" ]; then + # Check if redis connection string exists in the config + if grep -q "redis:" "$AUTHELIA_CONFIG"; then + echo -e "${CYAN}Setting Redis password in Authelia configuration...${NC}" + # Make sure the Redis password in configuration matches the one in .env + sed -i "s/password: \${AUTHELIA_SESSION_REDIS_PASSWORD}/password: $REDIS_PASSWORD/g" "$AUTHELIA_CONFIG" + fi + fi + echo -e "${GREEN}Configured Authelia with your Tailscale domain:${NC}" echo -e "${CYAN} - Cookie domain: ${GREEN}$TAILNET_DOMAIN${NC}" echo -e "${CYAN} - Access control for: ${GREEN}*.$TAILNET_DOMAIN and $TAILNET_DOMAIN${NC}" echo -e "${CYAN} - Authelia URL: ${GREEN}https://$TAILSCALE_HOSTNAME.$TAILNET_DOMAIN${NC}" + echo -e "${CYAN} - Redis password: ${GREEN}Configured${NC}" else echo -e "${YELLOW}Warning: Could not find both TAILSCALE_HOSTNAME and TAILSCALE_TAILNET_DOMAIN in .env${NC}" echo -e "${YELLOW}You may need to manually edit $AUTHELIA_CONFIG to set your domains correctly${NC}"