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

Consider more restrictive file permissions for the DirectoryStore #106

Open
JayH5 opened this issue Dec 14, 2016 · 2 comments
Open

Consider more restrictive file permissions for the DirectoryStore #106

JayH5 opened this issue Dec 14, 2016 · 2 comments

Comments

@JayH5
Copy link
Contributor

JayH5 commented Dec 14, 2016

It seems to be common practice to store certificates or the directories that contain them with restrictive file permissions (e.g. 0600).

The official certbot client seems to do this (or did when I last checked), although in most cases certbot is run as root, whereas that may not be the case for txacme.

@mithrandi
Copy link
Contributor

The certs directory for DirectoryStore is meant to already exist, so I think the permissions of it are the responsibility of the user since they're creating it.

Unfortunately setting the permissions of the individual files in the store is a tricky business; if we set the permissions after writing the file, there is a window of time where the file has whatever permissions it got via umask since we haven't changed them yet. If we change the umask, then we screw up the permissions of any file opened in a different thread at the same time. Ugh :(

@mithrandi
Copy link
Contributor

FWIW what I wrote here before is wrong; open(2) allows passing a file mode, so we can leverage this via io.open(os.open(path, O_TRUNC, mode), 'w') or some such, but it's a bit of a mess since we can't use FilePath to do this for us anymore. Also, this is POSIX-specific.

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

2 participants