Commit Graph
104 Commits
Author SHA1 Message Date
HermenixandClaude Sonnet 5.5 0ff3520563 container details: limits, sandbox flags and a live stats sample
Container details now carry the image id and the HostConfig resource limits
(CPU cores and shares, memory and swap bytes, pids, device requests) plus sandbox flags
(privileged, read-only rootfs, network mode, restart policy), with null meaning unlimited. A new
GET /api/v1/docker/containers/{name}/stats returns one live sample: CPU percent
of one core, memory working set, processes, block IO and network bytes. Peers
proxy the new route.

Env, labels, command lines and mounts are deliberately excluded from the payload.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 03:02:33 +00:00
ari b3b9103f2f Merge branch 'build-stamped-version' 2026-10-20 23:38:12 -04:00
ari 1a30b20ac0 Stamp the version as YYYY.MM.DD-<branch>-<sha>
build.rs builds the string (git, or SLINUXM_* env for builds without .git)
and the lib exposes it as VERSION. --version, /healthz, /api/v1/ping, MCP
server info and OTel service.version use it; OpenAPI info.version stays on
the semver so docs/openapi.json does not change per commit. The flake passes
the commit date and short rev to the package.
2026-10-20 23:27:46 -04:00
ari 020fa4871f added a way to rotate a token 2026-10-20 23:26:10 -04:00
ari 5d78004720 fixing tests 2026-10-20 22:57:34 -04:00
ari b38c66bcc8 added live redoc and slight refactors to tokens 2026-10-20 22:53:09 -04:00
ari 435a54a02d pulled out tests and validated them 2026-10-20 21:58:33 -04:00
ari 5571b1d3a4 H: assert the exported peer request span kind
Export the span through a capturing exporter and require SpanKind::Client,
so the contract is checked where a backend sees it, not only in the field
that carries it.
2026-10-20 16:27:39 -04:00
ari 5f9f160666 H: keep the token listener open for the whole loop
The 500 ms accept window covered only the first case; a connection made later
went unseen. Accept once after the loop instead.
2026-10-20 16:26:52 -04:00
ari a78303c123 H: never open a token path that is not a regular file
Check is_file before opening and open with O_NONBLOCK, so a FIFO token file
cannot park a blocking-pool thread on every check and proxy call.
2026-10-20 16:26:11 -04:00
ari f9911f6c70 H: warn once about plain http
Validation runs at startup and on every reload, so the transport no longer
repeats the warning per peer on its first request; the helper is named for
the peer it reports.
2026-10-20 16:24:44 -04:00
ari a09c64de9a H: pin the token mode check for every group/world bit
Cover 0620, 0602, 0610 and 0601 in the loader and assert that startup
validation and the per-request load give the same reason for each.
2026-10-20 16:23:54 -04:00
ari 5ba6e820ca H: name the token mode check after what it rejects 2026-10-20 16:16:30 -04:00
ari 9c770b0576 H: mark the peer.request span as an OTel client span otel.kind = client is set on the span and asserted in the span test 2026-10-20 16:14:14 -04:00
ari 97c81f899c H: deny IPv6 link-local and metadata addresses by default Add fe80::/10, ::/128 and fd00:ec2::254/128 to the default deny_cidrs and sync config.example.toml, README and docs/consolidator.md 2026-10-20 16:13:25 -04:00
ari 6e74d3d99b H: canonicalise addresses in the deny check Match IPv4-mapped IPv6 addresses against the IPv4 deny list at connect time, with tests for ::ffff:169.254.169.254 2026-10-20 16:12:07 -04:00
ari 39c1c91695 H: merge token loaders and peer helpers One loader in secrets.rs (header validity, canonicalised credentials dir) is used by the client; the deny-CIDR parser, loopback test and plain-http warning live once in config.rs 2026-10-20 16:10:24 -04:00
ari 0515008572 G: order the schema check list 2026-10-20 15:56:44 -04:00
ari 2adfa59027 G: F6 fix health tag and document auth 503 and auth-off notes 2026-10-20 15:54:13 -04:00
ari a1117da01d G: F5 document the MCP stream and session delete 2026-10-20 15:54:13 -04:00
ari e6a9453c7a G: F3 derive IntoParams for query parameter structs 2026-10-20 15:54:13 -04:00
ari d2917b2483 G: F2 reflect peer status schemas from JsonSchema derives 2026-10-20 15:54:13 -04:00
ari 55a2401f17 G: dedupe openapi helpers 2026-10-20 15:54:13 -04:00
ari 214e074cca G: G4 document every error code and both content types per response 2026-10-20 15:54:13 -04:00
ari 869b6818e9 G: G3 Serving and CLI serve the spec behind auth and print it offline 2026-10-20 15:54:13 -04:00
ari 7078ed15b1 G: G2 MCP description document POST /mcp and x-mcp-tools from the tool router 2026-10-20 15:54:13 -04:00
ari 3d8e840427 G: G1 REST spec derive the OpenAPI document from the handlers 2026-10-20 15:54:13 -04:00
ari 2af03308ba F: make the multi-address tcp test independent of /etc/hosts 2026-10-20 15:16:56 -04:00
ari dde6a12ce4 F: try every resolved peer address instead of the first
A peer whose name resolves to both families but which listens on only one
of them was reported unreachable, which the documented 0.0.0.0 binding
produces on a dual-stack LAN and in the NixOS test network.

