3.2 KiB
3.2 KiB
P3 — Integration & hardening
| Field | Value |
|---|---|
| Status | Backlog |
| Owner | — |
| Phase | 3 (single track) |
| Depends on | WS-E, WS-F, WS-G (and transitively A–D) |
| Blocks | Release |
| Owned files | src/main.rs (serve wiring), systemd/skyg-linux-tracker.service, README.md, tests/ |
Goal
Wire every surface into one axum server, prove the negative paths, and ship the unit file and docs. This is the only place the surfaces meet.
Tasks
Tick these in TODO.md.
- I1
slinuxm servewiring inmain.rs:- Load config, then
telemetry::init, thendb::openwhen auth is enabled, then construct sources andAppState. - Build the protected router:
.nest("/api/v1", api::router(state))and.nest_service("/mcp", mcp::service(state)), then.layer(auth::layer(state)). - Build the public router with
/healthz. public.merge(protected).layer(TraceLayer::new_for_http())(review R3).- Spawn the metrics and log export tasks when enabled.
- On SIGINT or SIGTERM: cancel
state.shutdownso SSE streams and background tasks end, runaxum::serve(...).with_graceful_shutdown, then drop the telemetry guard to flush OTel (review G3).
- Load config, then
- I2 Integration tests in
tests/covering Verification #6:- A missing or invalid token gets 401 on
/api/v1/*and/mcp./healthzreturns 200 without a token. auth.enabled = falsewithbind = 0.0.0.0makes startup exit non-zero with a clear message.- A missing Docker socket gives 503 on docker routes while systemd routes still return 200.
- SIGTERM with an open SSE client exits within a few seconds.
- A missing or invalid token gets 401 on
- I3
systemd/skyg-linux-tracker.service:ExecStart=/usr/local/bin/slinuxm serve --config /etc/skyg-linux-tracker.toml- A dedicated
User=(for exampleskyg), orDynamicUser=yesif the token CLI story still works. Decide and note it. StateDirectory=skyg-linux-tracker,StateDirectoryMode=0700ProtectSystem=strict,ProtectHome=yes,PrivateTmp=yes,NoNewPrivileges=yes,ProtectKernelTunables=yes,ProtectControlGroups=yes,RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6,LockPersonality=yes,MemoryDenyWriteExecute=yesSupplementaryGroups=systemd-journal. Adddockercommented out with a root-equivalence warning (DEC-6).
- I4
README.md:- What it is and how to build it (
devenv shell,cargo build --release). - Install: binary, config, unit file.
- Config reference, or a pointer to
config.example.tomland the env-var naming. - Token workflow:
sudo -u skyg slinuxm token create <name>. - REST endpoint list, and MCP client setup with a bearer header example.
- OTel setup and the hardened Docker socket-proxy option.
- What it is and how to build it (
- I5 Release build checks:
cargo build --release.ldd target/release/slinuxmlists only libc, libsystemd and libsystemd's own deps.- Record the binary size in the log.
- I6 Run Verification #1–#6 from
plan.mdby hand on a real systemd + Docker host and record the results in the log.
Done when
- I2 tests pass in
cargo test. - I6 results are logged with all six checks passing.
- The unit file starts the service on a clean host with only the binary, config and unit installed.
Log
- 2026-10-15: Card created.