[SOLVED] ceph key migration on ceph-fs

freshdomi

Member
Oct 20, 2022
4
1
23
Hello,

i currently trying to rotate the keys of my ceph storage; all vms on all hosts have been rotated successfully exepect 4 hosts having the ceph-fs mount and i cant get them using the new keys.. i already tried Live Migration, Stop/Start the VM, Stopping all vms having the ceph-fs mount and umounted the ceph-fs on all px hosts.. nothing worked..
is there something i have missed?

next step would be Stopping the vms and start the script with the option '--confirm-all-clients-refreshed' and hoping that everything goes up again..



Code:
root@px01:~# /usr/share/pve-manager/migrations/pve-cephx-rotate-service-keys --rotate-all-storage-keys --rotate-admin-key --verbose
INFO: This is a dry run. No Ceph key, cipher setting, or daemon will be changed. Session observations can update the migration journal.
INFO: the new key of 'client.admin' is staged next to its current one; both authenticate until it is committed with '--confirm-clients-refreshed client.admin' or, once every open record is ready, '--confirm-all-clients-refreshed'
PASS: Every service key uses 'aes256k', and so do the service tickets.

Client keys awaiting action:
  'client.admin': 4 session(s) still authenticate with a previous key (172.26.233.46: 1,
    172.26.233.47: 1, 172.26.233.48: 1, 172.26.233.50: 1). Both keys remain valid. Refresh these
    clients, then rerun without options.
Refresh clients of the affected Ceph users:
  Live-migrate affected VMs to another up-to-date node with the new keyring, including VMs with
    kernel RBD disks. A guest reboot does not reload the key. Fully stop and start only VMs that
    cannot be migrated.
  Remount affected kernel CephFS mounts. A container on RBD keeps the key its disks were mapped
    with until it is fully stopped and started. Restart other clients after updating any external
    key copies.
The Ceph CLI and Proxmox VE storages without a dedicated user normally use 'client.admin'. VMs and mounts on those storages can retain its previous key.
Session absence does not prove that disconnected clients or external key copies were refreshed.
 
Hi,

Did you resolved the issue? If not - please provide us with the current script output and `pveversion -v`.
 
Hello,

I have the same behavior, after migrating all the guest, 1 sessions per host seems reported active by the script.

Bash:
root@h04:~# /usr/share/pve-manager/migrations/pve-cephx-rotate-service-keys
INFO: This is a dry run. No Ceph key, cipher setting, or daemon will be changed. Session observations can update the migration journal.
PASS: Every service key uses 'aes256k', and so do the service tickets.

Client keys awaiting action:
  'client.admin': 4 session(s) still authenticate with a previous key (h01: 1, h02: 1, h03: 1, h04:
    1). Both keys remain valid. Refresh these clients, then rerun without options.
Possible clients (host-wide hints, not session attribution):
Kernel hints mean sockets without an owning process.
  h01: VM 102, VM 211, VM 218, VM 224, VM 243, VM 252, VM 283, VM 288, 11 more VMs; 3 unattributed sockets (possible kernel clients)
  h02: VM 200, VM 201, VM 231, VM 236, VM 242, VM 244, VM 246, VM 248, 18 more VMs; 3 unattributed sockets (possible kernel clients)
  h03: VM 204, VM 208, VM 209, VM 212, VM 214, VM 215, VM 220, VM 222, 13 more VMs; 2 unattributed sockets (possible kernel clients)
  h04: VM 282; 3 unattributed sockets (possible kernel clients)
Refresh clients of the affected Ceph users:
  Live-migrate affected VMs to another up-to-date node with the new keyring, including VMs with
    kernel RBD disks. A guest reboot does not reload the key. Fully stop and start only VMs that
    cannot be migrated.
  Remount affected kernel CephFS mounts. A container on RBD keeps the key its disks were mapped
    with until it is fully stopped and started. Restart other clients after updating any external
    key copies.
The Ceph CLI and Proxmox VE storages without a dedicated user normally use 'client.admin'. VMs and mounts on those storages can retain its previous key.


Bash:
root@h04:~# pveversion -v
proxmox-ve: 9.2.0 (running kernel: 7.0.14-30-pve)
pve-manager: 9.2.32 (running version: 9.2.32/60a22e26e411402f)
proxmox-kernel-helper: 9.2.1
pve-kernel-6.2: 8.0.5
proxmox-kernel-7.0: 7.0.14-30
proxmox-kernel-7.0.14-30-pve-signed: 7.0.14-30
proxmox-kernel-6.8.12-43-pve-signed: 6.8.12-43
proxmox-kernel-6.8: 6.8.12-43
proxmox-kernel-6.5.13-6-pve-signed: 6.5.13-6
proxmox-kernel-6.5: 6.5.13-6
proxmox-kernel-6.5.11-6-pve-signed: 6.5.11-6
proxmox-kernel-6.2.16-20-pve: 6.2.16-20
proxmox-kernel-6.2: 6.2.16-20
proxmox-kernel-6.2.16-19-pve: 6.2.16-19
pve-kernel-6.2.16-3-pve: 6.2.16-3
ceph: 19.2.7-pve1
ceph-fuse: 19.2.7-pve1
corosync: 3.2.0-pve1
criu: 4.1.1-1
frr-pythontools: 10.6.1-1+pve3
ifupdown2: 3.3.0-1+pmx14
intel-microcode: 3.20260925.1~deb13u1
ksm-control-daemon: 1.5-1
libjs-extjs: 7.0.0-9
libproxmox-acme-perl: 1.7.3
libproxmox-backup-qemu0: 2.0.4
libproxmox-rs-perl: 0.4.3
libpve-access-control: 9.2.2
libpve-apiclient-perl: 3.4.3
libpve-cluster-api-perl: 9.1.12
libpve-cluster-perl: 9.1.12
libpve-common-perl: 9.2.12
libpve-guest-common-perl: 6.0.11
libpve-http-server-perl: 6.0.7
libpve-network-perl: 1.6.10
libpve-notify-perl: 9.1.12
libpve-rs-perl: 0.16.3
libpve-storage-perl: 9.1.18
libspice-server1: 0.15.2-1+b1
lvm2: 2.03.31-2+pmx1
lxc-pve: 7.0.0-2
lxcfs: 7.0.0-pve1
novnc-pve: 1.7.0-3
proxmox-backup-client: 4.2.14-1
proxmox-backup-file-restore: 4.2.14-1
proxmox-backup-restore-image: 1.1.0
proxmox-enterprise-support-keyring: 1.1
proxmox-firewall: 1.2.6
proxmox-kernel-helper: 9.2.1
proxmox-mail-forward: 1.2.0
proxmox-mini-journalreader: 1.7
proxmox-widget-toolkit: 5.2.15
pve-cluster: 9.1.12
pve-container: 6.1.24
pve-docs: 9.2.15
pve-edk2-firmware: 4.2026.08-1
pve-esxi-import-tools: 1.0.1
pve-firewall: 6.0.8
pve-firmware: 3.18-9
pve-ha-manager: 5.2.6
pve-i18n: 3.11.0
pve-notify-worker: 1.2.0
pve-qemu-kvm: 11.1.3-4
pve-xtermjs: 6.0.0-3
qemu-server: 9.2.20
smartmontools: 7.5-pve2
spiceterm: 3.4.2
swtpm: 0.10.2+pve3
vncterm: 1.9.2
zfsutils-linux: 2.4.4-pve1
 
Hi,

Thanks for the response.
Can you be more specific on "ensure that the CephFS is not active or idle" ?
I only have ISO and CT Template on CephFS, I've disconnected all remaining iso from all VM, I even try to disable "cephfs" storage on the cluster.
No change on the script output with --apply, still have 1 connection left per node.
I noticed that disabling cephfs cluster storage don't remove the mount on /mnt/pve/cephfs, do I need to unmount it manually ? If yes what's the safe way to be able to remount it after.

Code:
root@h04:~# /usr/share/pve-manager/migrations/pve-cephx-rotate-service-keys --apply
INFO: Recovery and confirmations may run before the remaining plan can be shown.

Apply this run, including recovery and any requested key confirmations? (y/N) y
INFO: Collecting cluster info.
PASS: Every service key uses 'aes256k', and so do the service tickets.

Client keys awaiting action:
  'client.admin': 4 session(s) still authenticate with a previous key (h01: 1, h02: 1, h03: 1, h04:
    1). Both keys remain valid. Refresh these clients, then rerun without options.
Possible clients (host-wide hints, not session attribution):
Kernel hints mean sockets without an owning process.
  h01: VM 102, VM 211, VM 218, VM 224, VM 243, VM 252, VM 283, VM 288, 11 more VMs; 3 unattributed sockets (possible kernel clients)
  h02: VM 200, VM 201, VM 231, VM 236, VM 242, VM 244, VM 246, VM 248, 18 more VMs; 3 unattributed sockets (possible kernel clients)
  h03: VM 204, VM 208, VM 209, VM 212, VM 214, VM 215, VM 220, VM 222, 13 more VMs; 2 unattributed sockets (possible kernel clients)
  h04: VM 282; 3 unattributed sockets (possible kernel clients)
