server: enroll against fmr.echo-lot.app; mint links from the CLI

The control plane now advertises the same name the web UI answers on.
That is safe because the client authenticates by SPKI pin and explicitly
does not verify the hostname — "pin is the trust, not the name" — so no
certificate covers or needs to cover either name.

The per-host name still means something, though, and the rule it encodes
has to survive: pinning binds a client to one server's key, so fmr may be
a CNAME to exactly one host and never a multi-address service record. A
second server gets enrolled as fmr-2 explicitly, because a client that
reaches a different key does not fail over, it fails.

Minting a link was broken and had been since the authenticated admin UI
replaced the old admin API: enroll-link.sh still posted to
127.0.0.1:8444/admin/enroll-tokens, an endpoint that no longer exists on
a listener that no longer binds loopback. Rather than add a second
unauthenticated door — which is how the old one ended up briefly reachable
from the network — the binary mints its own link. Whoever can run it
against the state directory already holds every privilege the server has,
so authenticating them to themselves would be theatre.

EnrollmentURI is shared with the running server's EnrollmentLink rather
than reimplemented. Two copies of that encoding would eventually disagree,
and the failure mode is a pin that looks right and surfaces as an
inscrutable TLS error rather than as a bad pin.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
mrambossek
2026-08-01 23:16:23 +02:00
co-authored by Claude Opus 5
parent 8001234e8b
commit e0428b4c84
4 changed files with 69 additions and 11 deletions
+9 -1
View File
@@ -201,6 +201,7 @@ func Load(args []string) (*Config, *Actions, error) {
fs.BoolVar(&a.SetAdminPassword, "set-admin-password", false,
"set the break-glass admin password (username as --admin-user, password read from stdin) and exit")
fs.StringVar(&c.AdminUser, "admin-user", envOr("ADMIN_USER", "admin"), "username for the break-glass admin")
fs.StringVar(&a.MintEnrollToken, "mint-enroll-token", "", "mint a single-use enrollment link (argument is a note for the audit log) and exit")
fs.BoolVar(&a.SelfUpdate, "self-update", false, "check for a newer release, replace this binary, and exit")
fs.BoolVar(&a.Version, "version", false, "print version and exit")
@@ -215,7 +216,7 @@ func Load(args []string) (*Config, *Actions, error) {
// is a usage error rather than success — otherwise a service manager sees a clean exit and
// concludes the server ran and finished.
if !a.Serve && !a.InstallSystemd && !a.UninstallSystemd && !a.SelfUpdate &&
!a.SetAdminPassword && !a.Version {
!a.SetAdminPassword && !a.Version && a.MintEnrollToken == "" {
a.Help = true
}
if a.Serve {
@@ -334,6 +335,13 @@ type Actions struct {
UninstallSystemd bool
SelfUpdate bool
SetAdminPassword bool
// MintEnrollToken is the note to record against a freshly minted enrollment link.
//
// A local action rather than an HTTP endpoint: whoever can run this binary against the state
// directory already has every privilege the server has, so authenticating them to themselves
// would be theatre — and an unauthenticated endpoint on loopback is how the admin API was
// briefly reachable from the network by accident.
MintEnrollToken string
Version bool
}