Skip to content

Commit 877fbe8

Browse files
committed
fix: enhance VPN port conflict checks to allow updates on running containers
1 parent 36652db commit 877fbe8

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

‎scripts/dappnode_install.sh‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,8 @@ check_https_ports_conflict() {
605605

606606
# Check that ports required by VPN/Wireguard are not already in use by another process.
607607
# Must be called after PKGS is populated. Exits with a helpful error on conflict.
608+
# Ports held by our own dappnode core VPN/Wireguard containers are not conflicts —
609+
# the upcoming compose-up will replace them.
608610
check_vpn_ports_conflict() {
609611
if ! command -v lsof >/dev/null 2>&1; then
610612
return # cannot check; proceed and let the container report a bind error
@@ -615,23 +617,33 @@ check_vpn_ports_conflict() {
615617
case "$pkg" in
616618
WIREGUARD)
617619
if is_port_listening 51820 udp; then
618-
error "Port 51820/UDP is already in use on this host."
619-
error "This port is required by the Wireguard package and must be free before installing."
620-
error "Free up port 51820 and re-run the installer, or — if you do not need VPN"
621-
error "connectivity — consider using --minimal instead (advanced users only)."
622-
exit 1
620+
# Port 51820 is in use; check if it's our own Wireguard container
621+
if docker ps --format '{{.Names}}' 2>/dev/null | grep -qE "^DAppNodeCore-.*wireguard.*\.dnp\.dappnode\.eth$"; then
622+
log "Port 51820/UDP is held by the existing DAppNode Wireguard container; it will be replaced."
623+
else
624+
error "Port 51820/UDP is already in use on this host."
625+
error "This port is required by the Wireguard package and must be free before installing."
626+
error "Free up port 51820 and re-run the installer, or — if you do not need VPN"
627+
error "connectivity — consider using --minimal instead (advanced users only)."
628+
exit 1
629+
fi
623630
fi
624631
;;
625632
VPN)
626633
local vpn_blocked=()
627634
is_port_listening 1194 udp && vpn_blocked+=(1194/UDP)
628635
is_port_listening 8092 tcp && vpn_blocked+=(8092/TCP)
629636
if [[ ${#vpn_blocked[@]} -gt 0 ]]; then
630-
error "Port(s) ${vpn_blocked[*]} are already in use on this host."
631-
error "These ports are required by the OpenVPN package and must be free before installing."
632-
error "Free up the port(s) and re-run the installer, or — if you do not need VPN"
633-
error "connectivity — consider using --minimal instead (advanced users only)."
634-
exit 1
637+
# Port(s) in use; check if held by our own OpenVPN container
638+
if docker ps --format '{{.Names}}' 2>/dev/null | grep -q "^DAppNodeCore-vpn.dnp.dappnode.eth$"; then
639+
log "Port(s) ${vpn_blocked[*]} are held by the existing DAppNode VPN container; it will be replaced."
640+
else
641+
error "Port(s) ${vpn_blocked[*]} are already in use on this host."
642+
error "These ports are required by the OpenVPN package and must be free before installing."
643+
error "Free up the port(s) and re-run the installer, or — if you do not need VPN"
644+
error "connectivity — consider using --minimal instead (advanced users only)."
645+
exit 1
646+
fi
635647
fi
636648
;;
637649
esac

0 commit comments

Comments
 (0)