nixpkgs/nixos/modules/services/web-servers
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
..
apache-httpd nixos/treewide: drop dependencies to keys.target 2019-08-27 18:55:55 +02:00
hitch nixos/modules: users.(extraUsers|extraGroup->users|group) 2018-06-30 03:02:58 +02:00
jboss
lighttpd Merge staging-next into staging 2019-07-03 08:59:42 +02:00
nginx Fix letsencrypt (#60219) 2019-08-29 16:32:59 +02:00
phpfpm nixos/phpfpm: deprecate extraConfig options in favor of settings options 2019-08-23 07:56:27 -04:00
unit nixos/unit: init service unit 2019-03-16 19:54:21 +03:00
varnish nixos/modules: users.(extraUsers|extraGroup->users|group) 2018-06-30 03:02:58 +02:00
caddy.nix caddy: remove 'bin' attribute 2019-08-18 18:46:21 -06:00
darkhttpd.nix nixos darkhttpd: module to enable darkhttpd 2019-08-26 19:57:49 +08:00
fcgiwrap.nix
hydron.nix nixos/hydron: replace deprecated usage of PermissionsStartOnly 2019-05-25 08:38:15 -04:00
meguca.nix nixos/meguca: Add videoPaths, set postgresql version to 11 2019-03-23 01:19:29 -05:00
mighttpd2.nix nixos/mighttpd2: /var/run -> /run 2019-03-24 21:15:33 +01:00
minio.nix nixos/minio: replace deprecated usage of PermissionsStartOnly 2019-04-13 07:00:56 -04:00
shellinabox.nix
tomcat.nix nixos/tomcat: add purifyOnStart option 2018-10-29 18:26:22 +07:00
traefik.nix nixos/traefik: replace deprecated usage of PermissionsStartOnly 2019-04-13 07:00:58 -04:00
uwsgi.nix [bot]: remove unreferenced code 2018-07-20 18:48:37 +00:00
zope2.nix [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00