Skip to main content
RunBook Academy

CephXXXI · Ceph Authentication (cephx)Ceph Authentication (cephx)

Keyrings: format, locations, and handling

Intermediate⏱ ~15 minceph

What you'll learn

  • Read and write keyring file format
  • Know the paths Ceph searches for keyrings
  • Apply correct permissions and ownership
  • Handle keyring distribution securely

Prerequisites

None — start here.

Verified against Ceph Tentacle 20.2.x · Ceph Squid 19.2.x (supported previous) · cephadm matches the verified Ceph release · podman 4.x · csi-rbd and csi-cephfs current · RBD / CephFS / RGW current (matches Ceph release) · Linux kernel 5.15+ (5.10 minimum) · Ubuntu 24.04 LTS (Ceph host baseline) · Debian 12 (Bookworm) (Ceph host baseline) · Rocky Linux / RHEL / AlmaLinux 9.x (Ceph host baseline) · Proxmox VE 9.x (cross-course integration) · Kubernetes 1.31+ (cross-course integration) · 2026-08-18

Not yet marked complete on this device.

Why this matters in production

A keyring is a plaintext secret in a file. Everything about how it is created, stored, copied, and deleted is a security decision, and the defaults are convenient rather than careful.

The format

[client.rbd-prod]
	key = AQCzX2VhVjNwMhAAqR7v8NkTzY3pQxLmW9dAfg==
	caps mon = "allow r"
	caps osd = "allow rwx pool=rbd-vms"

Plain INI text. The key is the shared secret; anything holding this file can authenticate as that entity. The caps lines are informational in the file — the authoritative capabilities live in the monitor store.

Where Ceph looks

In order, by default:

/etc/ceph/$cluster.$name.keyring
/etc/ceph/$cluster.keyring
/etc/ceph/keyring
/etc/ceph/keyring.bin

So client.rbd-prod on cluster ceph is found at /etc/ceph/ceph.client.rbd-prod.keyring. Override explicitly when needed:

ceph -n client.rbd-prod --keyring /path/to/keyring -s
ceph config set global keyring /custom/path/keyring

Permissions

chown ceph:ceph /etc/ceph/ceph.client.rbd-prod.keyring
chmod 600      /etc/ceph/ceph.client.rbd-prod.keyring

600 and owned by the account that needs it. A world-readable keyring is a credential handed to every user on the host. Check across your fleet:

find /etc/ceph -name '*.keyring' -perm /o+r -ls

Creating and extracting

# create the entity and write its keyring in one step
ceph auth get-or-create client.backup \
    mon 'allow r' osd 'allow rw pool=backup' \
    -o /etc/ceph/ceph.client.backup.keyring

# extract an existing entity's keyring
ceph auth get client.backup -o /tmp/backup.keyring

# just the key, for embedding in a secret store
ceph auth print-key client.backup

print-key is the right form when feeding a secret manager or a Kubernetes Secret — it emits the key alone with no surrounding file structure.

Distribution

The insecure habits are copying keyrings with scp into shared directories, checking them into configuration management in plaintext, and leaving them in /tmp. The better patterns:

  • Generate on the monitor and transfer over an encrypted channel directly to the destination path
  • Store in a secret manager and render at deploy time
  • For Kubernetes, a Secret populated from print-key
  • Never in a Git repository, encrypted or otherwise, unless the repository is itself a managed secret store

Quiz

Knowledge check · 4 questions

  1. Q1. A user edits the caps lines in their keyring file to grant themselves `osd allow *`. What access do they gain?

  2. Q2. `ceph auth print-key` is the appropriate way to obtain a key for storage in a secret manager.

  3. Q3. Respond to a leaked credential.

    During an incident call, an engineer pastes the output of `ceph auth get client.rbd-prod` into a shared chat channel that is archived indefinitely and readable by 300 people. The entity has rwx on the production RBD pool.

  4. Q4. Why is a world-readable keyring file a serious problem even on a host only administrators access?

Passing score: 75%. Answers are checked in this browser.

Production discipline

Audit keyring file permissions across the fleet on a schedule, and make secret-manager storage the default distribution mechanism rather than file copying. Treat any key that has appeared in chat, a ticket, a terminal recording, or shell history as compromised and rotate it — without exception, because the exceptions are how leaks persist.

Cross-course references

  • Kubernetes: Secrets carry the same handling requirements and the same paste-into-chat risk
  • Linux: SSH private key handling follows identical rules for identical reasons