]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: change agent file permissions to 600
authorAdam King <adking@redhat.com>
Thu, 6 Jan 2022 12:24:52 +0000 (07:24 -0500)
committerAdam King <adking@redhat.com>
Fri, 28 Jan 2022 16:23:51 +0000 (11:23 -0500)
Fixes: https://tracker.ceph.com/issues/53541
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 0f839996df8c7065a982a92df13f9ec16298b541)

src/cephadm/cephadm

index 5fd99fd4d706cd239ca98b276c98f11eb76d0721..175348ca2a40b2834b1128e4b9d35d7acd766498 100755 (executable)
@@ -3781,14 +3781,14 @@ class CephadmAgent():
         # Create the required config files in the daemons dir, with restricted permissions
         for filename in config:
             if filename in self.required_files:
-                with open(os.path.join(self.daemon_dir, filename), 'w') as f:
+                with open(os.open(os.path.join(self.daemon_dir, filename), os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
                     f.write(config[filename])
 
-        with open(os.path.join(self.daemon_dir, 'unit.run'), 'w') as f:
+        with open(os.open(os.path.join(self.daemon_dir, 'unit.run'), os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
             f.write(self.unit_run())
 
         unit_file_path = os.path.join(self.ctx.unit_dir, self.unit_name())
-        with open(unit_file_path + '.new', 'w') as f:
+        with open(os.open(unit_file_path + '.new', os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
             f.write(self.unit_file())
             os.rename(unit_file_path + '.new', unit_file_path)