Refresh clients of the affected Ceph users:
  Live-migrate affected VMs to another up-to-date node with the new keyring, including VMs with
    kernel RBD disks. A guest reboot does not reload the key. Fully stop and start only VMs that
    cannot be migrated.
  Remount affected kernel CephFS mounts. A container on RBD keeps the key its disks were mapped
    with until it is fully stopped and started. Restart other clients after updating any external
    key copies.
The Ceph CLI and Proxmox VE storages without a dedicated user normally use 'client.admin'. VMs and mounts on those storages can retain its previous key.
 
I meant unused. Storage ISO files are fine, no process should currently use the mount. And disabling the storage does not unmount it. You have to run:
Bash:
umount /mnt/pve/cephfs
then re-enable the storage and run `pvesm status --storage cephfs` on every node to remount it.

Afterwards, rerun the migration helper without options.

"auth_preferred_cipher" is still on "aes" in my cluster, maybe switching it to "aes256k" will refresh the key on next ticket ?
Do not change `auth_preferred_cipher` manually, it does not refresh existing session and it managed by the helper during the final step.
 
Thanks @Moayad, but this not helped still have 4 sessions left.

Here what I've done:
- Disable cephfs on the UI
- Run "umount /mnt/pve/cephfs" on each node
- Enable cephfs on the UI
- Run "pvesm status --storage cephfs" on each node
- Run "/usr/share/pve-manager/migrations/pve-cephx-rotate-service-keys"

Still have 1 session active per node.

Maybe it is not related to cephfs after all ?...
 
Yes maybe another Ceph client? In this case, I would check for remaining CephFS mounts and kernel RBD mappings on each node:
Bash:
findmnt
rbd device list
Please paste the output of the above commands as well as the `/usr/share/pve-manager/migrations/pve-cephx-rotate-service-keys` output.
 
Last edited:
I'm searching but don't find where the last connection come from...
No external client used, cephfs disabled and unmounted.
All VM/CT migrated or stopped.

Code:
root@h04:~# findmnt
TARGET                      SOURCE             FSTYPE  OPTIONS
/                           rpool/ROOT/pve-1   zfs     rw,relatime,xattr,noacl,casesensitive
├─/sys                      sysfs              sysfs   rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/security    securityfs         securit rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup          cgroup2            cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursivepro
│ ├─/sys/fs/pstore          none               pstore  rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/bpf             bpf                bpf     rw,nosuid,nodev,noexec,relatime,mode=700
│ ├─/sys/kernel/debug       debugfs            debugfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/tracing     tracefs            tracefs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/fuse/connections
│ │                         fusectl            fusectl rw,nosuid,nodev,noexec,relatime
│ └─/sys/kernel/config      configfs           configf rw,nosuid,nodev,noexec,relatime
├─/proc                     proc               proc    rw,relatime
│ └─/proc/sys/fs/binfmt_misc
│   │                       systemd-1          autofs  rw,relatime,fd=37,pgrp=1,timeout=0,minproto=5,maxproto=5,direc
│   └─/proc/sys/fs/binfmt_misc
│                           binfmt_misc        binfmt_ rw,nosuid,nodev,noexec,relatime
├─/dev                      udev               devtmpf rw,nosuid,relatime,size=123172944k,nr_inodes=30793236,mode=755
│ ├─/dev/pts                devpts             devpts  rw,nosuid,noexec,relatime,gid=5,mode=600,ptmxmode=000
│ ├─/dev/shm                tmpfs              tmpfs   rw,nosuid,nodev,inode64
│ ├─/dev/mqueue             mqueue             mqueue  rw,nosuid,nodev,noexec,relatime
│ └─/dev/hugepages          hugetlbfs          hugetlb rw,nosuid,nodev,relatime,pagesize=2M
├─/run                      tmpfs              tmpfs   rw,nosuid,nodev,noexec,relatime,size=26400948k,mode=755,inode6
│ ├─/run/lock               tmpfs              tmpfs   rw,nosuid,nodev,noexec,relatime,size=5120k,inode64
│ ├─/run/credentials/systemd-journald.service
│ │                         tmpfs              tmpfs   ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inod
│ ├─/run/rpc_pipefs         sunrpc             rpc_pip rw,relatime
│ ├─/run/credentials/getty@tty1.service
│ │                         tmpfs              tmpfs   ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inod
│ └─/run/user/0             tmpfs              tmpfs   rw,nosuid,nodev,relatime,size=26400944k,nr_inodes=6600236,mode
├─/tmp                      tmpfs              tmpfs   rw,nosuid,nodev,size=132004740k,nr_inodes=1048576,inode64
├─/rpool                    rpool              zfs     rw,relatime,xattr,noacl,casesensitive
│ ├─/rpool/ROOT             rpool/ROOT         zfs     rw,relatime,xattr,noacl,casesensitive
│ └─/rpool/data             rpool/data         zfs     rw,relatime,xattr,noacl,casesensitive
│   └─/rpool/data/subvol-203-disk-0
│                           rpool/data/subvol-203-disk-0
│                                              zfs     rw,relatime,xattr,posixacl,casesensitive
├─/data-zfs                 data-zfs           zfs     rw,relatime,xattr,noacl,casesensitive
│ ├─/data-zfs/subvol-203-disk-0
│ │                         data-zfs/subvol-203-disk-0
│ │                                            zfs     rw,relatime,xattr,posixacl,casesensitive
│ └─/data-zfs/subvol-291-disk-0
│                           data-zfs/subvol-291-disk-0
│                                              zfs     rw,relatime,xattr,posixacl,casesensitive
├─/data-zfs2                data-zfs2          zfs     rw,relatime,xattr,noacl,casesensitive
│ └─/data-zfs2/subvol-203-disk-0
│                           data-zfs2/subvol-203-disk-0
│                                              zfs     rw,relatime,xattr,posixacl,casesensitive
├─/etc/pve                  /dev/fuse          fuse    rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissi
├─/var/lib/lxcfs            lxcfs              fuse.lx rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other
└─/mnt/pve/cephfs           10.0.30.11,10.0.30.12,10.0.30.13,10.0.30.14:/
                                               ceph    rw,relatime,name=admin,secret=<hidden>,fsid=ff0f0b07-aacc-429d

Those 3 CTs have all been restarted.
Code:
root@h04:~# rbd device list
id  pool  namespace  image          snap  device   
0   ceph             vm-292-disk-0  -     /dev/rbd0
1   ceph             vm-291-disk-0  -     /dev/rbd1
2   ceph             vm-273-disk-0  -     /dev/rbd2

Code:
root@h04:~# /usr/share/pve-manager/migrations/pve-cephx-rotate-service-keys
INFO: This is a dry run. No Ceph key, cipher setting, or daemon will be changed. Session observations can update the migration journal.
PASS: Every service key uses 'aes256k', and so do the service tickets.

Client keys awaiting action:
  'client.admin': 4 session(s) still authenticate with a previous key (h01: 1, h02: 1, h03: 1, h04:
    1). Both keys remain valid. Refresh these clients, then rerun without options.
Possible clients (host-wide hints, not session attribution):
Kernel hints mean sockets without an owning process.
  h01: VM 102, VM 211, VM 218, VM 224, VM 243, VM 252, VM 283, VM 288, 11 more VMs; 3 unattributed sockets (possible kernel clients)
  h02: VM 200, VM 201, VM 231, VM 236, VM 242, VM 244, VM 246, VM 248, 19 more VMs; 3 unattributed sockets (possible kernel clients)
  h03: VM 204, VM 208, VM 209, VM 212, VM 214, VM 215, VM 220, VM 222, 13 more VMs; 2 unattributed sockets (possible kernel clients)
  h04: VM 282; 3 unattributed sockets (possible kernel clients)
Refresh clients of the affected Ceph users:
  Live-migrate affected VMs to another up-to-date node with the new keyring, including VMs with
    kernel RBD disks. A guest reboot does not reload the key. Fully stop and start only VMs that
    cannot be migrated.
  Remount affected kernel CephFS mounts. A container on RBD keeps the key its disks were mapped
    with until it is fully stopped and started. Restart other clients after updating any external
    key copies.
The Ceph CLI and Proxmox VE storages without a dedicated user normally use 'client.admin'. VMs and mounts on those storages can retain its previous key.
 
Ok @Moayad, just found what is the problem !
I was assuming only Runing CT are VM needs migration or stop/start.
In fact the CT id 273 is a stopped CT, and is holding the last connection on this node, I have CT that are stopped on all nodes that are retaining the old connection....

After Start and Stop them or migrate them I'm finally able to finish the last step.

Maybe add in the doc that stopped CT need migration or start/stop too.
Tanks for your help.

Code:
root@h04:~# /usr/share/pve-manager/migrations/pve-cephx-rotate-service-keys
INFO: This is a dry run. No Ceph key, cipher setting, or daemon will be changed. Session observations can update the migration journal.
PASS: Every service key uses 'aes256k', and so do the service tickets.

Ready for confirmation: client.admin
Confirm only after refreshing every client, including disconnected ones and external key copies:
  /usr/share/pve-manager/migrations/pve-cephx-rotate-service-keys --apply --confirm-all-clients-refreshed --restrict-ciphers
 
Last edited:
Hi,

Glad to hear the issue is resolved. And thank you for sharing your solution.

I've marked your thread as [SOLVED] to help other people who have the same issue.