]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-daemon: fchmod before writing to keyring file
authorSage Weil <sage@redhat.com>
Fri, 4 Oct 2019 20:58:19 +0000 (15:58 -0500)
committerSage Weil <sage@redhat.com>
Sat, 5 Oct 2019 19:28:50 +0000 (14:28 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/ceph-daemon

index 8a652ec3072da8b87745fbe74446910dd4f350e7..79fb8a1b0344ce8ed729dfe0730b6559e71d7dd2 100755 (executable)
@@ -618,9 +618,9 @@ def command_bootstrap():
     # output files
     if args.output_keyring:
         with open(args.output_keyring, 'w') as f:
+            os.fchmod(f.fileno(), 0o600)
             f.write('[client.admin]\n'
                     '\tkey = ' + admin_key + '\n')
-            os.fchmod(f.fileno(), 0o600)
         logging.info('Wrote keyring to %s' % args.output_keyring)
     if args.output_config:
         with open(args.output_config, 'w') as f: