feat: reworked how we manage kerberos credentials #110

Open
jan-leila wants to merge 9 commits from kerberos-credentials into main
Owner

Machines enroll themselves in the realm with a one time bootstrap secret instead of the kdc staging their keytabs.

  • a machine principal is created without a staged keytab, and a bootstrap principal is armed for it until the machine has enrolled
  • a host whose bootstrap secret is not in the secrets repo yet still builds and warns, instead of failing an assertion; the same on the kdc for a device it has no secret for
  • a ticket or keytab that could not be had is retried soon and then less and less often, rather than at the next refresh
  • the reconciler refuses to act on a realm listing that failed, and leaves machine principals it did not make for enrollment as they are (kerberos-reenroll-host is the explicit way to make one afresh)
  • staging a keytab no longer adds to one already staged under the same name

Split out of the tailnet-acl branch. Tests pass and every host evaluates. emergent, horizon and twilight warn that their bootstrap secret is not in the secrets repo yet.

Machines enroll themselves in the realm with a one time bootstrap secret instead of the kdc staging their keytabs. - a machine principal is created without a staged keytab, and a bootstrap principal is armed for it until the machine has enrolled - a host whose bootstrap secret is not in the secrets repo yet still builds and warns, instead of failing an assertion; the same on the kdc for a device it has no secret for - a ticket or keytab that could not be had is retried soon and then less and less often, rather than at the next refresh - the reconciler refuses to act on a realm listing that failed, and leaves machine principals it did not make for enrollment as they are (`kerberos-reenroll-host` is the explicit way to make one afresh) - staging a keytab no longer adds to one already staged under the same name Split out of the `tailnet-acl` branch. Tests pass and every host evaluates. emergent, horizon and twilight warn that their bootstrap secret is not in the secrets repo yet.
feat: reworked how we manage credentials
All checks were successful
build PR #110: checks passed
69a691dbc2
Merge remote-tracking branch 'origin/main' into kerberos-credentials
All checks were successful
build PR #110: checks passed
868c431ef9
jan-leila force-pushed kerberos-credentials from 868c431ef9
All checks were successful
build PR #110: checks passed
to cde3e62492
All checks were successful
build PR #110: checks passed
2026-11-20 17:46:27 -06:00
Compare
Merge remote-tracking branch 'origin/main' into kerberos-credentials
All checks were successful
build PR #110: checks passed
ace4ba4d1a
# Conflicts:
#	modules/nixos/programs/kerberos/client/client.nix
#	modules/nixos/programs/kerberos/client/storage.nix
#	modules/nixos/programs/kerberos/server/server.nix
#	modules/nixos/programs/kerberos/server/storage.nix
- merge kerberos-adopt-machine-keytab into kerberos-enroll-machine: one
  unit tries the handed keytab, then the bootstrap secret; a .new key is
  only discarded once a credential has proven the kdc answers, kadmin's
  ktadd result is verified with kinit before install, and the install
  fsyncs the file and the directory
- stop retrying (exit 3) when the kdc refuses a handed keytab and there
  is nothing else to enroll with; every retrying unit shares one backoff
- mint user keytabs in a root-only runtime directory and write them into
  the human's directory as that human, so planted links gain nothing
- add bootstrap.enrolled so retired credentials do not warn forever
- bootstrap.users.<n>.enable defaults to false; add keytabs.holders
- ticket spans are integer seconds, lifetime null by default (realm max)
  and capped at the kdc's day; refresh on resume from sleep
- onSuccess instead of systemctl loops; pam_krb5 off in client.nix;
  drop the consumerless sssd.ticketCache option
the reconciler now reads the realm in one pass per table with kdb5_util
tabdump and writes through kadmin.local in script mode, so a failed command
stops the run instead of being read as done, and a keyless principal is no
longer taken for one at its first key. a bootstrap principal is deleted only
once the kdc has seen the machine's new key authenticate (machine principals
now require preauthentication, which is what records it), or a day after the
re-key; until then it stays armed for a device whose keytab never reached
disk. a replaced bootstrap secret is set on an armed principal, its tickets
last five minutes, a lost enrollment mark is repaired, and the acl only
carries bootstrap rows for devices with a secret. adopt acl rows, which
kadmind's self rule made dead, are gone.

the reconciler runs at boot and on configuration change, plus a five minute
poll only while an enrollment is armed, quiet about what it already said.
every helper that changes principals takes the reconciler's lock.
kerberos-reenroll-host refuses a device with no secret and reports what it
actually did; kerberos-rotate-keytab routes before re-keying and refuses
bootstrap, login, realm and unlisted principals; the new
kerberos-revoke-host cuts a compromised machine off once it is out of the
realm, since re-enrolling re-arms it with the secret it holds.

on the fleet side only enabled nixos realm nodes are credentialed, the kdc
is handed every realm login (not only device principal holders), the unused
fleet servicePrincipals option is gone, and a new
`kerberos.bootstrap.enrolled` flag quiets the no-secret warning for devices
that have enrolled already.
fix: hand a member's enrolled flag to its kerberos client
All checks were successful
build PR #110: checks passed
lint formatting fixes pushed
3d8a0f425a
the fleet's kerberos.bootstrap.enrolled now reaches client.bootstrap.enrolled as well as the kdc's devices, so a node that has cut over and dropped its handed keytab warns on neither side.
style: autoformat
Some checks failed
build PR #110: build-all-hosts failed (exit 1); output is in the build-daemon log
6670618142
Merge branch 'main' into kerberos-credentials
All checks were successful
build PR #110: checks passed
e6bcc4dbc6
All checks were successful
build PR #110: checks passed
Required
This pull request is blocked because it's outdated.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin kerberos-credentials:kerberos-credentials
git switch kerberos-credentials
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jan-leila/nix-config!110
No description provided.