@@ -205,12 +205,16 @@ local function update_cert_handler(data)
205
205
if not pkey then
206
206
local t = ngx .now ()
207
207
if typ == ' rsa' then
208
- pkey = util .create_pkey (4096 , ' RSA' )
208
+ local pkey , err = util .create_pkey (4096 , ' RSA' )
209
209
elseif typ == ' ecc' then
210
- pkey = util .create_pkey (nil , ' EC' , ' prime256v1' )
210
+ local pkey , err = util .create_pkey (nil , ' EC' , ' prime256v1' )
211
211
else
212
212
return " unknown key type: " .. typ
213
213
end
214
+ if not pkey then
215
+ log (ngx_ERR , " error creating new " , typ , " private key for " , domain , " : " , err )
216
+ return err
217
+ end
214
218
ngx .update_time ()
215
219
log (ngx_INFO , ngx .now () - t , " s spent in creating new " , typ , " private key" )
216
220
end
@@ -456,7 +460,11 @@ function AUTOSSL.init(autossl_config, acme_config)
456
460
else
457
461
-- We always generate a key here incase there isn't already one in storage
458
462
-- that way a consistent one can be shared across all workers
459
- AUTOSSL .generated_account_key = AUTOSSL .create_account_key ()
463
+ local key , err = AUTOSSL .create_account_key ()
464
+ if not key then
465
+ error (" failed to create account key: " .. err )
466
+ end
467
+ AUTOSSL .generated_account_key = key
460
468
end
461
469
462
470
if autossl_config .staging then
@@ -676,10 +684,10 @@ end
676
684
677
685
function AUTOSSL .create_account_key ()
678
686
local t = ngx .now ()
679
- local pkey = util .create_pkey (4096 , ' RSA' )
687
+ local pkey , err = util .create_pkey (4096 , ' RSA' )
680
688
ngx .update_time ()
681
689
log (ngx_INFO , ngx .now () - t , " s spent in creating new account key" )
682
- return pkey
690
+ return pkey , err
683
691
end
684
692
685
693
function AUTOSSL .load_account_key_storage ()
0 commit comments