From ca9b5d0bd6082112bcd2297a58113c9bb32dc954 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 6 Jun 2023 13:26:35 -0400 Subject: [PATCH] cephadm: use DEFAULT_MODE constant at additional locations Now that we have a DEFAULT_MODE constant we can replace other locations where 0o600 is used with the constant. Signed-off-by: John Mulligan --- src/cephadm/cephadm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 26ce0c13d53b6..b198e175d06e9 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -6063,7 +6063,7 @@ def registry_login(ctx: CephadmContext, url: Optional[str], username: Optional[s cmd.append('--authfile=/etc/ceph/podman-auth.json') out, _, _ = call_throws(ctx, cmd) if isinstance(engine, Podman): - os.chmod('/etc/ceph/podman-auth.json', 0o600) + os.chmod('/etc/ceph/podman-auth.json', DEFAULT_MODE) except Exception: raise Error('Failed to login to custom registry @ %s as %s with given password' % (ctx.registry_url, ctx.registry_username)) @@ -7657,7 +7657,7 @@ def authorize_ssh_key(ssh_pub_key: str, ssh_user: str) -> bool: with open(auth_keys_file, 'a') as f: os.fchown(f.fileno(), ssh_uid, ssh_gid) # just in case we created it - os.fchmod(f.fileno(), 0o600) # just in case we created it + os.fchmod(f.fileno(), DEFAULT_MODE) # just in case we created it if add_newline: f.write('\n') f.write(ssh_pub_key + '\n') @@ -7676,7 +7676,7 @@ def revoke_ssh_key(key: str, ssh_user: str) -> None: _, filename = tempfile.mkstemp() with open(filename, 'w') as f: os.fchown(f.fileno(), ssh_uid, ssh_gid) - os.fchmod(f.fileno(), 0o600) # secure access to the keys file + os.fchmod(f.fileno(), DEFAULT_MODE) # secure access to the keys file for line in lines: if line.strip() == key.strip(): deleted = True -- 2.39.5