mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/acme: Fix cert renewal with built in webserver
Fixes #191794 Lego threw a permission denied error binding to port 80. AmbientCapabilities with CAP_NET_BIND_SERVICE was required. Also added a test for this.
This commit is contained in:
parent
22d41f921f
commit
39796cad46
2 changed files with 21 additions and 1 deletions
|
@ -325,6 +325,7 @@ let
|
||||||
'');
|
'');
|
||||||
} // optionalAttrs (data.listenHTTP != null && toInt (elemAt (splitString ":" data.listenHTTP) 1) < 1024) {
|
} // optionalAttrs (data.listenHTTP != null && toInt (elemAt (splitString ":" data.listenHTTP) 1) < 1024) {
|
||||||
CapabilityBoundingSet = [ "CAP_NET_BIND_SERVICE" ];
|
CapabilityBoundingSet = [ "CAP_NET_BIND_SERVICE" ];
|
||||||
|
AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Working directory will be /tmp
|
# Working directory will be /tmp
|
||||||
|
|
|
@ -173,6 +173,17 @@ in {
|
||||||
services.nginx.logError = "stderr info";
|
services.nginx.logError = "stderr info";
|
||||||
|
|
||||||
specialisation = {
|
specialisation = {
|
||||||
|
# Tests HTTP-01 verification using Lego's built-in web server
|
||||||
|
http01lego.configuration = { ... }: {
|
||||||
|
security.acme = {
|
||||||
|
certs."http.example.test" = {
|
||||||
|
listenHTTP = ":80";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||||
|
};
|
||||||
|
|
||||||
# First derivation used to test general ACME features
|
# First derivation used to test general ACME features
|
||||||
general.configuration = { ... }: let
|
general.configuration = { ... }: let
|
||||||
caDomain = nodes.acme.test-support.acme.caDomain;
|
caDomain = nodes.acme.test-support.acme.caDomain;
|
||||||
|
@ -446,7 +457,15 @@ in {
|
||||||
|
|
||||||
download_ca_certs(client)
|
download_ca_certs(client)
|
||||||
|
|
||||||
# Perform general tests first
|
# Perform http-01 w/ lego test first
|
||||||
|
switch_to(webserver, "http01lego")
|
||||||
|
|
||||||
|
with subtest("Can request certificate with Lego's built in web server"):
|
||||||
|
webserver.wait_for_unit("acme-finished-http.example.test.target")
|
||||||
|
check_fullchain(webserver, "http.example.test")
|
||||||
|
check_issuer(webserver, "http.example.test", "pebble")
|
||||||
|
|
||||||
|
# Perform general tests
|
||||||
switch_to(webserver, "general")
|
switch_to(webserver, "general")
|
||||||
|
|
||||||
with subtest("Can request certificate with HTTP-01 challenge"):
|
with subtest("Can request certificate with HTTP-01 challenge"):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue