NixOS ACME / LetsEncrypt | 103 Members | |
| Another day, another cert renewal | 44 Servers |
| Sender | Message | Time |
|---|---|---|
| 2 Oct 2023 | ||
| Background: When changing the config file by e.g. adding new vhosts at switch time, nginx is not immediately reloaded and being made aware of the config changes. One of the reasons is that new vhosts might rely on certificate files yet to be generated by the acme subsystem. Reloading is thus triggered by nginx-reload-config.service.Its dependencies are configured as such that it runs before the respective acme-domain-finished.target, but after the acme-domain.service renew service. That service though communicates with an acme registry and makes the registry fetch the validation response from nginx. With the config not being reloaded yet, nginx does not know the respective vhost and cannot serve a valid response. | 12:45:48 | |
acme: error: 403 :: urn:ietf:params:acme:error:unauthorized | 12:46:49 | |
Failed to fetch certificates. This may mean your DNS records are set up incorrectly. Selfsigned certs are in place and dependant services will still start. | 12:47:15 | |
As nginx is reloaded even after failing scme service runs, the next retry of the service succeeds and after a few minutes, the certs are successfully validated. But the initial switch-to-configuration exits with a failure code. This is not very useful if you call taht switch as a part of a deployment script. | 12:48:56 | |
| I mainly want to know whether
| 12:50:03 | |
| The reload situation right now is <nginx.conf updated> -> <acme-selfsigned service run> -> <acme-renew run> -> <nginx-reload-config.service> -> <acme-finished target> | 12:52:15 | |
| The easiest thing would be (as long as self-signed placeholder certs are used) if it was <nginx.conf updated> -> <acme-selfsigned service run> -> <nginx-reload-config.service> -> <acme-renew run> -> <nginx-reload-config.service> -> <acme-finished target> | 12:53:04 | |
| Unfortunately, the same service cannot be run mutliple times within the dependency chain of a service (AFAIK). So I am thinking about duplicating the nginx reload service under 2 names to run it before and after an acme renewal. But maybe there's a better option or I am just holding thing the wrong end here. | 12:54:38 | |
* As nginx is reloaded even after failing acme service runs, the next retry of the service succeeds and after a few minutes, the certs are successfully validated. But the initial switch-to-configuration exits with a failure code. This is not very useful if you call taht switch as a part of a deployment script. | 13:02:42 | |