@@ -69,8 +69,11 @@ pub enum CliCommand {
6969
7070 /// Run ACME issuance/renewal once for all configured ACME vhosts.
7171 AcmeRenew {
72- /// Confirm that all configured ACME vhosts should be attempted.
73- #[ arg( long) ]
72+ /// Force renewal for every configured ACME vhost, even when certificates are not due.
73+ #[ arg( long, alias = "all" ) ]
74+ force_renew : bool ,
75+ /// Deprecated alias for --force-renew.
76+ #[ arg( long, hide = true ) ]
7477 all : bool ,
7578 } ,
7679
@@ -255,7 +258,9 @@ fn run_command(
255258 }
256259 Ok ( ( ) )
257260 }
258- CliCommand :: AcmeRenew { all } => run_acme_renew_command ( config_path, * all) ,
261+ CliCommand :: AcmeRenew { force_renew, all } => {
262+ run_acme_renew_command ( config_path, * force_renew || * all)
263+ }
259264 CliCommand :: AcmeInit {
260265 issuer,
261266 email,
@@ -302,7 +307,7 @@ struct AcmeInitOptions {
302307#[ cfg( feature = "acme-client" ) ]
303308fn run_acme_renew_command (
304309 config_path : Option < & std:: path:: Path > ,
305- all : bool ,
310+ force_renew : bool ,
306311) -> Result < ( ) , Box < dyn Error + Send + Sync > > {
307312 crate :: tls:: install_rustls_crypto_provider ( ) ;
308313
@@ -352,15 +357,20 @@ fn run_acme_renew_command(
352357 }
353358 }
354359
355- let run = if all {
360+ let run = if force_renew {
356361 runtime. block_on ( crate :: acme:: renew_all_instant_acme_targets ( & config, now) ) ?
357362 } else {
358363 runtime. block_on ( crate :: acme:: renew_due_instant_acme_targets ( & config, now) ) ?
359364 } ;
360365
361366 println ! ( "acme attempted: {}" , run. attempted) ;
362- if all && !targets. is_empty ( ) && run. attempted == 0 {
363- return Err ( "ACME renewal planner produced targets, but --all attempted none" . into ( ) ) ;
367+ if force_renew && !targets. is_empty ( ) && run. attempted == 0 {
368+ return Err (
369+ "ACME renewal planner produced targets, but --force-renew attempted none" . into ( ) ,
370+ ) ;
371+ }
372+ if !force_renew && run. attempted == 0 {
373+ println ! ( "acme status: no certificates are missing or due for renewal" ) ;
364374 }
365375 for outcome in & run. renewed {
366376 println ! (
@@ -455,7 +465,9 @@ fn run_acme_init_command(options: AcmeInitOptions) -> Result<(), Box<dyn Error +
455465 }
456466 println ! ( "next: add [vhosts.tls.acme] to each vhost that should receive a managed certificate" ) ;
457467 println ! ( "next: run `systemctl daemon-reload` if a systemd drop-in was created" ) ;
458- println ! ( "next: run `fluxheim --config /etc/fluxheim/fluxheim.toml acme-renew --all`" ) ;
468+ println ! (
469+ "next: run `fluxheim --config /etc/fluxheim/fluxheim.toml acme-renew --force-renew` for first issuance"
470+ ) ;
459471 Ok ( ( ) )
460472}
461473
0 commit comments