From 5e742cbe2d1d69f14170547b5224c71a0ab48ef6 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Wed, 29 Jul 2026 09:48:28 +0000 Subject: [PATCH] fix: use pkill -HUP dnsmasq instead of systemctl (no polkit needed), display pinned hostname in table --- install.sh | 13 +++++-------- server.go | 13 +++++++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 68688b5..fc70b21 100755 --- a/install.sh +++ b/install.sh @@ -520,9 +520,9 @@ RestartSec=5 ProtectSystem=full PrivateTmp=true -# Capabilities: bind low ports + talk to systemd for plugin reloads -CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_SYS_ADMIN -AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_SYS_ADMIN +# Capabilities: bind low ports +CapabilityBoundingSet=CAP_NET_BIND_SERVICE +AmbientCapabilities=CAP_NET_BIND_SERVICE [Install] WantedBy=multi-user.target @@ -595,11 +595,8 @@ install_plugin() { # Set group on plugin binary dir chgrp -R "$group" "$plugin_dir" 2>/dev/null || true - # Note: reload uses Linux capabilities (CAP_SYS_ADMIN), not sudo. - # The Zoraxy systemd service must include: - # CapabilityBoundingSet=CAP_SYS_ADMIN - # AmbientCapabilities=CAP_SYS_ADMIN - # (already configured by this installer). + # Note: reload uses SIGHUP (pkill -HUP dnsmasq), not systemctl. + # This works without polkit or extra capabilities. log "Plugin installed at: $plugin_dir" } diff --git a/server.go b/server.go index afc14e2..e8a4ca3 100644 --- a/server.go +++ b/server.go @@ -24,8 +24,8 @@ var ( // Override via environment: LEASE_FILE, CONF_FILE, RELOAD_CMD, RELOAD_ARGS leasesFile = envOrDefault("LEASE_FILE", "/opt/zoraxy/conf/dhcp/dnsmasq.leases") confFile = envOrDefault("CONF_FILE", "/opt/zoraxy/conf/dhcp/dnsmasq.conf") - reloadCmd = envOrDefault("RELOAD_CMD", "/usr/bin/systemctl") - reloadArgs = strings.Fields(envOrDefault("RELOAD_ARGS", "reload dnsmasq")) + reloadCmd = envOrDefault("RELOAD_CMD", "pkill") + reloadArgs = strings.Fields(envOrDefault("RELOAD_ARGS", "-HUP dnsmasq")) ) func envOrDefault(key, fallback string) string { @@ -323,11 +323,16 @@ func getAllLeases() ([]LeaseEntry, error) { } } status := PinStatusActive - if _, ok := pinned[lease.MAC]; ok { + hostname := lease.Hostname + if pinnedHost, ok := pinned[lease.MAC]; ok { status = PinStatusPermanent + // Use the pinned hostname if one was set (overrides DHCP client hostname). + if pinnedHost != "" { + hostname = pinnedHost + } } entries = append(entries, LeaseEntry{ - Hostname: lease.Hostname, + Hostname: hostname, IP: lease.IP, MAC: lease.MAC, Expiry: lease.Expiry,