internal/authctl: an account JWT whose signer the servers do not list is not pushed or counted as distributed #26
No reviewers
Labels
No labels
accessibility
bug
dependencies
documentation
duplicate
enhancement
go
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/nats-operator!26
Loading…
Reference in a new issue
No description provided.
Delete branch "mikluko/octant/2387-untrusted-operator-key"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
X2387, gap 8 of Q2376.
A full resolver acknowledges and stores a pushed account JWT before anything checks its issuer, and refuses it only when it is applied, so a push under a NATS operator key the servers do not list read as distributed and broke the account at the next server start.
The auth controller now reads each server's trusted NATS operator claims from
$SYS.REQ.SERVER.PING.VARZ, alongside the STATSZ roster poll.Sent in the mixed case because a signing-key rotation rolls servers one by one, and a restarted server needs the JWT under the new key; refusing until all list it would leave accounts down on restarted servers where the old key was dropped.
Rejected:
$SYS.REQ.ACCOUNT.<key>.INFOafter the push. It shows what a server applied, but only after the untrusted JWT is already on disk, costs a request per account, and loads every account on every server.Not caught: a server whose VARZ carries no NATS operator claims (configured by
trusted_keys), one that does not answer VARZ, and a system user issued before this change, which lacks the VARZ permission until its creds are reissued. Each is taken to trust the key, which is the behaviour before this change. A JWT an older auth controller already pushed stays on the servers' disks; it is now counted 0 and named by the condition.nats-server v2.15.0, the version
go.modpins:server/accounts.go:4559-4574— CLAIMS.UPDATE saves and repliesjwt updatedwith no issuer checkserver/server.go:2211—verifyAccountClaimsrefuses an untrusted issuer, on applyserver/monitor.go:1294,1743— VARZtrusted_operators_claimserver/reload.go:1619— trusted operators are restart-only, so a server's keys hold for the life of its server IDShared code:
PresetAuthControllerininternal/jwtplane/user.gogains one subject; the push error ataccount.go:171andsystemaccount.go:121goes throughignoreUndelivered.Tests that fail without the check:
TestResolvers_UntrustedSigner,TestTakeover_UntrustedSigner.