Repository navigation
fix: renew authn's own client certificate and clamp the login JWT to it (#28) - #40
Merged
Merged
Conversation
This was referenced Oct 29, 2026
…it (#28) Port of krateoplatformops#76 (5088c74), which never reached this repo. authn-clientconfig was written once at boot and never renewed, so a pod that outlived its certificate failed every RESTAction call with an x509 expiry. The signer may also grant much less than requested (OpenShift: 720h cap, 30-day CA rotation). - Read the granted NotAfter and record it as authn.krateo.io/certificate-not-{before,after} Secret annotations; warn when the grant is under 90% of the request. - Renew authn-clientconfig in the background (internal/certrenewal) at AUTHN_CRT_RENEWAL_THRESHOLD of the granted lifetime. - Clamp every login JWT to its certificate's real NotAfter (encode.tokenDuration). Adapted to this repo: - go/authn layout and krateo-platformops module paths - RS256 signing: Extras keeps JwtPrivateKey/JwtKeyID and adds CertNotAfter - the clamp also covers the serviceaccount strategy, which #76 predates - knobs in chart values and schema - docs/certificate-renewal.md replaces #76's README section; architecture, behavior, configuration, gotchas, index, llms.txt and log are updated - #76's CI and Dockerfile changes are dropped, since main already supersedes them - the verify script's stale --wait description is corrected Co-authored-by: EdmondDantes21 <redi.vreto@krateo.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TLFnUe4HXFphxQNAfqFawZ
…nce from log Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TLFnUe4HXFphxQNAfqFawZ
openssl prints English month names and date(1) parses %b in the current locale, so under any non-English locale (e.g. it_IT on macOS) the granted-window parse failed and the script aborted. Found running the script against a kind cluster. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TLFnUe4HXFphxQNAfqFawZ
…tAfter (#28) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TLFnUe4HXFphxQNAfqFawZ
braghettos
force-pushed
the
fix/certificate-renewal
branch
from
October 29, 2026 14:03
3f3a42a to
d614a38
Compare
…ext's apiserver The Secret's server-url is the in-cluster address consumers use (chart default https://kubernetes.default.svc), which does not resolve from a workstation, so step 3 always failed off-cluster. What is under test is the client certificate: present it to the current context's apiserver, trusting that context's CA. Also print sub-hour grants in minutes instead of "0h". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TLFnUe4HXFphxQNAfqFawZ
Collaborator
Author
End-to-end on kind with a capped signer: passI ran the branch image on kind v1.36 with
Recorded row: The run found two bugs in the verify script, both fixed on this branch:
|
This was referenced Oct 29, 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.
Closes #28.
Summary
This ports krateoplatformops#76 (by @EdmondDantes21, merged in the old repo on 2026-09-07). It's the only commit from the old repo that never reached this one; the fix itself is theirs.
authn-clientconfig) is renewed in the background (internal/certrenewal). It's issued at boot and re-issued atAUTHN_CRT_RENEWAL_THRESHOLD(default 0.66) of the granted lifetime. Before this, it was written once and expired in place, breaking every RESTAction call until the pod restarted.authn.krateo.io/certificate-not-{before,after}, and authn logs awarnwhen the signer grants under 90% of the request (OpenShift caps at 720h).NotAfter(encode.tokenDuration), so a session can't outlive its credential. This now includes theserviceaccountstrategy, which Smoke-check contract for a roll; /strategies answers application/json #76 predates.AUTHN_SERVICE_CRT_EXPIRES_IN(8760h),AUTHN_CRT_RENEWAL_THRESHOLD(0.66),AUTHN_CRT_RENEWAL_ENABLED(true). They're in the chart'senvand typed invalues.schema.json; the schema rejects a threshold outside (0,1).Adaptation choices
go/authn/withkrateo-platformopsmodule paths.encode.Extraskeeps this repo's RS256 fields (JwtPrivateKey,JwtKeyID) and addsCertNotAfter. Smoke-check contract for a roll; /strategies answers application/json #76's test was moved from the old shared signing key to an RSA key.mainalready uses the org's reusable workflows andgolang:1.25-trixie.docs/certificate-renewal.md, matching this repo's documentation standard. I also updated:configuration.md(env table and flags)behavior.md(JWT clamp in the response contract)architecture.md(boot step 9)gotchas.md(single-replica assumption; requested lifetime is a wish)index.md,llms.txt,log.mdverify-cert-renewal.shis now atgo/authn/scripts/. Its header claimed--waitrewinds annotations, but the code collapses the threshold and restarts authn; the header now says that.Test plan
go build,go vetandgo test ./...pass locally (12 packages, includingcertrenewal,encode,helpers/kube,config/storage).helm templaterenders the three knobs; the schema rejectsAUTHN_CRT_RENEWAL_THRESHOLD=1.5.go/authn/scripts/verify-cert-renewal.sh --short 15m. Smoke-check contract for a roll; /strategies answers application/json #76 verified kind in the old repo.🤖 Generated with Claude Code
https://claude.ai/code/session_01TLFnUe4HXFphxQNAfqFawZ