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.
This commit is contained in:
1 parent
3ae8e74a1d
commit
dde6a12ce4
5 files changed
+146
-34
No files matched your search
@@ -317,10 +317,10 @@ Rendering: one `[[peers.peer]]` per enabled peer with `token_file = "/run/creden
|
||||
|
||||
The VM test declares its peers with the module's first-class options (F2), so the TOML contract above must stay compatible with what they render:
|
||||
|
||||
- Hosts: `alpha` (peers `beta` over plain HTTP, `gamma` over HTTPS with `ca_file`), `beta` (peer `alpha`), `gamma` (TLS-only, no peers). Port 1984, bind `::` (dual stack, see the address note below).
|
||||
- Hosts: `alpha` (peers `beta` over plain HTTP, `gamma` over HTTPS with `ca_file`), `beta` (peer `alpha`), `gamma` (TLS-only, no peers). Port 1984; `alpha` and `beta` bind `::` (dual stack) and `gamma` binds `0.0.0.0` (IPv4 only), so a single-family peer stays covered (see the address note below).
|
||||
- Config comes through the module: `peers.enable = true`, `peers.settings = { tcp_interval_secs = 2; tcp_timeout_secs = 1; api_interval_secs = 3; api_timeout_secs = 2; fail_threshold = 2; request_timeout_secs = 4; }` and `peers.peers.<name> = { url; tokenFile; caFile ? null; allowPlainHttp }`. The module renders `[peers]` plus one `[[peers.peer]]` per enabled peer with keys `name`, `url`, `token_file`, `allow_plain_http`, optional `ca_file`.
|
||||
- `token_file = /run/credentials/skyg-linux-tracker.service/peer-<name>` (the module adds `LoadCredential=peer-<name>:/var/lib/peer-tokens/<name>` and `RefreshOnReload=credentials`); the file holds the placeholder `pending` until the test installs a real token, so the placeholder must pass A3 loading (non-empty, under `$CREDENTIALS_DIRECTORY` so the permission check is skipped) and be reported as `auth = "rejected"`, not as a config error.
|
||||
- Address note: a test node's name resolves to both its IPv4 and its IPv6 address, and resolution returns the IPv6 one first, so each node binds `::` and the peer URLs keep the hostnames. A peer reachable only on IPv4 is reported as `unreachable` (the transport connects to the first resolved address); see the ws-f Log.
|
||||
- Address note: a test node's name resolves to both its IPv4 and its IPv6 address. The transport uses **every** resolved address (the probe tries them in order inside its timeout, the client pins the whole set, and one denied address refuses the name), so a peer is found on whichever family it listens on. `alpha` and `beta` bind `::` (dual stack) and the TLS peer `gamma` binds `0.0.0.0`, so the test covers both a dual-stack and an IPv4-only peer; the peer URLs keep the hostnames.
|
||||
- Token rotation = `mv` a new file into place and `systemctl reload skyg-linux-tracker.service` (SIGHUP with `RefreshOnReload=credentials`); status must recover without a restart. SIGHUP must therefore re-read token files and keep the registry (B4).
|
||||
- Timeouts (1 s / 2 s) are below intervals (2 s / 3 s), as validation requires; `request_timeout_secs = 4` and the test's `elapsed < 15` bound the proxy call when a peer VM is down.
|
||||
- Assertions the contract must satisfy: `GET /api/v1/peers/<p>` JSON has `server.up`, `api.up`, `api.auth` in {`ok`,`rejected`}; `GET /api/v1/peers` body contains each peer name; proxied `GET /api/v1/peers/<p>/systemd/units[/<unit>.service]` returns the peer's data with response header `x-slinuxm-peer: <p>`; `POST`/`DELETE` on a proxy path -> 405; `x-slinuxm-hop: 1` -> 4xx; unknown peer -> 404; peer rejected/down -> 503 with the peer name in the body and the caller's own token still valid; MCP `list_peers` output contains the peer names; MCP `list_systemd_units` with `{"peer": "<p>"}` returns the peer's units.
|
||||
|
||||
Reference in new issue
Block a user