Skip to main content
RunBook Academy

CephCIII · Secrets and Key ManagementSecrets and Key Management

Finding every copy of a keyring

Advanced⏱ ~18 mincephgrepfind

What you'll learn

  • Enumerate where keyrings legitimately live
  • Sweep for copies outside those places
  • Assess what each copy grants
  • Reduce the footprint without breaking clients

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

Rotation, revocation, and incident response all require knowing where a key exists. Almost no cluster does.

Where keyrings legitimately live

LocationContents
/etc/ceph/ceph.client.<name>.keyringclient keys on hosts that use them
/var/lib/ceph/<fsid>/<daemon>/keyringper-daemon identities
The monitor auth databasethe authoritative copy of every key
A Kubernetes Secretkeys for CSI provisioners and node plugins
A secret managerthe intended distribution source
ceph auth ls --format json | python3 -c '
import sys,json
for e in json.load(sys.stdin)["auth_dump"]:
    print(e["entity"])'
That is the list of keys that exist. The question is where each one has
been copied to.

Sweeping for copies

# on every Ceph and client host
find / -xdev -name '*.keyring' -o -name 'ceph.conf' 2>/dev/null | \
  grep -v '^/proc' | head -40
# files containing a cephx key, wherever they are named
grep -rIl --exclude-dir=/proc --exclude-dir=/sys \
  -E 'key[[:space:]]*=[[:space:]]*AQ[A-Za-z0-9+/=]{20,}' / 2>/dev/null | head -20
Ceph keys are base64 and conventionally begin AQ, which makes them
greppable. That is convenient for an audit and equally convenient for
anyone else with filesystem access.
Place to checkWhy
Container imagesa key baked into a layer persists in the registry
Git repositoriesincluding history, not only the current tree
CI/CD variables and logskeys echoed by debug output
Configuration management reposAnsible vars, Puppet hiera, Salt pillars
Backup archiveskeyrings included in host backups
Ticket systems and chatpasted during troubleshooting
Developer workstationscopied “temporarily”
# git history, in a repo that may have held one
git log -p --all -S 'AQ' -- '*keyring*' 'ceph.conf' 2>/dev/null | head -40
# container images
# Substitute the image you are auditing before running:
IMAGE=registry.example.com/apps/backup-agent
TAG=v2.4.1

skopeo inspect --config "docker://$IMAGE:$TAG" 2>/dev/null | grep -i ceph

Assessing each copy

# what a found key grants
NAME=acme
ceph auth get client.${NAME}
Copy holdsConsequence
client.adminfull cluster control, plus the cephadm key
A pool-scoped client keythat pool’s data
A monitoring keycluster state disclosure
A daemon keyringthat daemon’s identity
Assess before panicking and before ignoring. A read-only monitoring key
in a git repository is a real finding with a modest consequence.

Reducing the footprint

For each copy that should not exist:
  establish whether anything uses it
  if not, delete the file and record it
  if yes, move that consumer to the intended distribution path
  then delete the file
  if the copy was in git history or a registry, the key must be rotated
# rotation is required, not optional, for a key that reached a
# location you cannot fully purge
# the exposed entity, from the assessment above
NAME=acme

ceph auth get "client.${NAME}" -o /tmp/old.keyring   # keep for rollback

Quiz

Knowledge check · 4 questions

  1. Q1. A cephx key is found in a git repository's history. What is the correct response?

  2. Q2. A cephx secret can be found across a filesystem, a git history, or a log archive with a single regular expression.

  3. Q3. Sweep for keyring copies.

    Before a rotation exercise, the team wants to know where each key exists so rotation does not break unknown consumers.

  4. Q4. What control is cheaper than a periodic keyring sweep?

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

Production discipline

Rotate — do not merely delete — any key found in git history, a container registry, or anywhere else that cannot be fully purged. Configure secret-scanning for the cephx key pattern; catching a key before it spreads costs far less than sweeping for it afterwards.

Cross-course references

  • Kubernetes: a Secret committed to git requires rotation for the identical reason
  • Linux: credential scanning at commit time is cheaper than credential archaeology