pve-manager/PVE/API2/Ceph
Max Carrara 11edd5d88d fix #4759: ceph: configure ceph-crash.service and its key
Due to Ceph dropping privileges when running the 'ceph-crash' daemon
[0], it is necessary to allow the daemon to authenticate with its
cluster in a safe manner.

In order to avoid exposing sensitive keyrings or somehow escalating
its privileges again, 'ceph-crash' is therefore provided with its own
keyring in the '/etc/pve/ceph' directory. This directory, due to being
on 'pmxcfs', may be read by members of the 'www-data' group, which
'ceph-crash' is made part of [1].

Expected Configuration
----------------------

 1. A keyring file named '/etc/pve/ceph/ceph.client.crash.keyring'
    exists
 2. A section named 'client.crash' exists in '/etc/pve/ceph.conf'
 3. The 'client.crash' section has a key named 'keyring' which
    references the keyring file as '/etc/pve/ceph/$cluster.$name.keyring'
 4. The 'client.crash' section has *no* key named 'key'

New Clusters
------------

The keyring file is created and the conf file is updated after the first
monitor has been created (when calling `pveceph mon create`).

Existing Clusters
-----------------

A new helper script creates and configures the 'client.crash' keyring in
`postinst`, if:
 * Ceph is installed
 * Ceph is initialized ('/etc/pve/ceph.conf' and '/etc/pve/ceph' exist)
 * Connection to RADOS is successful

If the above conditions are met, the helper script ensures that the
existing configuration matches the expected configuration mentioned
above.

The configuration is not changed if it is already as expected.

The helper script may be called again manually if the `postinst` hook
fails. It is installed to '/usr/share/pve-manager/helpers/pve-init-ceph-crash'.

Existing `client.crash` Key
---------------------------

If a key named 'client.crash' already exists within the cluster, it is
reused and not regenerated.

[0]: https://github.com/ceph/ceph/pull/48713
[1]: https://git.proxmox.com/?p=ceph.git;a=commitdiff;h=f72c698a55905d93e9a0b7b95674616547deba8a

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
2024-04-11 10:42:11 +02:00
..
Cfg.pm api: ceph: add endpoint to fetch config keys 2023-11-21 14:39:17 +01:00
FS.pm api: cephfs: add 'fs-name' for cephfs storage 2021-11-11 17:52:08 +01:00
Makefile api: ceph: remove deprecrated Pools path 2023-06-21 09:21:04 +02:00
MDS.pm fix #4808: ceph: mds create: use snake_case when setting options 2023-09-06 16:57:10 +02:00
MGR.pm ceph: make all service name regexes the same 2020-03-04 15:38:09 +01:00
MON.pm fix #4759: ceph: configure ceph-crash.service and its key 2024-04-11 10:42:11 +02:00
OSD.pm api: osd: destroy: remove mclock max iops settings 2023-11-17 08:09:15 +01:00
Pool.pm api: ceph: deprecate pools in favor of pool 2023-03-20 15:31:04 +01:00