Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create private key files with umask 177 #222

Closed
lukpueh opened this issue Mar 24, 2020 · 4 comments
Closed

Create private key files with umask 177 #222

lukpueh opened this issue Mar 24, 2020 · 4 comments

Comments

@lukpueh
Copy link
Member

lukpueh commented Mar 24, 2020

Description of issue or feature request:
Transfer of theupdateframework/python-tuf#279.

According to common practice (see e.g. ssh utilities) private key files should be created with read and write permissions for the user only (umask 177). Securesystemslib's interface.generate_and_write_{rsa, ed25519, ecdsa}_keypair functions should adopt that behavior.

Current behavior:
Private key files are created with the OS' default umask.

Expected behavior:
Private keys files are created with umask 177.

@lukpueh
Copy link
Member Author

lukpueh commented Mar 24, 2020

I suggest to update securesystemslib.util.persist_temp_file to take an optional octal permissions argument and pass 177 in interface.generate_and_write_{rsa, ed25519, ecdsa}_keypair functions.

@sechkova
Copy link
Contributor

Looking at the issue, I noticed that the intention is

private key files should be created with read and write permissions for the user only

which means file permissions 600 and umask 177 (umask unsets the bits).
Can you confirm that my understanding is correct here?

@lukpueh
Copy link
Member Author

lukpueh commented Apr 13, 2020

You are absolutely right, @sechkova! Thanks for pointing this out. :)

@lukpueh lukpueh changed the title Create private key files with umask 600 Create private key files with umask 177 Apr 13, 2020
@joshuagl
Copy link
Collaborator

Fixed in #231

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants