feat(autotls): add support for custom DNS resolver and include Pebble…#572
Open
akrem-chabchoub wants to merge 13 commits intofeat/autotls-forge-validationfrom
Open
feat(autotls): add support for custom DNS resolver and include Pebble…#572akrem-chabchoub wants to merge 13 commits intofeat/autotls-forge-validationfrom
akrem-chabchoub wants to merge 13 commits intofeat/autotls-forge-validationfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for running the autotls check from outside the cluster (e.g. on the host or in CI) when forge DNS and Pebble are exposed. Without it, DNS resolution for forge hostnames often fails on the host (e.g. macOS ignores a custom resolver), and the Pebble CA used for TLS verification can differ from the live CA Pebble generates on startup, causing
x509: certificate signed by unknown authority.Changes
New check options (autotls)
local.test) is only served by an in-cluster DNS (e.g. p2p-forge). Config:forge-dns-address: "127.0.0.1:30053".https://127.0.0.1:31500/roots/0). When set, the check fetches the live Pebble CA from this URL instead of using the embedded static cert. Pebble generates a new CA on each start, so using the live CA avoids TLS verification failures when the embedded cert is outdated.Options are wired in
pkg/config/check.goand can be set per check inconfig/local.yaml(e.g. for theci-autotlsscenario).DNS resolution (forge.go)
forgeDNSAddress. If set, it uses a new lookupViaDNS helper that queries the given DNS server viagithub.com/miekg/dns(UDP). This bypasses the system resolver so that when the check runs on the host, it can still resolve forge hostnames served by the cluster’s forge DNS. Lookup failures when using the custom DNS are treated as hard errors. IfforgeDNSAddressis not set, behavior is unchanged: the system resolver is used and unresolvable hostnames are skipped with a warning.TLS verification (forge.go)
forgeTLSHostAddress. When set, the first autotls node (by sorted name) is verified by dialing this host:port with the node’s forge hostname as ServerName; other nodes are still tried via their forge endpoints (pod IP or multiaddr). verifyNodeTLSCert now takes adialAddrargument so the first node can be dialed at the override address while others use the usual IP:port.Pebble CA (autotls.go, cert, k8s)
/roots/0). The management URL is derived from the ACME directory URL (port 14000 → 15000) or overridden by pebble-mgmt-url when running from the host (e.g.https://127.0.0.1:31500/roots/0). Fetch usesInsecureSkipVerifybecause Pebble’s management endpoint is self-signed. If the fetch fails, the check falls back to the existing embedded Pebble/minica cert.pkg/orchestration/k8sto pkg/cert (pkg/cert/pebble.go). The k8s helpers that need it now referencecert.PebbleCertificate.Dependencies
lookupViaDNSin forge.go); go.mod updated accordingly.Local / beelocal usage
With P2P WSS enabled, beelocal exposes forge DNS (e.g. NodePort 30053), one bee-autotls WSS (e.g. NodePort 31635), and Pebble management (e.g. NodePort 31500). The
ci-autotlscheck inconfig/local.yamlsets:forge-dns-address: "127.0.0.1:30053"forge-tls-host-address: "127.0.0.1:31635"pebble-mgmt-url: "https://127.0.0.1:31500/roots/0"so that
beekeeper check --cluster-name local-dns-autotls --checks ci-autotlscan run on the host and pass DNS, TLS (at least for the first node), and Pebble CA verification.