Commit Graph
76 Commits
Author SHA1 Message Date
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
ari bcac6c76e6 A: A2 validate peer names, URLs, token files and timeouts 2026-10-19 22:31:29 -04:00
ari 40d18c2253 A: A1 peers config section, env overrides and print-config redaction 2026-10-19 22:31:29 -04:00
ari 5cb2c43e39 E: E2 outbound peer spans and traceparent injection helpers 2026-10-19 20:57:52 -04:00
ari eee253b162 E: E1 peer health gauges from the registry snapshot 2026-10-19 20:57:52 -04:00
ari c1a12abc19 B: refuse to proxy disabled peers and reject reloads the transport cannot apply
Also reset status when a peer URL changes, keep loops retired by a
reload and await them at shutdown, and cover the SIGHUP fan-out.
2026-10-19 20:55:25 -04:00
ari 26b9f8bdff B: report healthz latency and keep the last peer version below the threshold 2026-10-19 20:55:25 -04:00
ari 5ad94f249e B: bound peer calls with one deadline and let streams outlive it
Count DNS, token/CA reads and headers inside the timeout, treat SSE as
long-lived with an idle bound, take targets from url::Host so IPv6
literals work, exempt health probes from the concurrency limits and
tighten error classification. Reuse validate_target in request_url and
mark the Authorization value sensitive.
2026-10-19 20:55:25 -04:00
ari 9d6fbd3288 B: B4 empty the peer snapshot when a reload disables the feature 2026-10-19 20:55:25 -04:00
ari 000659a552 B: B5 enforce deny CIDRs and plain-HTTP opt-in before connecting 2026-10-19 20:55:25 -04:00
ari ed1c3a608e B: B4 start the peer registry from serve and reload peers on SIGHUP 2026-10-19 20:55:25 -04:00
ari d94c2b3a1d B: B2/B3 health probes, loops and the in-memory status model 2026-10-19 20:55:25 -04:00
ari bd5b21bcc4 B: B1 real reqwest peer client with caps, timeouts and ring TLS 2026-10-19 20:55:25 -04:00
ari 0dbaf58c8c A0: review round 1 peer entry defaults and class strings 2026-10-19 20:02:17 -04:00
ari 4bfb097be6 A0: contract stubs types, transport, fake and registry seams
Land the shared peer contracts: types, error mapping, transport trait,
fake transport and fixtures, registry/proxy/health skeletons, the
AppState.peers and Config.peers seams, the ping and peers route stubs,
and unit plus integration tests. No loops, no network, feature off by
default.
2026-10-19 20:02:17 -04:00
ariandClaude Sonnet 5.5 01def4bd8a Make defaults_only config test independent of host /etc config
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
2026-10-19 17:38:40 -04:00
ariandClaude Sonnet 5.5 bdccace271 Default port is now 1984 everywhere
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
2026-10-16 11:18:47 -04:00
ari 818a252fab Merge branch 'feat/readonly-status-and-resource-templates' into integration/phase2 2026-10-16 10:04:59 -04:00
ariandClaude Sonnet 5.5 646fbfd46b Token CLI owner check, 0600 pre-created DB, never chmod existing state dir; README updates
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
2026-10-16 10:02:15 -04:00
ariandClaude Sonnet 5.5 f1d659965b Serve plain HTTP through the shared hyper accept loop with connection cap and header timeout
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
2026-10-16 10:02:08 -04:00
ariandClaude Sonnet 5.5 28b3a8b572 mcp: add systemd://unit/{name} and docker://container/{name} resource templates
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
2026-10-16 09:49:11 -04:00
ariandClaude Sonnet 5.5 74802efd0e systemd: make unit_status read-only (GetUnit only, never LoadUnit)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
2026-10-16 09:30:52 -04:00
ariandClaude Sonnet 5.5 d5a0373a75 Privatize fake sources, drop restating docs, remove boxed iterator in capped
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
2026-10-16 08:58:41 -04:00
ariandClaude Sonnet 5.5 8b3f91dcb7 Remove workstream/decision tags and section banners from comments
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
2026-10-16 08:57:21 -04:00
ariandClaude Sonnet 5.5 e39d885fae DbusSystemd: drop unused config/shutdown, derive Default
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
2026-10-16 08:57:21 -04:00
ariandClaude Sonnet 5.5 d022ebeae5 Share error_response and default host allowlist; drop AppResult
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
2026-10-16 08:57:21 -04:00
ariandClaude Sonnet 5.5 9f2bbc7d14 WS-I: review fixes (connection cap, header timeout, SIGHUP on plain path, HTTP/1.1 only)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 07:19:14 -04:00
ariandClaude Sonnet 5.5 c5972b762f WS-I: native TLS (optional, default off) with SIGHUP cert reload
server.tls.{enabled,cert_file,key_file}; rustls (ring, explicit provider) via
tokio-rustls + hyper-util; https:// MCP origins when enabled; non-loopback
plain-HTTP startup warning; tests/tls.rs; README TLS section.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 07:10:14 -04:00
ariandClaude Sonnet 5.5 c69745e579 WS-G: per-layer filters so only app spans feed the trace exporter
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
2026-10-15 22:14:02 -04:00