From: Kefu Chai <k.chai@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager] ceph: create service and bootstrap keyrings with mode 0600
Date: Mon, 12 Oct 2026 18:46:42 +0800 [thread overview]
Message-ID: <20261012104642.1046894-1-k.chai@proxmox.com> (raw)
The keyrings for a new MDS, manager and client.bootstrap-osd are
written without a mode and end up 0644. Whoever reads one gets that
entity's caps: the MDS and manager keys can read and write every pool,
the bootstrap key can register OSDs. Only the 0750 /var/lib/ceph keeps
other users out.
ceph-mon --mkfs was changed to 0600 for the same reason (Ceph tracker
#14950), and ceph-authtool, cephadm and the cephx migration helper all
write keyrings as 0600.
The daemons own their keyrings after the chown, and ceph-volume reads
the bootstrap keyring as root, so nothing loses access. Existing
keyrings are not changed.
Link: https://tracker.ceph.com/issues/14950
Signed-off-by: Kefu Chai <k.chai@proxmox.com>
---
PVE/API2/Ceph/OSD.pm | 2 +-
PVE/Ceph/Services.pm | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
index c5c20140..7ff006d2 100644
--- a/PVE/API2/Ceph/OSD.pm
+++ b/PVE/API2/Ceph/OSD.pm
@@ -421,7 +421,7 @@ __PACKAGE__->register_method({
],
format => 'plain',
});
- file_set_contents($ceph_bootstrap_osd_keyring, $bindata);
+ file_set_contents($ceph_bootstrap_osd_keyring, $bindata, 0600);
}
# $size is in kibibytes
diff --git a/PVE/Ceph/Services.pm b/PVE/Ceph/Services.pm
index 6c6bd7e2..10d27623 100644
--- a/PVE/Ceph/Services.pm
+++ b/PVE/Ceph/Services.pm
@@ -325,7 +325,7 @@ sub create_mds {
format => 'plain',
});
- PVE::Tools::file_set_contents($service_keyring, $output);
+ PVE::Tools::file_set_contents($service_keyring, $output, 0600);
print "setting ceph as owner for service directory\n";
run_command(["chown", 'ceph:ceph', '-R', $service_dir]);
@@ -401,7 +401,7 @@ sub create_mgr {
],
format => 'plain',
});
- PVE::Tools::file_set_contents($mgrkeyring, $output);
+ PVE::Tools::file_set_contents($mgrkeyring, $output, 0600);
print "setting owner for directory\n";
run_command(["chown", 'ceph:ceph', '-R', $mgrdir]);
--
2.47.3
next reply other threads:[~2026-10-12 10:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 10:46 Kefu Chai [this message]
2026-10-12 12:17 ` [PATCH manager] ceph: create service and bootstrap keyrings with mode 0600 Maximiliano Sandoval
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261012104642.1046894-1-k.chai@proxmox.com \
--to=k.chai@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox