Serve direct children's certificates through a proxy group; PR 81 follow-ups; writer busy gauge #84

Merged
calvin merged 1 commit from children-certificates into master 2026-11-15 08:45:17 +00:00
Owner

What

A. A proxy group serves its direct children's certificates (S1). A certificate that belongs to a direct child organisation (e.g. a DNS-01 wildcard ordered in balie-platform) can be attached to the parent's (Shiloh) group and is delivered to its nodes.

  • One level down only: never upward, no siblings, no grandchildren, no strangers (all "not found").
  • A child's certificate is served only when attached, not just because it covers a route. Detach, disable, delete, or the child leaving the parent stops delivery.
  • Renewal: certificate_changed/1 now also raises the generation of the parent's groups, so a renewed child certificate is redelivered.
  • Audit entries are written in both organisations (group's and child's) on attach and detach.
  • Console: the attach list shows the children's certificates labelled with the organisation name; served certificates show their owning organisation. API: same endpoints, no new routes; the served listing gains organisation_id; OpenAPI updated.

Authorization choice. The existing routing-manage check on the group still applies. For a child's certificate the actor additionally needs either certificates:manage in the group's organisation (owner/admin; a credential with a certificates grant covering the zone) or certificates:read in the child. A proxy grant alone is not enough: the certificate brings its private key to the group's nodes, and a routing grant must not reach a customer's keys. I did not use can_read_customers? because credentials need to work through the API (a provider's API credential with proxy + certificates grants can attach). Note that for users the first clause is equivalent to the routing-manage check (owner/admin), so a user needs no role in the child; the second clause is kept as a defence. Refusals look like "not found" so other organisations' ids are not confirmed. Detach needs only routing-manage on the group (removing access should never be blocked). A grant is not re-checked after attaching; the attachment lasts until detached.

B. PR 81 follow-ups.

  1. Address refresh is min(300, status_max_age / 4) of the node's group (chosen over raising the group minimum: it keeps 60 s usable). Computed inside the same conditional UPDATE (no extra query per status).
  2. apply_replacement takes lock_zones_shared() first, the same order as put_route; race tests green.
  3. Documented that the operator name of assign_address/unassign_address is free text typed at the shell, audited as actor system (docs/certificates.md).

C. Writer gauge. salt_dns_knot_writers is the number of writers alive (never a backlog; unchanged, now documented as such). New salt_dns_knot_writers_busy counts writers that are dirty, hold buffered change lists or have an unfinished removal. Writers publish their busy state as their own Registry value when it changes; the poller does one ETS scan, no GenServer.call. Writer lifetime is unchanged. SaltDnsWriterLag (rules + promtool test) and docs/edge.md use the busy gauge.

D. redact: true on the provider's account_key and eab_hmac_key; nothing used the unredacted inspect.

Tests

New: proxy_children_certificates_test.exs (every direction, who may, delivery to nodes, renewal redelivery, detach, audit, reparenting), knot/zone_writer_busy_test.exs, API and console tests, refresh-interval test, changeset-inspect test.

Not done / not verified

promtool is not installed here, so the edited alert rule test was not run. Nothing touched credentials, router pipelines or config.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DnYzaTxC2GmdSpvCNyHNne

## What **A. A proxy group serves its direct children's certificates (S1).** A certificate that belongs to a direct child organisation (e.g. a DNS-01 wildcard ordered in `balie-platform`) can be attached to the parent's (`Shiloh`) group and is delivered to its nodes. - One level down only: never upward, no siblings, no grandchildren, no strangers (all "not found"). - A child's certificate is served only when attached, not just because it covers a route. Detach, disable, delete, or the child leaving the parent stops delivery. - Renewal: `certificate_changed/1` now also raises the generation of the *parent's* groups, so a renewed child certificate is redelivered. - Audit entries are written in both organisations (group's and child's) on attach and detach. - Console: the attach list shows the children's certificates labelled with the organisation name; served certificates show their owning organisation. API: same endpoints, no new routes; the served listing gains `organisation_id`; OpenAPI updated. **Authorization choice.** The existing routing-manage check on the group still applies. For a child's certificate the actor additionally needs *either* certificates:manage in the group's organisation (owner/admin; a credential with a `certificates` grant covering the zone) *or* certificates:read in the child. A `proxy` grant alone is not enough: the certificate brings its private key to the group's nodes, and a routing grant must not reach a customer's keys. I did not use `can_read_customers?` because credentials need to work through the API (a provider's API credential with `proxy` + `certificates` grants can attach). Note that for users the first clause is equivalent to the routing-manage check (owner/admin), so a user needs no role in the child; the second clause is kept as a defence. Refusals look like "not found" so other organisations' ids are not confirmed. Detach needs only routing-manage on the group (removing access should never be blocked). A grant is not re-checked after attaching; the attachment lasts until detached. **B. PR 81 follow-ups.** 1. Address refresh is `min(300, status_max_age / 4)` of the node's group (chosen over raising the group minimum: it keeps 60 s usable). Computed inside the same conditional `UPDATE` (no extra query per status). 2. `apply_replacement` takes `lock_zones_shared()` first, the same order as `put_route`; race tests green. 3. Documented that the operator name of `assign_address`/`unassign_address` is free text typed at the shell, audited as actor `system` (docs/certificates.md). **C. Writer gauge.** `salt_dns_knot_writers` is the number of writers alive (never a backlog; unchanged, now documented as such). New `salt_dns_knot_writers_busy` counts writers that are dirty, hold buffered change lists or have an unfinished removal. Writers publish their busy state as their own `Registry` value when it changes; the poller does one ETS scan, no `GenServer.call`. Writer lifetime is unchanged. `SaltDnsWriterLag` (rules + promtool test) and docs/edge.md use the busy gauge. **D.** `redact: true` on the provider's `account_key` and `eab_hmac_key`; nothing used the unredacted inspect. ## Tests New: `proxy_children_certificates_test.exs` (every direction, who may, delivery to nodes, renewal redelivery, detach, audit, reparenting), `knot/zone_writer_busy_test.exs`, API and console tests, refresh-interval test, changeset-inspect test. ## Not done / not verified `promtool` is not installed here, so the edited alert rule test was not run. Nothing touched credentials, router pipelines or config. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DnYzaTxC2GmdSpvCNyHNne
Serve direct children's certificates through a proxy group; review follow-ups; writer busy gauge
All checks were successful
ci/woodpecker/pr/image Pipeline was successful
ci/woodpecker/pr/quality Pipeline was successful
ci/woodpecker/pr/integration Pipeline was successful
e4bd3432d2
A: a certificate of a direct child organisation can be attached to the parent's
proxy group and is delivered to its nodes (renewals included); audit in both
organisations; console and API through the existing paths.
B: address refresh min(300, status_max_age/4); one lock order in apply_replacement;
operator name documented.
C: salt_dns_knot_writers_busy (writers with work), SaltDnsWriterLag uses it.
D: redact the provider's encrypted keys in changesets.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnYzaTxC2GmdSpvCNyHNne
Review fixes for children's certificates: time zone, audit trail, withdrawal, writer busy
Some checks failed
ci/woodpecker/pr/image Pipeline was successful
ci/woodpecker/pr/quality Pipeline was successful
ci/woodpecker/pr/integration Pipeline was canceled
0067c6cf33
- address refresh compares in the column's own type (no session time zone)
- group history lists each change once; Proxy.list_foreign_changes/2 for the child
- disabling/deleting an attached certificate (zone, child organisation) bumps groups
- drop the dead "read in the child" clause; docs state the rule
- zone writer: busy before blocking calls, not busy after a finished removal
- tests: time zone, forged detach, withdrawal

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnYzaTxC2GmdSpvCNyHNne
calvin force-pushed children-certificates from 0067c6cf33
Some checks failed
ci/woodpecker/pr/image Pipeline was successful
ci/woodpecker/pr/quality Pipeline was successful
ci/woodpecker/pr/integration Pipeline was canceled
to e5d47d7ea7
All checks were successful
ci/woodpecker/pr/image Pipeline was successful
ci/woodpecker/pr/quality Pipeline was successful
ci/woodpecker/pr/integration Pipeline was successful
2026-11-15 08:31:16 +00:00
Compare
calvin merged commit 8f408d169c into master 2026-11-15 08:45:17 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
external/salt-dns!84
No description provided.