resolve_target now returns the whole address set (still refusing the name
if any address is denied), the HTTP client pins it with
resolve_to_addrs so the connector falls through to the next address, and
tcp_check tries each address in order with a per-attempt share of the
remaining deadline. ClientKey keys on the set.

Regression cover: a client test that resolves localhost against a
single-family listener, a tests/peers.rs case declaring the peer as
http://localhost:<port>, and the VM test's TLS peer gamma now binds
0.0.0.0 (IPv4 only) while alpha and beta stay dual stack. Docs and the
contracts section 10 address note describe the new behaviour.
2026-10-20 15:04:09 -04:00
ari 3ae8e74a1d F: forward the peer's /api/v1 path and un-ignore the proxied tests
The proxy validated the route without its API prefix and handed the
transport "/systemd/units", which a peer answered with 404. Validation
still works on the bare route; the transport now gets
"/api/v1/systemd/units". Un-ignoring the two acceptance tests
(a_plain_peer_serves_its_own_data_through_the_proxy and
shutdown_ends_a_proxied_follow) is the check for that fix; the unit
tests in api/, mcp/ and the registry script their fakes on the peer's
real paths again.
2026-10-20 15:04:09 -04:00
ariandClaude Sonnet 5.5 9e4fb38993 Document hooks; drop review tag from a comment
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
2026-10-20 10:19:46 -04:00
ari c0e76607f6 D: reuse the shared proxy bounds and status table in MCP peers
The peer follow stream had no byte cap and kept a whole unterminated
frame in memory, and the MCP surface carried its own peer status table
that already disagreed with REST for peer 400.

- mcp::peers::fetch now returns proxy::PreparedResponse, so the status
  comes from proxy::classify_status and the body from
  proxy::prepare_response (peer byte cap, deadline, shutdown), the same
  two steps REST uses. status_error, body_bytes and the local 2xx check
  are gone.
- tail_journal consumes that prepared stream; a Frames cursor keeps a
  partial frame from being rescanned from byte 0 on every chunk, the
  entry cap truncates the result, and the end of the stream maps to the
  note (entry cap, shutdown, byte cap, deadline or close).
- Prompts resolve the peer argument against the registry (unknown or
  disabled peer is refused); list_peers returns the error registry()
  produced; one wording for an unknown peer name.
- Tests: byte cap on an unterminated frame, entry cap, buffered body,
  follow 404/500, deadline with an open stream, shutdown, frame cursor,
  REST/MCP parity for peer 400/404/401/5xx, and a full golden snapshot of
  the peers-off tool table. Peer scripts use the stripped path form C2
  forwards.
