Fix host agent socket activation
CI / php-store (push) Waiting to run
CI / python-components (push) Waiting to run

This commit is contained in:
2026-08-24 23:13:10 +02:00
parent acadcdfeee
commit eb6be0e5fa
5 changed files with 12 additions and 5 deletions
@@ -11,8 +11,6 @@ Group=root
ExecStart=/usr/local/bin/netbox-store-agent --config /etc/netbox-store-agent/agent.toml daemon
StateDirectory=netbox-store-agent
StateDirectoryMode=0711
RuntimeDirectory=netbox-store-agent
RuntimeDirectoryMode=0755
UMask=0077
NoNewPrivileges=true
PrivateTmp=true
+2 -2
View File
@@ -10,11 +10,11 @@ class SystemdUnitTests(unittest.TestCase):
self.assertIn("SocketMode=0660", socket_unit)
self.assertIn("SocketGroup=netbox", socket_unit)
def test_state_traversal_does_not_relax_service_umask(self):
def test_service_does_not_own_socket_runtime_directory(self):
service_unit = Path("systemd/netbox-store-agent.service").read_text(encoding="utf-8")
self.assertIn("StateDirectoryMode=0711", service_unit)
self.assertIn("RuntimeDirectoryMode=0755", service_unit)
self.assertNotIn("RuntimeDirectory=netbox-store-agent", service_unit)
self.assertIn("UMask=0077", service_unit)
+6 -1
View File
@@ -512,10 +512,15 @@ info "Datenbank und statische Dateien aktualisieren"
info "Dienste aktivieren und neu starten"
systemctl daemon-reload
systemctl enable netbox-store-agent.socket
systemctl stop netbox-store-agent.service
systemctl restart netbox-store-agent.socket
systemctl restart netbox-store-agent.service
systemctl restart netbox netbox-rq
if [[ ! -S /run/netbox-store-agent/agent.sock ]]; then
systemctl status netbox-store-agent.socket --no-pager -l || true
die "Der Agent-Socket /run/netbox-store-agent/agent.sock wurde nicht erstellt."
fi
info "Socket-Zugriff als NetBox-Dienstkonto prüfen"
runuser -u "$NETBOX_USER" -- \
/opt/netbox-store-agent/venv/bin/netbox-store-agent capabilities
+3
View File
@@ -83,6 +83,9 @@ sudo bash /tmp/netbox-store-install.sh
sudo /opt/netbox/venv/bin/python -m py_compile \
/opt/netbox/netbox/netbox/configuration.py</code></pre>
<h3>Socket-Prüfung meldet „No such file or directory“</h3>
<p>Lade den aktuellen Installer erneut herunter und führe ihn noch einmal aus. Eine ältere systemd-Unit konnte beim Neustart das Verzeichnis des Agent-Sockets entfernen. Der aktuelle Installer ersetzt die Unit und startet den Agent über korrekte Socket-Aktivierung.</p>
<h3>API_TOKEN_PEPPERS-Warnung</h3>
<p>Diese NetBox-Einstellung gehört nicht zum Plugin und wird deshalb nicht automatisch verändert:</p>
<pre><code>sudo /opt/netbox/venv/bin/python /opt/netbox/netbox/generate_secret_key.py</code></pre>
+1
View File
@@ -498,6 +498,7 @@ test('public and admin templates render safely with complete artifact evidence',
assertTrue(str_contains($installation, 'Dry-Run: Nein'));
assertTrue(str_contains($installation, 'Release-Artefakte'));
assertTrue(str_contains($installation, 'configuration.py must contain exactly one static PLUGINS assignment'));
assertTrue(str_contains($installation, 'Socket-Prüfung meldet'));
assertTrue(str_contains($installation, 'python -m py_compile'));
assertTrue(str_contains($installation, 'https://netbox.mrblake.cc'));
assertTrue(str_contains($installation, 'API_TOKEN_PEPPERS'));