-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
nixos/modules/security/acme: Issuing multiple certificates fails due to wrong file permissions #89502
Comments
We're going to be fixing this very soon. The plan is to remove the user/group options for certificates, and create an This is open to criticism/discussion at the moment. Feel free to chime in, @NixOS/acme |
How would that affect the private keys? If I'm not mistaken those are also generated by the acme module and with this approach every service in the group could read each services keys. While this is not a problem in my case (this is a small personal server without high security requirements), I suspect others might want to keep that separated. |
That's a great point! This is definitely something that we should address. I guess an easy way to solve this is to only force an acme user, and allow any group to be used. It will require some testing but I believe Systemd user/group arguments are not dependent on each other such that the user doesn't need to be a member of the configured group. This way no matter which cert service creates the account folder both will have access to it, and the certs can only be read by their respective group members, solving the problem you just explained. |
From discussions on IRC with @emilazy, we feel there's actually more cases where people would want the private key to be read by multiple services than not. Consider the case where you have 1 domain and multiple services (web server, email, etc), you would want all those services to have access to the key. We can still solve for your case too by simply keeping the group option and defaulting it to the acme group. We would just recommend adding other service accounts to the acme group for most cases rather than using a service account's group. |
@m1cr0man just as a thought, but instead of adding random users to the |
@flokli I don't think it's worth going that far with the base module. Given how things are set up at the moment, I don't think many people would go much farther than adding user to |
Alright, fine for me too - let's get this issue fixed first :-) |
Sounds like a reasonable solution. |
Describe the bug
I have acme configured to issue multiple certificates via DNS validation for two different users:
(the configuration is lightly edited for privacy). Both domains are using the same API key. The user "service2" is a system user.
When switching to this configuration one oft the acme-....service units fails to run with the error:
Indeed the folder
/var/lib/acme/.lego/accounts/
is owned by the user for the other unit (nginx
in this example). It seems non-deterministic which unit fails.To Reproduce
Steps to reproduce the behavior:
configuration.nix
/var/lib/secrets/gandi-api-key
nixos-rebuild switch
Expected behavior
Two services
acme-example.com.service
andacme-example.org.service
are started and two certificates are issued. The certificates should be readable by the corresponding system user.Notify maintainers
@aanderse @andrew-d @arianvp @flokli @m1cr0man
Metadata
Maintainer information:
The text was updated successfully, but these errors were encountered: