Skip to content

Commit ff8568d

Browse files
committed
make tokenfile readable to user only
Signed-off-by: Matthias Büchse <[email protected]>
1 parent 560fba3 commit ff8568d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Tests/add_subject.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def main(argv, cwd):
5050
token = base64.b64encode(f"{subject}:{password}".encode('utf-8'))
5151
hash_ = CRYPTCTX.hash(password)
5252
with open(tokenfile_path, "wb") as fileobj:
53+
os.fchmod(fileobj.fileno(), 0o600)
5354
fileobj.write(token)
5455
print("Creating key file using `ssh-keygen`...")
5556
subprocess.check_call([SSH_KEYGEN, '-t', 'ed25519', '-C', sanitized_subject, '-f', keyfile_path, '-N', '', '-q'])

0 commit comments

Comments
 (0)