Repository navigation
feat: accept dns checks and definitions, gate them on the agent, and feed Expiring - #235
Merged
Merged
Conversation
…feed Expiring A dns check (design 32 S5a) asks a resolver endpoint a question from each source. A create or a definition validates the endpoint with the SDK's rules (https DoH with its path, tls DoT, udp and tcp) and the destination rule every check follows (checkMonitorHost: no private, loopback, link-local, metadata or numeric host), stores it in canonical form so two spellings are one target, and checks the question: a name of at most 253 bytes, a type of A, AAAA, CNAME, TXT, MX or NS, at most 16 expected values in the form an agent compares them in, and NOERROR or NXDOMAIN, the latter with no values. Every refusal names its field. The dns fields are refused on every other kind, and an edit changes the question in place. A definition with method dns takes resolver endpoints as addresses and copies the question onto every expanded monitor; managedMonitorEqual already compares whole records and now reads an empty expected list as a missing one. A source whose agent does not report dns reads agent_too_old and is not handed the check, through the existing gate. Results keep dns_rcode (a mnemonic's shape) and at most 16 answers of at most 255 bytes, cut rather than refused; another kind keeps neither, and an unknown run keeps no answer. A dns result over DoH or DoT keeps its certificate expiry, and Expiring lists such a check by the soonest of its running sources' newest readings, so a vantage point that still sees an unrenewed certificate shows it. A dns resolver whose host is a node's address draws its path to that node. The SDK pin and sdk.ref move to the S5a branch commit (lattice-sdk #45); they are re-pinned after that merges. Tested: go test ./internal/store/ ./internal/server/ (full packages), gosec on both.
A review found two ways a DoH or DoT check could show the wrong expiry. A source that stopped reaching the resolver kept its last certificate reading forever, and as the soonest of the sources' readings it held the resolver in Expiring after the certificate was renewed. A reading more than a week older than the newest one no longer counts. And an agent's cert_not_after was kept as sent: it is now dropped on a run that measured nothing and when it is not a date a certificate carries (before 2000, or 50 years or more ahead). Tested: the new cases fail before the change; focused server and store runs through the desk lock.
…25_s5a-dns-check # Conflicts: # go.mod # go.sum # sdk.ref
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
Design 32 S5a, the DNS check method, server part.
internal/server/monitor_dns.go): adnscreate, edit or definition address uses the SDK'sParseDNSResolverand the destination rule inmonitor_checks.go(checkMonitorHost), so a private, loopback, link-local, metadata or numeric resolver host is refused, as is an unknown scheme or a DoH target without a path. The target is stored canonical (DNSResolver.String), so two spellings expand to one id. The question: name at most 253 bytes, type A/AAAA/CNAME/TXT/MX/NS (default A), at most 16 expected values stored in the form an agent compares,dns_expect_rcodeNOERROR (stored empty) or NXDOMAIN, which takes no values. Every refusal carries R6'sfield(dns_expect[1],dns_name, ...). The dns fields are refused on every other kind; empty ones echoed by an editor are not.MonitorUpdatechanges the question in place; the resolver is the target and cannot change (another spelling of the same endpoint is the same target).dnstakes resolver endpoints as addresses (node targets wait for the dnsproxy engine), copies the question onto each expanded monitor, and an edit of the question alone rewrites every monitor.managedMonitorEqualalready compares whole records; it now reads an emptydns_expectas missing.dns, a source whose agent does not report it readsagent_too_oldand is not handed the check.dns_rcode(mnemonic shape) and at most 16dns_answersof at most 255 bytes, cut rather than refused; other kinds and unknown runs keep neither. A DoH or DoT result keepscert_not_after; any other agent claim of one is still dropped. The bolt row maps the two new fields, and the latest view exposes them.tls_certificateitem, dated by the soonest of each running source's newest certificate reading.SDK pin:
v0.2.24-0.20261025003326-6485e4abe7b9andsdk.ref6485e4ab, the pushed branch commit of LatticeNet/lattice-sdk#45. Re-pin both after that merges.Decisions a reviewer may question:
Left out: node targets for dns definitions (spec: wait for the dnsproxy engine); audit metadata does not list the question.
Test plan
go test ./internal/store/ ./internal/server/(full packages, through the desk lock)gofmt -l .internal/server/monitor_dns_test.go: every create refusal of the spec's server list (private, loopback, metadata resolver, unknown scheme, name over 253 bytes, 17 expected values, rcode other than NOERROR or NXDOMAIN) plus shape and cross-kind refusals, each with its field; canonical storage; edits; the agent gate andagent_too_old; a dns definition with two addresses (three spellings) over two sources expanding to two monitors and four paths, a question-only edit reaching every monitor, the dry run; definition refusals; ingestion bounds and certificate handling; Expiring from two sources