added live redoc and slight refactors to tokens
This commit is contained in:
1 parent
435a54a02d
commit
b38c66bcc8
19 files changed
+836
-157
No files matched your search
@@ -60,7 +60,7 @@ Startup refuses `auth.enabled = false` on a non-loopback `server.bind`.
|
||||
|
||||
## Tokens
|
||||
|
||||
All `/api/v1/*` and `/mcp` requests need `Authorization: Bearer <token>`. `/healthz` is public. Tokens are stored hashed (sha256) in SQLite, and the plaintext is shown once.
|
||||
All `/api/v1/*` and `/mcp` requests need `Authorization: Bearer <token>`. `/healthz` and the static `/docs` viewer are public. Tokens are stored hashed (sha256) in SQLite, and the plaintext is shown once.
|
||||
|
||||
Run the token CLI **as the service user** (the unit's `User=skyg`), i.e. `sudo -u <service user> slinuxm token create <name>`. The CLI refuses to run (with the matching `sudo -u <owner> ...` hint) when the effective uid, root included, does not own the database file or, if it does not exist yet, its existing state directory, so it cannot create or modify state owned by another user:
|
||||
|
||||
@@ -91,6 +91,8 @@ Full route table with parameters: [docs/api.md](docs/api.md).
|
||||
|
||||
The whole surface is also a generated OpenAPI 3.1 document, [`docs/openapi.json`](docs/openapi.json): `GET /api/v1/openapi.json` serves it (same bearer token), `slinuxm openapi [--peers]` prints it offline without reading any config or token, and `x-mcp-tools` in it lists every MCP tool with its JSON Schema. Regenerate with `cargo run -- openapi --peers > docs/openapi.json`; a test fails if the file is stale.
|
||||
|
||||
The same document is rendered at `http://127.0.0.1:1984/docs` with [Redoc](https://github.com/Redocly/redoc), served from the binary (no CDN, no outbound request). The page and its script are public and hold no host data; the page asks for your bearer token (kept in `sessionStorage`, sent only to this server) to fetch `/api/v1/openapi.json`, or loads straight away with `[auth] enabled = false`.
|
||||
|
||||
## MCP
|
||||
|
||||
Endpoint: `http://127.0.0.1:1984/mcp` (Streamable HTTP, same bearer token). Eight tools (`list_systemd_units`, `get_systemd_unit`, `list_systemd_timers`, `get_journal_logs`, `tail_journal`, `list_containers`, `get_container`, `get_container_logs`), two prompts, two resources and two resource templates. A [consolidator](#peers-consolidator) adds `list_peers` and `get_peer` and a `peer` argument on every tool, for ten tools. Log content is untrusted data and is labelled as such.
|
||||
@@ -165,7 +167,6 @@ services.skyg-linux-tracker.peers = {
|
||||
|
||||
Worked agenix setup, the threat model, the firewall note (every peer must accept the consolidator's address on its port), reload and shutdown semantics: [docs/consolidator.md](docs/consolidator.md). The peers tests are `tests/peers.rs` (in-process, no VM) and the three-machine NixOS VM test: `devenv shell -- dev-test integration peers`, and for the VM test `devenv shell -- dev-test vm peers`, which is `nix build .#checks.x86_64-linux.vm-peers -L`.
|
||||
|
||||
|
||||
## NixOS
|
||||
|
||||
The flake exports `packages.<system>.default` and `nixosModules.default`.
|
||||
|
||||
Reference in new issue
Block a user