Serve available pubkeys lazily #6
Merged
Merged
Conversation
Previously the server read every --ssh-pubkey-file at startup and refused to boot if any was missing. In Flashbox this pinned the pubkey server behind a key that only exists once an encrypted disk is unlocked, so the server (and the attested channel in front of it) was unavailable until after an unattested first SSH connection had already been made (TOFU). Read the configured pubkey files lazily on each request and serve whatever subset is currently available at /pubkey, skipping files that are missing or not yet readable. A key that only appears after startup is then served as soon as it exists, with no restart. /pubkey responds 503 when no key is available yet. Also guard readAndFormatPubkey against empty/half-written files so a partial read is skipped instead of panicking.
1c9729b to
054bef7
Compare
Ruteri
approved these changes
Jun 10, 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.
📝 Summary
Previously the server read every
--ssh-pubkey-fileat startup and refusedto boot if any was missing. In Flashbox this pinned the pubkey server
behind a key that only exists once an encrypted disk is unlocked, so the
server (and the attested channel in front of it) was unavailable until
after an unattested first SSH connection had already been made (TOFU).
Read the configured pubkey files lazily on each request and serve whatever
subset is currently available at
/pubkey, skipping files that are missingor not yet readable. A key that only appears after startup is then served
as soon as it exists, with no restart.
/pubkeyresponds 503 when no key isavailable yet.
Also guard readAndFormatPubkey against empty/half-written files so a
partial read is skipped instead of panicking.
📚 References
✅ I have run these commands
make lintmake testgo mod tidy