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