nixpkgs/nixos/modules
Arian van Putten 604b7c139f Fix letsencrypt (#60219)
* nixos/acme: Fix ordering of cert requests

When subsequent certificates would be added, they would
not wake up nginx correctly due to target units only being triggered
once. We now added more fine-grained systemd dependencies to make sure
nginx always is aware of new certificates and doesn't restart too early
resulting in a crash.

Furthermore, the acme module has been refactored. Mostly to get
rid of the deprecated PermissionStartOnly systemd options which were
deprecated. Below is a summary of changes made.

* Use SERVICE_RESULT to determine status
This was added in systemd v232. we don't have to keep track
of the EXITCODE ourselves anymore.

* Add regression test for requesting mutliple domains

* Deprecate 'directory' option
We now use systemd's StateDirectory option to manage
create and permissions of the acme state directory.

* The webroot is created using a systemd.tmpfiles.rules rule
instead of the preStart script.

* Depend on certs directly

By getting rid of the target units, we make sure ordering
is correct in the case that you add new certs after already
having deployed some.

Reason it broke before:  acme-certificates.target would
be in active state, and if you then add a new cert, it
would still be active and hence nginx would restart
without even requesting a new cert. Not good!  We
make the dependencies more fine-grained now. this should fix that

* Remove activationDelay option

It complicated the code a lot, and is rather arbitrary. What if
your activation script takes more than activationDelay seconds?

Instead, one should use systemd dependencies to make sure some
action happens before setting the certificate live.

e.g. If you want to wait until your cert is published in DNS DANE /
TLSA, you could create a unit that blocks until it appears in DNS:

```
RequiredBy=acme-${cert}.service
After=acme-${cert}.service
ExecStart=publish-wait-for-dns-script
```
2019-08-29 16:32:59 +02:00
..
config nixos/update-users-groups.pl: chomp hashedPassword 2019-08-25 23:42:31 -04:00
hardware nixos/hardware.deviceTree: Move things around 2019-08-07 13:51:22 +01:00
i18n/input-method nixos/ibus: do not default-install ibus-qt 2019-08-10 19:37:12 +02:00
installer nixos/sd-image: Increase default firmware partition size 2019-08-18 22:55:39 +02:00
misc mailman: reserve uid & gid in NixOS 2019-08-26 16:17:39 +02:00
profiles Merge pull request #66687 from joachifm/feat/hardened-nixos-revert-graphene-malloc 2019-08-19 20:56:07 +02:00
programs zsh: remove unfunction on TERM=dumb 2019-08-27 11:00:58 -04:00
security Fix letsencrypt (#60219) 2019-08-29 16:32:59 +02:00
services Fix letsencrypt (#60219) 2019-08-29 16:32:59 +02:00
system Merge pull request #67487 from dasJ/suspend-then-hibernate 2019-08-28 17:29:17 +08:00
tasks Merge branch 'master' into flip-map-foreach 2019-08-18 18:00:25 +03:00
testing nixos/test: remove the stateVersion statement from the test-instrumentation 2019-06-03 15:05:24 +02:00
virtualisation nixos-containers: add TimeoutStartSec option 2019-08-28 14:54:51 +02:00
module-list.nix Merge pull request #64738 from rnhmjoj/magnetico 2019-08-28 18:39:21 +02:00
rename.nix Fix letsencrypt (#60219) 2019-08-29 16:32:59 +02:00