fix: use pkill -HUP dnsmasq instead of systemctl (no polkit needed), display pinned hostname in table

This commit is contained in:
Claus Lohmar 2026-07-29 09:48:28 +00:00
parent db081b6b04
commit 5e742cbe2d
2 changed files with 14 additions and 12 deletions

View file

@ -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"
}

View file

@ -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,