Am 26.11.21 um 16:02 schrieb Aaron Lauterer:
Ensure that the user provided $secret ends in a newline. Otherwise we
will have Input/output errors from rados_connect.
Reviewed-by: Fabian Ebner <[email protected]>
Tested-by: Fabian Ebner <[email protected]>
Signed-off-by: Aaron Lauterer <[email protected]>
---
PVE/CephConfig.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/PVE/CephConfig.pm b/PVE/CephConfig.pm
index 5c94a04..ac28e76 100644
--- a/PVE/CephConfig.pm
+++ b/PVE/CephConfig.pm
@@ -227,6 +227,7 @@ sub ceph_create_keyfile {
eval {
if (defined($secret)) {
mkdir '/etc/pve/priv/ceph';
+ $secret = "${secret}\n" if $secret !~ m/\n$/;
PVE::Tools::file_set_contents($ceph_storage_keyring, $secret,
0400);
} elsif ($type eq 'rbd') {
mkdir '/etc/pve/priv/ceph';
Just one thing I'm wondering: AFAIU there is no problem for CephFS
currently, but for consistency/future-proving, we might put a newline
there as well when the $secret is not user-provided. I.e. below,
$cephfs_secret isn't newline-terminated:
} elsif ($type eq 'cephfs') {
my $cephfs_secret =
$ceph_get_key->($ceph_admin_keyring, 'admin');
mkdir '/etc/pve/priv/ceph';
PVE::Tools::file_set_contents($ceph_storage_keyring,
$cephfs_secret, 0400);
}
_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel