pve-manager/PVE
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
..
API2 fix #4759: ceph: configure ceph-crash.service and its key 2024-04-11 10:42:11 +02:00
Ceph fix #4759: ceph: configure ceph-crash.service and its key 2024-04-11 10:42:11 +02:00
CLI pvesubscription: add missing return statement 2024-02-02 19:16:49 +01:00
Jobs makefile: convert to use simple parenthesis 2023-05-29 18:24:00 +02:00
Service expose font-logos via API server and load in UI 2023-10-23 17:26:08 +02:00
Status makefile: convert to use simple parenthesis 2023-05-29 18:24:00 +02:00
.gitignore add .gitignore files, fix Makefiles 2011-08-23 16:23:46 +02:00
API2.pm expand repoid to 16 chars and avoid querying git for it twice 2023-05-29 18:24:00 +02:00
API2Tools.pm api tools: fix usage of stat by-name interface 2023-10-10 15:38:27 +02:00
APLInfo.pm appliance index: use upper case for constant like variables 2024-02-28 14:28:09 +01:00
AutoBalloon.pm avoid perl warning 2013-01-22 11:44:41 +01:00
CertCache.pm takeover CertCache from pve-cluster 2019-11-18 12:25:35 +01:00
CertHelpers.pm renew pve-ssl.pem when it nearly expires 2019-11-26 13:13:04 +01:00
ExtMetric.pm status/plugin: extend send/_connect/_disconnect/test_connection 2021-01-28 17:32:23 +01:00
HTTPServer.pm ui: implement OpenId login 2021-07-02 14:09:30 +02:00
Jobs.pm Jobs: add RealmSync Plugin and register it 2023-06-07 11:38:34 +02:00
Makefile expand repoid to 16 chars and avoid querying git for it twice 2023-05-29 18:24:00 +02:00
NodeConfig.pm node: wake-on-lan: document defaults and small style clean-up 2024-03-28 17:52:25 +01:00
pvecfg.pm.in pvecfg: adapt version and release semantic 2019-05-26 16:11:43 +02:00
Report.pm report: format iptables output for readability 2024-01-10 10:42:49 +01:00
VZDump.pm vzdump: make helper functions for sending notifications private 2024-01-29 10:32:31 +01:00