Files
DECNET/deploy/decnet-bus.service.j2
anti 215251a122 fix(deploy): template --group on the bus ExecStart too
decnet-bus.service.j2 ran with User={{ user }} / Group={{ group }}
but the actual bus CLI invocation hardcoded --group decnet. The bus
chowns /run/decnet/bus.sock to that group at 0660 — so when an
operator ran `decnet init --group anti`, the socket ended up
owned by decnet:decnet while every worker (agent, api, collector,
forwarder, prober, updater) ran as anti and got EACCES on connect().

Each worker's bus-wiring catches the error, logs a warning, sets
bus=None, and carries on — which is correct for the data-plane but
silently kills Workers-panel heartbeats (run_health_heartbeat(None,
...) no-ops). So half the worker grid showed UNKNOWN even though
systemctl confirmed the processes were alive.

Swap the hardcoded --group decnet for --group {{ group }} so the
socket is owned by the same group the workers run under.
2026-04-24 01:09:55 -04:00

50 lines
1.5 KiB
Django/Jinja

[Unit]
Description=DECNET Service Bus (host-local UNIX-socket pub/sub)
Documentation=https://git.resacachile.cl/anti/DECNET/wiki/Service-Bus
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User={{ user }}
Group={{ group }}
WorkingDirectory={{ install_dir }}
EnvironmentFile=-{{ install_dir }}/.env.local
# /run/decnet is created automatically with the RuntimeDirectory= directive
# below (mode 0755, owned by User/Group) and cleaned up on stop. The bus
# socket is placed inside it with 0660 perms so only the configured
# DECNET group (--group) can connect. That group is rendered here so
# `decnet init --group anti` results in a socket every worker running
# as anti can actually connect() to — otherwise every worker falls
# back to bus=None and the Workers panel sees no heartbeats.
RuntimeDirectory=decnet
RuntimeDirectoryMode=0755
Environment=DECNET_SYSTEM_LOGS=/var/log/decnet/decnet.bus.log
ExecStart={{ venv_dir }}/bin/decnet bus \
--socket /run/decnet/bus.sock \
--group {{ group }}
StandardOutput=append:/var/log/decnet/decnet.bus.log
StandardError=append:/var/log/decnet/decnet.bus.log
# No privileged network operations — UNIX-domain socket only.
CapabilityBoundingSet=
AmbientCapabilities=
# Security Hardening
NoNewPrivileges=yes
ProtectSystem=full
ProtectHome=read-only
PrivateTmp=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
RestrictSUIDSGID=yes
LockPersonality=yes
ReadWritePaths=/run/decnet /var/log/decnet
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target