Repository navigation
Derive cluster session keys from cluster.pem so isolated-FS masters agree (#70399) - #70429
Merged
dwoz merged 1 commit intoOct 27, 2026
Conversation
dwoz
force-pushed
the
dwoz/fix/70399-cluster-session-key-isolated-fs
branch
from
October 17, 2026 21:30
d46330b to
0202c77
Compare
twangboy
previously approved these changes
Oct 19, 2026
charzl
reviewed
Oct 20, 2026
charzl
left a comment
Collaborator
There was a problem hiding this comment.
Just want to confirm if the derived key still agree across masters after cluster_aes rotates?
Contributor
Author
|
@charzl Yes, key rotation is replicated to the cluster. |
dwoz
force-pushed
the
dwoz/fix/70399-cluster-session-key-isolated-fs
branch
from
October 20, 2026 21:22
0202c77 to
8adca3d
Compare
charzl
approved these changes
Oct 21, 2026
…gree Fixes saltstack#70399. With ``cluster_isolated_filesystem: True`` behind an L4 load balancer, each cluster master's ``session_key(minion)`` wrote a random key to its private ``cachedir/sessions/<minion>`` and returned it in the auth-reply. When the minion's next pillar request was round-robined to a peer, that peer generated its own random key and failed to decrypt the minion's payload with "bad load", surfacing as "Master did not return a session key for pillar request". Derive the per-minion session key via HKDF-SHA256 using ``cluster.pem`` as IKM and ``cluster_aes`` as HKDF salt when the cluster runs with isolated filesystems. ``cluster.pem`` is distributed master-to-master in ``cluster/peer/join-reply`` and never leaves the cluster, so every peer master can derive the same key but no minion can — even though minions all share ``cluster_aes`` (received in their auth-reply to decrypt publish broadcasts, so inherently not a secret from them). This preserves the per-minion session-key secrecy property that prevents one minion from decrypting another's request-channel traffic. ``cluster_aes`` as HKDF salt means a cluster-wide aes rotation (``rotate_cluster_aes_key``) rotates every minion's session key in lockstep across the cluster. Standalone masters and shared-filesystem clusters keep the existing random-file path verbatim.
dwoz
force-pushed
the
dwoz/fix/70399-cluster-session-key-isolated-fs
branch
from
October 27, 2026 01:05
8adca3d to
48ec474
Compare
This branch was previously deployed
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.
Summary
Fixes #70399. On a master cluster with
cluster_isolated_filesystem: Truebehind an L4 load balancer (HAProxy round-robin), minions failed every non-auth request withMaster did not return a session key for pillar request. The minion auth'd against master A and received session keyS_A; a subsequent pillar/publish request round-robined to master B hit "bad load" because B decrypted the payload under its own private randomS_B.Root cause:
ReqServerChannel.session_key()wrote a random key to each master's privatecachedir/sessions/<minion>. Unlike minion keys (replicated viasalt/key/accept) orcluster_aes(distributed incluster/peer/join-reply), the sessions directory had no replication path in isolated-FS mode.salt/crypt.py: addCrypticle.derive_session_key(cluster_aes, minion_id, key_size=192)— HKDF-SHA256 producing the same base64 shape asgenerate_key_stringso callers feed it toCrypticle(...)unchanged.salt/channel/server.py(ReqServerChannel.session_key,PoolRoutingChannel.session_key) andsalt/master.py(AuthFuncs.session_key): whenopts["cluster_id"] and opts["cluster_isolated_filesystem"], derive instead of random-file. In-memory cache tuple keyed on currentcluster_aesvalue so a cluster-wide rotation (rotate_cluster_aes_key) auto-invalidates.Standalone masters and shared-FS clusters keep the existing random-file path verbatim.
Rotation story
cluster_aesis rotated cluster-wide byrotate_cluster_aes_key/SMaster.rotate_cluster_secret. The derivation binds the per-minion session key tocluster_aes, so an aes rotation rotates every minion's session key in lockstep across every peer. Thepublish_sessiontime-based rotation becomes a no-op on isolated-FS clusters (acceptable: it was never reliable there anyway because the random files diverged per master).Test plan
tests/pytests/scenarios/cluster/test_isolated_session_key.pyassertssession_key(minion_id)returns identical bytes on every cluster master. Pre-fix: three distinct random keys → fails. Post-fix: deterministic HKDF derivation from sharedcluster_aes→ identical → passes.3008.xwithout the fix and passes after.tests/pytests/unit/channel: 60 passed.tests/pytests/integration/cluster/test_basic_cluster.pyandtest_isolated_cluster.py(--run-slow): all pass.tests/pytests/scenarios/cluster/: all pass, includingtest_haproxy_isolated_fs.py::test_joiner_cache_matches_disk_after_join_reply.