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

Audit file permissions for directories and files created by client and renewer #420

Closed
schoen opened this issue May 16, 2015 · 11 comments
Closed

Comments

@schoen
Copy link
Contributor

schoen commented May 16, 2015

I don't specifically know that they're wrong, but we need to check them to make sure they're all reasonable.

@schoen schoen self-assigned this May 16, 2015
@schoen schoen added this to the 1.0 for launch milestone May 16, 2015
@schoen schoen mentioned this issue May 16, 2015
@schoen
Copy link
Contributor Author

schoen commented May 20, 2015

@jsha noticed that the client currently wants some directories to have mode 755 and this is mandatory. I'm not sure that's the right policy.

@pde
Copy link
Member

pde commented Nov 6, 2015

Results of a partial audit, observing the results of running LE rather than reading all relevant code:

Everything under /etc/letsencrypt/ is 700, except for renewal/, csr/, and options-ssl-apache.conf. I actually don't understand how webservers that run as something other than root can get things from live/ and keys/ right now.

Everything under /var/log/letsencrypt is locked down.

There are world-readable backups of some things in /var/lib/letsencrypt/backups, but they appear to be config files and not keys. Since apache does not contain inline private keys or basic auth credentials, those should not be leaked by those permissions. However /var/lib/letsencrypt/backups should be less widely readable if possible.

@pde
Copy link
Member

pde commented Nov 6, 2015

Opened #1396

@pde pde modified the milestones: 2.0, 1.0 for launch Nov 6, 2015
@pde
Copy link
Member

pde commented Nov 6, 2015

I think that's sufficient confidence to kick further work on this down the road for now.

@acrolink
Copy link

So, how to make it possible for a Rails server run as a normal user to access the keys on /live directory?

@jsha
Copy link
Contributor

jsha commented Jun 20, 2016

@acrolink: Could you post your question at https://community.letsencrypt.org/? This issue is about a different question. Thanks!

@sydneyli
Copy link
Contributor

I did an audit of the files in all the 700 directories in config-dir (usually /etc/letsencrypt/), where their permissions are set/enforced/created (it's not comprehensive-- permissions could also be set elsewhere, but this is intended as a starting point). Links are to lines in commit 92645619.

"enforced" means the permissions are verified with util.make_or_verify_dir. "default" means that the permissions are not explicitly set upon file/directory creation; in parentheses is what these files end up being when created.

As I mentioned in #1473, the biggest problem is that the permissions on archive/live are not verified or ensured to be 700, so making that directory more permissive in future versions of Certbot means that downgrading Certbot and renewing would expose private key material, since the new private keys would be created under 644.

@maurorappa
Copy link

This is my server directory, totally managed by cerbot, I never changed any permission:

 # ls -l /etc/letsencrypt/archive/dns.0latency.com/
total 48
-rw-r--r-- 1 root root 2159 Aug 17 21:46 cert1.pem
-rw-r--r-- 1 root root 2155 Oct 28 21:48 cert2.pem
-rw-r--r-- 1 root root 1911 Jan 11 15:46 cert3.pem
-rw-r--r-- 1 root root 1647 Aug 17 21:46 chain1.pem
-rw-r--r-- 1 root root 1647 Oct 28 21:48 chain2.pem
-rw-r--r-- 1 root root 1647 Jan 11 15:46 chain3.pem
-rw-r--r-- 1 root root 3806 Aug 17 21:46 fullchain1.pem
-rw-r--r-- 1 root root 3802 Oct 28 21:48 fullchain2.pem
-rw-r--r-- 1 root root 3558 Jan 11 15:46 fullchain3.pem
-rw-r--r-- 1 root root 1704 Aug 17 21:46 privkey1.pem
-rw-r--r-- 1 root root 1704 Oct 28 21:48 privkey2.pem
-rw-r--r-- 1 root root 1704 Jan 11 15:46 privkey3.pem

I think it's way too permissing, expecially for the Private key.
I am running certbot version: 0.10.2, on Debian with default umask of 0022.

@sydneyli
Copy link
Contributor

Hi @maurorappa! We fixed this in #6480, which should be in the most recent release of Certbot v0.29.1. Regardless, your private key should still be safe as long as the permissions on the containing directories have remained the same (non group or world readable) as when Certbot created them.

@stale
Copy link

stale bot commented Jan 11, 2020

We've made a lot of changes to Certbot since this issue was opened. If you still have this issue with an up-to-date version of Certbot, can you please add a comment letting us know? This helps us to better see what issues are still affecting our users. If there is no activity in the next 30 days, this issue will be automatically closed.

@stale stale bot added the needs-update label Jan 11, 2020
@m0namon
Copy link
Contributor

m0namon commented Jan 13, 2020

It seems that we finished the audit, so closing.

If we want to do a file directory structure rehaul in the future, that should go in a new issue.

@m0namon m0namon closed this as completed Jan 13, 2020
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

8 participants