File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 9999 "builtin-3.${ domain } " . listenHTTP = ":80" ;
100100 } ;
101101 } ;
102+
103+ csr . configuration =
104+ let
105+ conf = pkgs . writeText "openssl.csr.conf" ''
106+ [req]
107+ default_bits = 2048
108+ prompt = no
109+ default_md = sha256
110+ req_extensions = req_ext
111+ distinguished_name = dn
112+
113+ [ dn ]
114+ CN = ${ config . networking . fqdn }
115+
116+ [ req_ext ]
117+ subjectAltName = @alt_names
118+
119+ [ alt_names ]
120+ DNS.1 = ${ config . networking . fqdn }
121+ '' ;
122+ csrData =
123+ pkgs . runCommandNoCC "csr-and-key"
124+ {
125+ buildInputs = [ pkgs . openssl ] ;
126+ }
127+ ''
128+ mkdir -p $out
129+ openssl req -new -newkey rsa:2048 -nodes \
130+ -keyout $out/key.pem \
131+ -out $out/request.csr \
132+ -config ${ conf }
133+ '' ;
134+ in
135+ {
136+ security . acme . certs . "${ config . networking . fqdn } " = {
137+ csr = "${ csrData } /request.csr" ;
138+ csrKey = "${ csrData } /key.pem" ;
139+ } ;
140+ } ;
102141 } ;
103142 } ;
104143 } ;
211250
212251 with subtest("Validate permissions (self-signed)"):
213252 check_permissions(builtin, cert, "acme")
253+
254+ with subtest("Can renew using a CSR"):
255+ builtin.succeed(f"systemctl clean acme-{cert}.service --what=state")
256+ switch_to(builtin, "csr")
257+ check_issuer(builtin, cert, "pebble")
214258 '' ;
215259}
You can’t perform that action at this time.
0 commit comments