diff --git a/host_agent/systemd/netbox-store-agent.service b/host_agent/systemd/netbox-store-agent.service index 9465dcc..ffd4542 100644 --- a/host_agent/systemd/netbox-store-agent.service +++ b/host_agent/systemd/netbox-store-agent.service @@ -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 diff --git a/host_agent/tests/test_systemd_units.py b/host_agent/tests/test_systemd_units.py index 16a9438..0336763 100644 --- a/host_agent/tests/test_systemd_units.py +++ b/host_agent/tests/test_systemd_units.py @@ -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) diff --git a/install.sh b/install.sh index 8e2f5ed..b1e6ffb 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/store/templates/installation.php b/store/templates/installation.php index 932fa73..db99c71 100644 --- a/store/templates/installation.php +++ b/store/templates/installation.php @@ -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 +
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.
+Diese NetBox-Einstellung gehört nicht zum Plugin und wird deshalb nicht automatisch verändert:
sudo /opt/netbox/venv/bin/python /opt/netbox/netbox/generate_secret_key.py
diff --git a/store/tests/run.php b/store/tests/run.php
index 01820f5..d4d9cfc 100644
--- a/store/tests/run.php
+++ b/store/tests/run.php
@@ -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'));