-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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/acme: Fix ordering of certificate requests (#81482) #85223
Conversation
self-review: The regression test isn't actually added to all-tests file so it isn't being run by CI. should add it |
It will likely be necessary to add the selfsigned certs services to the before rules for nginx and apache too. I know at least for apache that if no certificate files exist for a domain specified in the config it will fail to start up. Usually I get around this on new machines by starting the selfsigned services by hand but that doesn't scale well. |
That before rule already exists as far as I see... At least for nginx |
Oh..really? I did a systemctl list-dependencies on my own host and I couldn't see it. What depends on it? |
HEre On my server it also shows up as a dependency for nginx, and nginx is ordered
|
@GrahamcOfBorg test acme |
Ah ok. The same does not exist for httpd it seems. |
@m1cr0man that also doesn't seem to be true. It seems to be there. Though ACME support for apache httpd wasn't there yet in 19.09 so perhaps you're referring to the old situation before this was merged?
|
Ah, looking at this now I believe it's not showing up on my system because I'm not using |
@GrahamcOfBorg test acme The test seems flakey :/ https://logs.nix.ci/?key=nixos/nixpkgs.85223&attempt_id=207f0be0-8ba1-41a8-93e4-96fee6d90a24 This seems to be because the certificate issuer server's clock is out of sync with the webserver. UGH.
|
0eb23db
to
600cfe6
Compare
hmm test failed again, but I can't reproduce it locally. It actually fails for two reasons.
fails because of time-travelling. however it is much more flakey on CI then it seems locally. I can't reproduce
seems to be a legitimate issue; but I cant reproduce locally either |
The tests now passed. but we should probably open an issue about the flakey tests |
With #85503 merged, can this be rebased on top of master? |
ping |
I'll rebase this onto master this weekend. |
Sorry to bother again. Do you think you will have the time to work on it in a near future? |
Reads a bit more naturally, and now the changes to the acme-${cert}.service actually reflect what would be needed were you to do the same in production. e.g. "for dns-01, your service that needs the cert needs to pull in the cert"
This fixes NixOS#81842 We should probably also fix this for Apache, which recently also learned to use ACME.
600cfe6
to
0952336
Compare
Rebased. @NixOS/acme could you have another look? |
@GrahamcOfBorg test acme |
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.
Looks good! Thanks for implementing it for both web servers ;)
Thanks! |
Motivation for this change
Fixes #81842
Given ACME is considered blocker for 20.03 I think we should backport this change if possible.
Things done
Fixes #81842 by ordering certificate requests after the web service has started up
Adds a regression test too
There are no tests for the apache module. I didn't even know it existed before this PR. @aanderse I also ported the fix to that, but I have not written any tests for it. I'd love to see this module tested. Keeping both in sync is a bit painful if one of the two is only tested and the other isn't. We already have quite a few problems we need to solve with the
acme
module. It being used by two webservers for me is a bit of a maintenance burden personally, but I'm fine if someone else keeps it up to feature paritysandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)