Skip to content

Commit cb9f953

Browse files
committedJun 10, 2017
Merge branch 'master' into staging
More larger rebuilds.
2 parents 2993b7e + 2d64e1b commit cb9f953

File tree

66 files changed

+1299
-413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1299
-413
lines changed
 

‎lib/maintainers.nix

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
chris-martin = "Chris Martin <ch.martin@gmail.com>";
100100
chrisjefferson = "Christopher Jefferson <chris@bubblescope.net>";
101101
christopherpoole = "Christopher Mark Poole <mail@christopherpoole.net>";
102+
ciil = "Simon Lackerbauer <simon@lackerbauer.com>";
102103
ckampka = "Christian Kampka <christian@kampka.net>";
103104
cko = "Christine Koppelt <christine.koppelt@gmail.com>";
104105
cleverca22 = "Michael Bishop <cleverca22@gmail.com>";

‎nixos/modules/security/acme.nix

+38-26
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let
1313
description = ''
1414
Where the webroot of the HTTP vhost is located.
1515
<filename>.well-known/acme-challenge/</filename> directory
16-
will be created automatically if it doesn't exist.
16+
will be created below the webroot if it doesn't exist.
1717
<literal>http://example.org/.well-known/acme-challenge/</literal> must also
1818
be available (notice unencrypted HTTP).
1919
'';
@@ -46,7 +46,10 @@ let
4646
allowKeysForGroup = mkOption {
4747
type = types.bool;
4848
default = false;
49-
description = "Give read permissions to the specified group to read SSL private certificates.";
49+
description = ''
50+
Give read permissions to the specified group
51+
(<option>security.acme.group</option>) to read SSL private certificates.
52+
'';
5053
};
5154

5255
postRun = mkOption {
@@ -65,21 +68,24 @@ let
6568
"cert.der" "cert.pem" "chain.pem" "external.sh"
6669
"fullchain.pem" "full.pem" "key.der" "key.pem" "account_key.json"
6770
]);
68-
default = [ "fullchain.pem" "key.pem" "account_key.json" ];
71+
default = [ "fullchain.pem" "full.pem" "key.pem" "account_key.json" ];
6972
description = ''
7073
Plugins to enable. With default settings simp_le will
71-
store public certificate bundle in <filename>fullchain.pem</filename>
72-
and private key in <filename>key.pem</filename> in its state directory.
74+
store public certificate bundle in <filename>fullchain.pem</filename>,
75+
private key in <filename>key.pem</filename> and those two previous
76+
files combined in <filename>full.pem</filename> in its state directory.
7377
'';
7478
};
7579

7680
extraDomains = mkOption {
7781
type = types.attrsOf (types.nullOr types.str);
7882
default = {};
79-
example = {
80-
"example.org" = "/srv/http/nginx";
81-
"mydomain.org" = null;
82-
};
83+
example = literalExample ''
84+
{
85+
"example.org" = "/srv/http/nginx";
86+
"mydomain.org" = null;
87+
}
88+
'';
8389
description = ''
8490
Extra domain names for which certificates are to be issued, with their
8591
own server roots if needed.
@@ -139,17 +145,19 @@ in
139145
description = ''
140146
Attribute set of certificates to get signed and renewed.
141147
'';
142-
example = {
143-
"example.com" = {
144-
webroot = "/var/www/challenges/";
145-
email = "foo@example.com";
146-
extraDomains = { "www.example.com" = null; "foo.example.com" = "/var/www/foo/"; };
147-
};
148-
"bar.example.com" = {
149-
webroot = "/var/www/challenges/";
150-
email = "bar@example.com";
151-
};
152-
};
148+
example = literalExample ''
149+
{
150+
"example.com" = {
151+
webroot = "/var/www/challenges/";
152+
email = "foo@example.com";
153+
extraDomains = { "www.example.com" = null; "foo.example.com" = "/var/www/foo/"; };
154+
};
155+
"bar.example.com" = {
156+
webroot = "/var/www/challenges/";
157+
email = "bar@example.com";
158+
};
159+
}
160+
'';
153161
};
154162
};
155163
};
@@ -238,6 +246,9 @@ in
238246
mv $workdir/server.key ${cpath}/key.pem
239247
mv $workdir/server.crt ${cpath}/fullchain.pem
240248
249+
# Create full.pem for e.g. lighttpd (same format as "simp_le ... -f full.pem" creates)
250+
cat "${cpath}/key.pem" "${cpath}/fullchain.pem" > "${cpath}/full.pem"
251+
241252
# Clean up working directory
242253
rm $workdir/server.csr
243254
rm $workdir/server.pass.key
@@ -247,6 +258,8 @@ in
247258
chown '${data.user}:${data.group}' '${cpath}/key.pem'
248259
chmod ${rights} '${cpath}/fullchain.pem'
249260
chown '${data.user}:${data.group}' '${cpath}/fullchain.pem'
261+
chmod ${rights} '${cpath}/full.pem'
262+
chown '${data.user}:${data.group}' '${cpath}/full.pem'
250263
'';
251264
serviceConfig = {
252265
Type = "oneshot";
@@ -275,15 +288,14 @@ in
275288
)
276289
);
277290
servicesAttr = listToAttrs services;
278-
nginxAttr = {
279-
nginx = {
280-
after = [ "acme-selfsigned-certificates.target" ];
281-
wants = [ "acme-selfsigned-certificates.target" "acme-certificates.target" ];
282-
};
291+
injectServiceDep = {
292+
after = [ "acme-selfsigned-certificates.target" ];
293+
wants = [ "acme-selfsigned-certificates.target" "acme-certificates.target" ];
283294
};
284295
in
285296
servicesAttr //
286-
(if config.services.nginx.enable then nginxAttr else {});
297+
(if config.services.nginx.enable then { nginx = injectServiceDep; } else {}) //
298+
(if config.services.lighttpd.enable then { lighttpd = injectServiceDep; } else {});
287299

288300
systemd.timers = flip mapAttrs' cfg.certs (cert: data: nameValuePair
289301
("acme-${cert}")

0 commit comments

Comments
 (0)
Please sign in to comment.