fix: renew authn's own client certificate and clamp the login JWT to it - #76
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Debian 11 LTS ended 2026-08-31; its security pool no longer serves the .deb files its index advertises, so apt-get install fails in CI. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
authn-clientconfigwas written once, at startup, and never renewed. A pod outliving its certificate kept presenting an expired one and every RESTAction call to snowplow failed withx509: certificate has expireduntil someone restarted it. The signer grantsmin(requested, --cluster-signing-duration, signer CA remaining life)— OpenShift pins the middle term to 720h and rotates its signer CA every 30 days, so the year we ask for can come back as a day.authn.krateo.io/certificate-not-{before,after}andwarnwhen it is under 90% of what was requested.authn-clientconfigin the background (internal/certrenewal): issue at startup, re-issue once the certificate passesAUTHN_CRT_RENEWAL_THRESHOLDof its granted lifetime. The certificate is read once per issuance and the loop sleeps straight to the due point — a year-long certificate is one ~8-month sleep, not a poll.NotAfterinencode.Success, so a session can no longer outlive the credential it authenticates with. This is what makes per-user<user>-clientconfigSecrets not need a renewal loop; the reasoning is in the README.AUTHN_SERVICE_CRT_EXPIRES_IN(the 8760h that was hardcoded inmain.go),AUTHN_CRT_RENEWAL_THRESHOLD,AUTHN_CRT_RENEWAL_ENABLED.get+updateon secrets authn already holds, so no chart change is required to ship this.scripts/verify-cert-renewal.shautomates the three checks that have to be measured per distribution (granted window, renewal fires before expiry, apiserver still accepts the renewed certificate).Verification
Unit tests cover the renewal policy, certificate parsing and the clamp. Verified end to end on kind: 7 consecutive renewals at a 10m TTL, each firing ~9 minutes before its own expiry, each renewed certificate accepted by the apiserver as
authn/[authn system:authenticated], exactly one CSR object throughout, and a real login returning a 23h54m57s token against a 24h request.kind honours
spec.expirationSecondsin full, so a capped signer is still unexercised — OpenShift, minikube, k3s, EKS, AKS and GKE remain unverified.