CephX Key Rotation
Attention
This feature is experimental.
Rook is able to rotate CephX authentication keys used by Ceph daemons and clients.
For this experimental feature, some caveats should be noted:
- Only Ceph versions v19.2.3 and higher have the capabilities Rook requires for key rotation.
- Ceph Monitor (mon) keys cannot be rotated in Ceph v19 due to Ceph architecture limitations.
Overview¶
CephX keys can be rotated when desired on a one-off basis. To provide this capability, Rook utilizes an approximation of Kubernetes's resource generation. A one-time key rotation is initiated by specifying KeyGeneration
as the desired policy (the default policy is Disabled
) and also specify a key generation higher than the current generation.
CephX keys can be divided into two categories, below.
Daemon keys¶
Daemon keys are used internally within a Ceph cluster, and their rotation does not affect CSI volumes or connections to a Ceph cluster from outside.
Daemon key rotation is configured via the CephCluster spec.security.cephx.daemon
config. This will also rotate daemon keys for any CephFilesystem MDSes and CephObjectStore RGWs.
Rotation requires most Ceph daemons to restart, so this operation is best done at the same time the CephCluster spec.cephVersion.image
is updated -- when daemons will normally need to restart.
"Non-daemon" keys¶
Non-daemon keys may reasonably require user action beyond Rook API controls.
Because these keys affect non-daemon connections, Rook allows users to initiate rotation independently during their desired maintenance window.
Below is a list of non-daemon keys along with the controlling config.
- CephCluster CSI keys are controlled via CephCluster
spec.security.cephx.csi
- Rotated CSI keys only take effect for new PVCs. For CSI alone, Rook is able to create new keys while also keeping a number of prior key generations active. This is configured using the
keepPriorKeyCountMax
option.
- Rotated CSI keys only take effect for new PVCs. For CSI alone, Rook is able to create new keys while also keeping a number of prior key generations active. This is configured using the
- The CephCluster RBD mirror peer key is controlled via CephCluster
spec.security.cephx.rbdMirrorPeer
- Each CephBlockPool that has mirroring configured will have a
peerToken
status that references the CephCluster RBD mirror peer key
- Each CephBlockPool that has mirroring configured will have a
- Each CephClient key is controlled via its own
spec.security.cephx
Initiating key rotation¶
To begin experimenting with key rotation, check out CephX config options on Rook CRs.
Example¶
Most key rotations are initiated from the CephCluster. An example spec that will rotate all CephX keys for most new or upgraded Rook clusters is shown below.
Once rotation is complete, CephCluster status should look something like below. Each CephX key type managed for the cluster is listed.
Additionally, any CephFilesystem or CephObjectStore will show the status of rotation for their daemons:
If mirroring is enabled on a CephBlockPool, the following status will mirror the CephCluster's rbdMirrorPeer
status: