git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #18366 from groxxda/acme-loop

security.acme: require networking for client, remove loop without fallbackHost

commit9190dbcc0e4f42487886916a0309aa3236d76df6 authorFranz Pletz <fpletz@fnordicwalking.de> dateTue 6 Sep 2016, 23:02 (10 years ago) parentc5e9049e84b803
3 files changed+8−6
nixos/modules/security/acme.nix+2−1 nixos/modules/services/web-servers/nginx/default.nix+4−3 nixos/modules/services/web-servers/nginx/vhost-options.nix+2−2
nixos/modules/security/acme.nix+2−1
@@ -166,7 +166,8 @@ in
166166 ++ concatLists (mapAttrsToList (name: root: [ "-d" (if root == null then name else "${name}:${root}")]) data.extraDomains);
167167 acmeService = {
168168 description = "Renew ACME Certificate for ${cert}";
169− after = [ "network.target" ];
169+ after = [ "network.target" "network-online.target" ];
170+ wants = [ "network-online.target" ];
170171 serviceConfig = {
171172 Type = "oneshot";
172173 SuccessExitStatus = [ "0" "1" ];
nixos/modules/services/web-servers/nginx/default.nix+4−3
@@ -114,17 +114,18 @@ let
114114 port = if vhost.port != null then vhost.port else (if ssl then 443 else 80);
115115 listenString = toString port + optionalString ssl " ssl http2"
116116 + optionalString vhost.default " default";
117− acmeLocation = optionalString vhost.enableACME ''
117+ acmeLocation = optionalString vhost.enableACME (''
118118 location /.well-known/acme-challenge {
119− try_files $uri @acme-fallback;
119+ ${optionalString (vhost.acmeFallbackHost != null) "try_files $uri @acme-fallback;"}
120120 root ${vhost.acmeRoot};
121121 auth_basic off;
122122 }
123+ '' + (optionalString (vhost.acmeFallbackHost != null) ''
123124 location @acme-fallback {
124125 auth_basic off;
125126 proxy_pass http://${vhost.acmeFallbackHost};
126127 }
127− '';
128+ ''));
128129 in ''
129130 ${optionalString vhost.forceSSL ''
130131 server {
nixos/modules/services/web-servers/nginx/vhost-options.nix+2−2
@@ -39,8 +39,8 @@ with lib;
3939 };
4040
4141 acmeFallbackHost = mkOption {
42− type = types.str;
43− default = "0.0.0.0";
42+ type = types.nullOr types.str;
43+ default = null;
4444 description = ''
4545 Host which to proxy requests to if acme challenge is not found. Useful
4646 if you want multiple hosts to be able to verify the same domain name.