@@ -212,23 +212,6 @@ async fn ngx_http_acme_update_certificates(amcf: &AcmeMainConfig) -> Time {
212
212
let issuer_next = match ngx_http_acme_update_certificates_for_issuer ( amcf, issuer) . await {
213
213
Ok ( x) => x,
214
214
Err ( err) => {
215
- // Check if the server rejected this ACME account configuration.
216
- if err
217
- . downcast_ref :: < acme:: error:: NewAccountError > ( )
218
- . is_some_and ( |err| err. is_invalid ( ) )
219
- {
220
- ngx_log_error ! (
221
- NGX_LOG_ERR ,
222
- log. as_ptr( ) ,
223
- "acme issuer \" {}\" is not valid: {}" ,
224
- issuer. name,
225
- err
226
- ) ;
227
-
228
- issuer. set_invalid ( err. as_ref ( ) ) ;
229
- continue ;
230
- }
231
-
232
215
ngx_log_error ! (
233
216
NGX_LOG_INFO ,
234
217
log. as_ptr( ) ,
@@ -300,7 +283,47 @@ async fn ngx_http_acme_update_certificates_for_issuer(
300
283
}
301
284
302
285
if !client. is_ready ( ) {
303
- client. new_account ( ) . await ?;
286
+ match client. new_account ( ) . await {
287
+ Ok ( acme:: NewAccountOutput :: Created ( x) ) => {
288
+ ngx_log_error ! (
289
+ NGX_LOG_INFO ,
290
+ log. as_ptr( ) ,
291
+ "acme account \" {}\" created for issuer \" {}\" " ,
292
+ x,
293
+ issuer. name
294
+ ) ;
295
+ let _ = issuer. write_state_file ( "account.url" , x. as_bytes ( ) ) ;
296
+ }
297
+ Ok ( acme:: NewAccountOutput :: Found ( x) ) => {
298
+ ngx_log_debug ! (
299
+ log. as_ptr( ) ,
300
+ "acme account \" {}\" found for issuer \" {}\" " ,
301
+ x,
302
+ issuer. name
303
+ ) ;
304
+ }
305
+ Err ( err) if err. is_invalid ( ) => {
306
+ ngx_log_error ! (
307
+ NGX_LOG_ERR ,
308
+ log. as_ptr( ) ,
309
+ "acme account validation failed for issuer \" {}\" : {}" ,
310
+ issuer. name,
311
+ err
312
+ ) ;
313
+ issuer. set_invalid ( & err) ;
314
+ return Ok ( Time :: MAX ) ;
315
+ }
316
+ Err ( err) => {
317
+ ngx_log_error ! (
318
+ NGX_LOG_WARN ,
319
+ log. as_ptr( ) ,
320
+ "acme account retrieval failed for issuer \" {}\" : {}" ,
321
+ issuer. name,
322
+ err
323
+ ) ;
324
+ return Ok ( issuer. set_error ( & err) ) ;
325
+ }
326
+ }
304
327
}
305
328
306
329
let alloc = crate :: util:: OwnedPool :: new ( nginx_sys:: NGX_DEFAULT_POOL_SIZE as _ , log)
0 commit comments