-
Notifications
You must be signed in to change notification settings - Fork 1
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
Explicitly set ownership to nginx for certs created by ssl Certificate() #117
Conversation
@zagy Could you please check, if this is the correct fix? I want to be sure, that I understood the problem correctly ;) |
It sure looks like it does the right thing. |
src/batou_ext/ssl.py
Outdated
@@ -248,6 +248,7 @@ def update(self): | |||
-out {{component.fullchain}} | |||
""" | |||
) | |||
self.cmd("setfacl -Rm u:nginx:rX {{componet.key.dir}}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double check https://github.com/flyingcircusio/batou_ext/blob/master/src/batou_ext/acl.py#LL7C22-L7C22 whether useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it only works for files, not folders.
There is a problem, if the cert directory is in a sub directory of directory with missing permissions for nginx. |
4fcbbb2
to
cc9aed3
Compare
Works not for Debian e.a (User www-data for Nginx). Worth making the user configurable? |
cc9aed3
to
c49bdd1
Compare
src/batou_ext/ssl.py
Outdated
@@ -102,6 +102,8 @@ class Certificate(batou.component.Component): | |||
# You will need something like nrpehost or sensuchecks on the host | |||
enable_check = batou.component.Attribute("literal", default=True) | |||
|
|||
cert_owner = batou.component.Attribute(str, default="nginx") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like to rename the variable. I'm aware of that it makes sense, but we are allowing access to the cert to the user Nginx (or other applications) are running in. Hence I think something like granted_user or whatever (not having a good idea though ;)) would be a better name.
c49bdd1
to
cf6d736
Compare
When the service user places the cert, the cert is owned by it. If Nginx runs as root, this doesn't create any problems. But if Nginx runs as a separate user, it may be denied access to the cert.
This change sets the ownership of the created certs to
nginx
, to fix this problem.