Repository navigation
feat: a pullgate recipe in contrib/pullgate, to change the broker config from git - #204
Merged
Merged
Conversation
…fig from git The broker host pulls broker.toml and known_hosts from a private git repo with pullgate. The owner taps Apply on each commit; a config that fails goes back to the last good one. The release packs the recipe as nodkey_VERSION_pullgate.tar.gz, in SHA256SUMS and the attestation. Fixes #102 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 17, 2026
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.
The broker host can now pull its config from a private git repo with pullgate. The owner taps Apply on Telegram for each commit, and a config that fails goes back to the last good one by itself. No SSH login to the broker host is needed for a config change.
What is in it
contrib/pullgate/:nodkey-broker.toml: the pullgate instance config (mode = "ask",on_failure = "rollback",refuse_symlinks = true,max_files,max_tree_bytes).check.sh(check user): both files are plain files, not symlinks; a commit may not change the path ofknown_hostsoraudit_log(compared with the live config bynodkey broker config-diff); thennodkey broker check --files "$PULLGATE_TREE".summary.sh(check user):nodkey broker config-diff --short --max-chars 2000from the applied commit, or from the live config on the first apply.⚠ needs a broker restart: all grants endcomes first when a reload cannot take the change. A⚠line also shows when the live config is not the applied commit (a change by hand).apply.sh(root): checks the files again with the credential names, installs both with the owner and mode of the live files, thennodkey broker reloadorsystemctl restart nodkey. On a failure it puts the old files back, reloads or restarts again, and exits 1.health.sh(root): waits up to 60 s until the broker's own status file names the unit's main process, a result ofstartedorloaded, and the SHA-256 of the livebroker.toml.lib.sh: the one rule for "reload or restart": a reload only when every line of the fullconfig-diffis about a client, secret, project, SSH key (not a new key or key file) or a host key ofknown_hosts. Anything else, or a failed compare, is a restart.nodkey_VERSION_pullgate.tar.gz. It is inSHA256SUMSand covered by the attestation, as the binaries are (release.yml,docs/releasing.md).docs/setup.md, section 10, "Change the config from git with pullgate": the repo layout, what stays a step on the host, the install steps (with the checks of the release file), and how to read the question.Tests
contrib_pullgate_linux_test.goruns the scripts with/bin/shand the environment that pullgate gives, against a fake broker: a fakesystemctland a fakenodkey broker reloadthat write the status file as the broker does, and the realnodkey(built from this tree) for the check and the diff.TestPullgateCheck: a good commit; a missing file; a symlink; a config that is not valid; a movedaudit_log; a movedknown_hosts.TestPullgateSummary: a reload-safe change (no restart line); a restart-type change (the restart line first); a new SSH key (restart); the first apply (against the live config); a hand edit.TestPullgateApply: a reload-safe change (reload), a restart-type change (restart), a refused reload (old files back, reload again, exit 1), a failed restart (old files back, restart again, exit 1), a broker that does not run (restart). After each,health.shmust pass.TestPullgateApplyRefusesBadFiles: nothing is installed for a config that is not valid, or a symlink.TestPullgateHealth: a status file of another process, of another config, of a refused reload, and a broker that does not run: each fails after the timeout.Reviews
A security review and a correctness review ran on the change. Fixed here:
check.sh, andapply.shagain as root (also in a rollback), refuse a change oflisten,tls_key, the paths ofknown_hostsandaudit_log,[telegram],[ntfy], and a new or changed[store.*]. Else a commit could point the channel at its own server, or a token file at another credential, and approve its own requests. These stay steps on the host.--max-chars 1200, not 2000 as the issue says (HTML escaping makes it longer),max_files = 20, and the guide says: tap Skip when the summary is not complete. pullgate itself could put the summary first; that is a change for pullgate.[logins.*]means a restart (the reload compares it exactly).check.shsays early when the liveknown_hostspath is not the one the recipe needs.Not changed:
health.shuses the wall clock (pullgate'sapply_timeoutstill limits it), and its timeout is fixed at 60 s (pullgate gives an empty environment).Fixes #102
🤖 Generated with Claude Code