Skip to content

Serve available pubkeys lazily #6

Merged
MoeMahhouk merged 2 commits into
mainfrom
moe/serve-available-keys-per-path
Jun 10, 2026
Merged

Serve available pubkeys lazily #6
MoeMahhouk merged 2 commits into
mainfrom
moe/serve-available-keys-per-path

Conversation

@MoeMahhouk

@MoeMahhouk MoeMahhouk commented Jun 10, 2026

Copy link
Copy Markdown
Member

📝 Summary

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.

📚 References


✅ I have run these commands

  • make lint
  • make test
  • go mod tidy

@MoeMahhouk MoeMahhouk requested a review from Ruteri June 10, 2026 12:23
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.
@MoeMahhouk MoeMahhouk force-pushed the moe/serve-available-keys-per-path branch from 1c9729b to 054bef7 Compare June 10, 2026 13:22
Comment thread httpserver/server.go Outdated
@MoeMahhouk MoeMahhouk marked this pull request as ready for review June 10, 2026 14:05
@MoeMahhouk MoeMahhouk merged commit 768f2ca into main Jun 10, 2026
2 checks passed
@MoeMahhouk MoeMahhouk changed the title Serve available pubkeys lazily on per-key endpoints Serve available pubkeys lazily Jun 10, 2026
@MoeMahhouk MoeMahhouk deleted the moe/serve-available-keys-per-path branch June 11, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants