fix(haproxy): Detect actual listening port for running services

- Change AdGuard Home default port to 3003 (avoid Gitea conflict)
- Update config file path to /var/lib/adguardhome/AdGuardHome.yaml
- Add netstat-based port detection for running processes
- Actual listening port overrides default when service is running

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-02-01 14:00:28 +01:00
parent 681382c7ff
commit f243002933
2 changed files with 8 additions and 3 deletions

View File

@ -1586,7 +1586,12 @@ _add_exposed_service() {
# Check if service is running by process name
running=0
if [ -n "$process_name" ]; then
pgrep -f "$process_name" >/dev/null 2>&1 && running=1
if pgrep -f "$process_name" >/dev/null 2>&1; then
running=1
# If running, detect actual listening port from netstat
local detected_port=$(netstat -tlnp 2>/dev/null | grep "$process_name" | awk '{print $4}' | awk -F: '{print $NF}' | head -1)
[ -n "$detected_port" ] && actual_port="$detected_port"
fi
fi
# Track known service ports for dedup (stored in temp file)

View File

@ -53,8 +53,8 @@ config known 'domoticz'
option category 'app'
config known 'adguardhome'
option default_port '3000'
option config_file '/etc/adguardhome.yaml'
option default_port '3003'
option config_file '/var/lib/adguardhome/AdGuardHome.yaml'
option process_name 'AdGuardHome'
option category 'security'
option description 'DNS filtering and ad blocking'