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.
This commit is contained in:
ari committed 2026-10-19 22:31:29 -04:00
1 parent c4850d0764
commit a02e4f181b
5 files changed
+174 -78

No files matched your search

+5
View File
@@ -120,6 +120,11 @@ async fn serve(
config_path: Option<PathBuf>,
overrides: CliOverrides,
) -> Result<()> {
// Peer token files are read here, not in `Config::load`: token and
// diagnostics commands must work without the credential.
config
.validate_token_readiness()
.context("validating peer token files")?;
// Install SIGHUP handling before anything else: the default action would
// terminate the process, with or without TLS.
let hup = tokio::signal::unix::signal(tokio::signal::unix::SignalKind::hangup())