@@ -196,7 +196,11 @@ func (ca *CA) Init(cfg *config.Config) (*CA, error) {
196
196
api .Route (r )
197
197
})
198
198
199
- //Add ACME api endpoints in /acme and /1.0/acme
199
+ // Mount the CRL to the insecure mux
200
+ insecureMux .Get ("/crl" , api .CRL )
201
+ insecureMux .Get ("/1.0/crl" , api .CRL )
202
+
203
+ // Add ACME api endpoints in /acme and /1.0/acme
200
204
dns := cfg .DNSNames [0 ]
201
205
u , err := url .Parse ("https://" + cfg .Address )
202
206
if err != nil {
@@ -276,6 +280,7 @@ func (ca *CA) Init(cfg *config.Config) (*CA, error) {
276
280
277
281
// helpful routine for logging all routes
278
282
//dumpRoutes(mux)
283
+ //dumpRoutes(insecureMux)
279
284
280
285
// Add monitoring if configured
281
286
if len (cfg .Monitoring ) > 0 {
@@ -307,7 +312,7 @@ func (ca *CA) Init(cfg *config.Config) (*CA, error) {
307
312
308
313
// only start the insecure server if the insecure address is configured
309
314
// and, currently, also only when it should serve SCEP endpoints.
310
- if ca .shouldServeSCEPEndpoints () && cfg . InsecureAddress != "" {
315
+ if ca .shouldServeInsecureServer () {
311
316
// TODO: instead opt for having a single server.Server but two
312
317
// http.Servers handling the HTTP and HTTPS handler? The latter
313
318
// will probably introduce more complexity in terms of graceful
@@ -321,6 +326,23 @@ func (ca *CA) Init(cfg *config.Config) (*CA, error) {
321
326
return ca , nil
322
327
}
323
328
329
+ // shouldServeInsecureServer returns whether or not the insecure
330
+ // server should also be started. This is (currently) only the case
331
+ // if the insecure address has been configured AND when a SCEP
332
+ // provisioner is configured or when a CRL is configured.
333
+ func (ca * CA ) shouldServeInsecureServer () bool {
334
+ switch {
335
+ case ca .config .InsecureAddress == "" :
336
+ return false
337
+ case ca .shouldServeSCEPEndpoints ():
338
+ return true
339
+ case ca .config .CRL != nil && ca .config .CRL .Enabled :
340
+ return true
341
+ default :
342
+ return false
343
+ }
344
+ }
345
+
324
346
// buildContext builds the server base context.
325
347
func buildContext (a * authority.Authority , scepAuthority * scep.Authority , acmeDB acme.DB , acmeLinker acme.Linker ) context.Context {
326
348
ctx := authority .NewContext (context .Background (), a )
0 commit comments