From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 4F6581FF16F for ; Tue, 16 Sep 2025 19:20:25 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8932119AB0; Tue, 16 Sep 2025 19:20:36 +0200 (CEST) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Date: Tue, 16 Sep 2025 19:20:03 +0200 Message-ID: <20250916172012.739807-3-m.carrara@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20250916172012.739807-1-m.carrara@proxmox.com> References: <20250916172012.739807-1-m.carrara@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1758043225216 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.088 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH pve-manager master v1 2/6] fix #6816: api: ceph: create 'client.exporter' w/ keyring X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" ... when creating the first MON. Similar to `ceph-crash.service` [0], create or update the keyring for the `ceph-exporter` daemon using a new Ceph auth entity called `client.exporter` when creating the first MON. Its keyring is placed at `/etc/pve/ceph/ceph.client.exporter.keyring`. The `ceph-exporter` daemon only needs read access to MONs. Found this out during testing; this isn't explicitly documented anywhere AFAIK. In case the daemon requires more capabilities in the future, I recommend updating them via a separate helper that wraps the `ceph auth caps` command via `PVE::RADOS`. However, because all this daemon does is expose a metrics endpoint `http://$HOST:9926/metrics`, I doubt that it needs any additional capabilities any time soon. [0]: https://lore.proxmox.com/pve-devel/20240402145523.683008-11-m.carrara@proxmox.com/ Fixes: #6816 Signed-off-by: Max R. Carrara --- PVE/API2/Ceph/MON.pm | 9 +++++++++ PVE/Ceph/Tools.pm | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/PVE/API2/Ceph/MON.pm b/PVE/API2/Ceph/MON.pm index 70fc158d..422f107a 100644 --- a/PVE/API2/Ceph/MON.pm +++ b/PVE/API2/Ceph/MON.pm @@ -480,6 +480,15 @@ __PACKAGE__->register_method({ cfs_write_file('ceph.conf', $cfg); }; warn "Unable to configure keyring for ceph-crash.service: $@" if $@; + + print "Configuring keyring for ceph-exporter.service\n"; + eval { + PVE::Ceph::Tools::create_or_update_exporter_keyring_file(); + $cfg->{'client.exporter'}->{keyring} = + '/etc/pve/ceph/$cluster.$name.keyring'; + cfs_write_file('ceph.conf', $cfg); + }; + warn "Unable to configure keyring for ceph-exporter.service: $@" if $@; } eval { PVE::Ceph::Services::ceph_service_cmd('enable', $monsection) }; diff --git a/PVE/Ceph/Tools.pm b/PVE/Ceph/Tools.pm index dce9156a..8ddce759 100644 --- a/PVE/Ceph/Tools.pm +++ b/PVE/Ceph/Tools.pm @@ -22,6 +22,7 @@ my $ceph_cfgpath = "$ceph_cfgdir/$ccname.conf"; my $pve_ceph_cfgdir = "/etc/pve/ceph"; my $pve_ceph_crash_key_path = "$pve_ceph_cfgdir/$ccname.client.crash.keyring"; +my $pve_ceph_exporter_key_path = "$pve_ceph_cfgdir/$ccname.client.exporter.keyring"; my $pve_mon_key_path = "/etc/pve/priv/$ccname.mon.keyring"; my $pve_ckeyring_path = "/etc/pve/priv/$ccname.client.admin.keyring"; my $ckeyring_path = "/etc/ceph/ceph.client.admin.keyring"; @@ -48,6 +49,7 @@ my $config_values = { my $config_files = { pve_ceph_cfgpath => $pve_ceph_cfgpath, pve_ceph_crash_key_path => $pve_ceph_crash_key_path, + pve_ceph_exporter_key_path => $pve_ceph_exporter_key_path, pve_mon_key_path => $pve_mon_key_path, pve_ckeyring_path => $pve_ckeyring_path, ceph_bootstrap_osd_keyring => $ceph_bootstrap_osd_keyring, @@ -568,6 +570,19 @@ sub create_or_update_crash_keyring_file { return 0; } +sub create_or_update_exporter_keyring_file { + my ($rados) = @_; + + my $entity = 'client.exporter'; + my $caps = [ + mon => 'allow r', + ]; + + return create_or_update_keyring_file( + $pve_ceph_exporter_key_path, $entity, $caps, $rados, + ); +} + # get ceph-volume managed osds sub ceph_volume_list { my $result = {}; -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel