@@ -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( ) ,
@@ -301,7 +284,47 @@ async fn ngx_http_acme_update_certificates_for_issuer(
301
284
}
302
285
303
286
if !client. is_ready ( ) {
304
- client. new_account ( ) . await ?;
287
+ match client. new_account ( ) . await {
288
+ Ok ( acme:: NewAccountOutput :: Created ( x) ) => {
289
+ ngx_log_error ! (
290
+ NGX_LOG_INFO ,
291
+ log. as_ptr( ) ,
292
+ "acme account \" {}\" created for issuer \" {}\" " ,
293
+ x,
294
+ issuer. name
295
+ ) ;
296
+ let _ = issuer. write_state_file ( "account.url" , x. as_bytes ( ) ) ;
297
+ }
298
+ Ok ( acme:: NewAccountOutput :: Found ( x) ) => {
299
+ ngx_log_debug ! (
300
+ log. as_ptr( ) ,
301
+ "acme account \" {}\" found for issuer \" {}\" " ,
302
+ x,
303
+ issuer. name
304
+ ) ;
305
+ }
306
+ Err ( err) if err. is_invalid ( ) => {
307
+ ngx_log_error ! (
308
+ NGX_LOG_ERR ,
309
+ log. as_ptr( ) ,
310
+ "acme account validation failed for issuer \" {}\" : {}" ,
311
+ issuer. name,
312
+ err
313
+ ) ;
314
+ issuer. set_invalid ( & err) ;
315
+ return Ok ( Time :: MAX ) ;
316
+ }
317
+ Err ( err) => {
318
+ ngx_log_error ! (
319
+ NGX_LOG_WARN ,
320
+ log. as_ptr( ) ,
321
+ "acme account retrieval failed for issuer \" {}\" : {}" ,
322
+ issuer. name,
323
+ err
324
+ ) ;
325
+ return Ok ( issuer. set_error ( & err) ) ;
326
+ }
327
+ }
305
328
}
306
329
307
330
let alloc = crate :: util:: OwnedPool :: new ( nginx_sys:: NGX_DEFAULT_POOL_SIZE as _ , log)
0 commit comments