2026-10-19 23:09:45 -04:00
ari e2c553dbe4 D: share tool-name fixture and dedupe MCP peer tests 2026-10-19 22:59:49 -04:00
ari 5237e772d4 D: D3 peer wording, peers://status and peer-aware prompts
Server instructions and the eight tool descriptions mention peers and the
untrusted-data rule only while a registry is configured. peers://status
returns the list_peers JSON and is advertised only then. diagnose_unit and
container_health_report take an optional validated peer argument.
2026-10-19 22:59:49 -04:00
ari ae09f0530c D: D2 list_peers and get_peer behind peers.enabled
The two status tools and the optional peer argument exist only when a
registry is configured. rmcp's disable_route hides the tools; the eight
shared schemas lose the optional peer property, and the two list tools also
lose the derived $schema key, so the peers-off list and schemas match a
build without the feature byte for byte. Both snapshot variants and the
wire-level tool list are asserted.
2026-10-19 22:59:49 -04:00
ari d3285a994b D: D1 optional peer argument on the eight tools
Peers resolve through PeerRegistry::get, the same entry point REST uses,
so the hop marker, allowlist and error mapping stay in one place. Log
tools keep the local {entries, truncated, note} shape; tail_journal
consumes the peer SSE stream. Tests cover every tool, path encoding,
error mapping and the integration path through the assembled router.
2026-10-19 22:59:49 -04:00
ari 8b7569363c C: review round 2 proxy query unit rule and shared status classifier
Proxied journal/unit values now use the local unit-name helper instead of a
second, stricter check, so escaped units pass through as text, %5C or %5c.
The peer status table is one function shared with the transport, and the
segment/encoding cases left untested get allowlist and rejection cases.
2026-10-19 22:35:51 -04:00
ari 7a4d64c051 C: review round 1 proxy fixes
Unit names go through the local route's validation, so escaped and
dash-rooted units work through the proxy; backslashes stay legal only
there. Response preparation (status classification, content-type check,
size/stream bounds) moves into proxy.rs for REST and MCP to share.
x-slinuxm-peer is only set for configured peers, proxied SSE is no-cache,
and the unreachable handler fallbacks are gone.
2026-10-19 22:35:51 -04:00
ari 767b198ed7 C: C4 REST error mapping through peer_error_to_app with per-row tests 2026-10-19 22:35:51 -04:00
ari 58012018d9 C: C3 x-slinuxm-peer response header on every proxied outcome 2026-10-19 22:35:51 -04:00
ari bab6959a94 C: C2 GET-only pass-through proxy with allowlist, hop guard and query filter 2026-10-19 22:35:51 -04:00
ari bec0ab5736 C: C1 peer status routes 2026-10-19 22:35:51 -04:00
ari 80dec21afd A: use the shared temp-dir fixture in the config tests 2026-10-19 22:31:29 -04:00
ari 92ad3c8128 A: wire peer check to the real client and probe a real socket in tests
B1/B2 are merged, so `real_transport` builds the `ReqwestTransport` with the
configured limits and deny list instead of bailing. Binary tests now probe a
real loopback server: ok with latency, rejected credential, unreachable peer
and an unknown name, none of which may print the token.
2026-10-19 22:31:29 -04:00
ari de7a47d040 A: cover a directory and a symlink escaping the credentials directory in the loader 2026-10-19 22:31:29 -04:00
ari a02e4f181b A: open peer token files only from serve and peer check
`Config::load` now runs structural checks only (names, URLs, CIDRs, paths,
timeouts) and never touches the host, so `token create|list`, `peer list`,
`peer check` and `--print-config` work where the credential is absent, e.g.
outside the unit. `Config::validate_token_readiness` opens the enabled peers'
files and runs at the top of `serve`; `peer check` checks the probed peer.
Also canonicalise IPv4-mapped IPv6 literals against the deny list and stop
putting the host in the plain-http error while the warning omits it.
2026-10-19 22:31:29 -04:00
ari c4850d0764 A: align the registry reload test with the peer timeout rule (B's fixture, exposed by the rebase) 2026-10-19 22:31:29 -04:00
ari d3bef6bd94 A: share tracing capture and peer config fixtures in tests (gate round 1) 2026-10-19 22:31:29 -04:00
ari 2eb1d2a78b A: A4 peer list and one-shot peer check CLI 2026-10-19 22:31:29 -04:00
ari 7d10153677 A: A3 secrets loader reads token files with redaction and permission checks 2026-10-19 22:31:29 -04:00