Repository navigation
feat: reload the broker config without a restart - #175
Merged
Merged
Conversation
SIGHUP makes the broker load its config again, with the same checks as a start. `nodkey broker reload` sends the signal, waits for the result in reload-status.json, and exits 0 only when the broker loaded the config that is in the file now. - A reload may change clients, secrets, keys and known_hosts. Any other change is refused with "needs a restart". An invalid config is refused; the old one stays, and the journal says why. - Grants that the new config allows in the same way stay, with the same uses left and the same end. All others end at once (grant_ended with cause config_changed). - A removed client, or a client with a new pin, gets 403 on its open connection and the connection closes. - A request that waits for a tap during a reload starts no grant, and is checked again before and after a fetch or a signature. - Each reload writes a config_reloaded audit entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #29.
What
SIGHUPmakes the broker load its config again, with the same code and checks as a start (config.LoadBroker, then the SSH keys).nodkey broker reload [--config FILE] [--timeout DURATION]sends the signal, waits for the result inreload-status.json(next to the audit log), and exits 0 only when the broker loaded the config that is in the file now (it compares the SHA-256). Otherwise it exits 1 with the reason; 64 on wrong usage.[client.*],[secret.*],[key.*]andknown_hosts. Any other change is refused with "needs a restart" (config.Broker.ReloadFixedcompares everything else, also fields added later).grant_endedwith the new causeconfig_changed; the message loses its Revoke button).config_reloadedaudit entry.Progress
Reload, grants kept or ended, no grant from a request checked with an old configSetClients, per-request pin checknodkey brokerSIGHUP, status file;nodkey broker reloadgo test -race ./...,go vet,golangci-lintTests
internal/approval:TestReloadKeepsMatchingGrants(same uses left, same end; removed secret ends withconfig_changed),TestReloadEndsChangedGrants,TestReloadEndsGrantsOfChangedKeyFile,TestReloadRemovedClient,TestReloadDuringWait,TestReloadDuringWaitPreapproveinternal/config:TestReloadFixed,TestReloadSameinternal/broker:TestStillAllowedcmd/nodkey(real broker in a child process):TestBrokerReload(loaded; invalid config refused and the old one stays; a change that needs a restart refused; a removed key gone at once; a client with a new pin refused on its open connection;config_reloadedentries),TestBrokerReloadDuringTap,TestBrokerReloadNoBroker(no status file, a stale PID, a symbolic link),TestBrokerReloadUsageSecurity review
Two passes of
.claude/agents/security-reviewer.md. First pass: 2 medium, 4 low, all fixed (the order of the swaps, a pin check per request, a check of the core's decision config, a second check after fetch or sign, ssh-grant answer after a reload, cleaned status text,ReloadFixedby allowed fields). Second pass: no medium or higher; two low findings fixed (ssh-grant now asks the core whetherStartGrantsskipped the grants; an unused function removed).Not done, and why: the second pass also asked for more tests: the
loadNewpath where the service refuses after the server got the new pins (the old pins come back), an SSH login that waits for a tap while a reload changes the key's hosts, and key cases inTestStillAllowed. The code for these paths is covered by the same checks as the tested secret paths; They are filed as #176.Dependencies
None new.
🤖 Generated with Claude Code