certbot: `renew --once` exits 0 when the renewed hook fails

Abierto
#1,012 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
64/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
rust
Área
cli

Línea de trabajo

Comienza en dstack/certbot/src/bot.rs, siguiendo cómo renew_and_run_hook informa de los fallos del hook de renovación, y después sigue la ruta --once en cli/src/main.rs. Conserva el comportamiento actual del bucle del daemon de registrar y continuar, pero haz que --once devuelva un código de salida distinto de cero cuando el hook no se ejecute o termine sin éxito. Verifica ambas semánticas con las rutas de comandos de certbot relevantes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug rust

Follow-up to #924.

certbot renew --once is the cron/one-shot entry point. #924 made it invoke the renewed_hook (correct — a one-shot renewal that skips the reload hook leaves the serving process on the old cert), but hook failures are only logged:

// dstack/certbot/src/bot.rs
match std::process::Command::new("/bin/sh").arg("-c").arg(hook).status() {
    Ok(status) if status.success() => {}
    Ok(status) => error!("renewed hook failed with status: {status}"),
    Err(error) => error!("failed to run renewed hook: {error:?}"),
}
Ok(true)

So renew_and_run_hook returns Ok(true) regardless, and certbot renew --once exits 0 even when the hook never ran or exited non-zero. A cron job or systemd OneShot unit wrapping this sees success while the certificate on disk is new and the serving process is still holding the old one — exactly the failure that is supposed to be visible.

Swallowing the error is right for the daemon (the next interval retries), wrong for --once (there is no next interval).

Proposal

Split the two semantics. Options, roughly in order of preference:

  1. Have renew_and_run_hook return the hook outcome (e.g. Result<Outcome> carrying hook_failed) and let the --once path in cli/src/main.rs turn a hook failure into a non-zero exit, while run() keeps logging and continuing.
  2. Add a fail_on_hook_error: bool parameter, set from the once flag.

Either way the daemon loop must keep its current behaviour: a failing hook should not abort the loop.

Lenguaje dominante
Rust
Estrellas
546
Forks
96
Merge medio
19 h 22 min
PR fusionados (30 d)
109

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Dstack-TEE/dstack

Todos los issues de Dstack-TEE/dstack

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.