Dstack-TEE / Dstack-TEE/dstack

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

オープン
#1,012 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug rust
主要言語
Rust
スター
544
フォーク
96
平均マージ
17時間 57分
マージ済み PR(30日)
117

説明

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:

```rust
// 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` 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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start in dstack/certbot/src/bot.rs, tracing how renew_and_run_hook reports renewed-hook failures, then follow the --once path in cli/src/main.rs. Preserve the daemon loop's current logging-and-continuing behavior, but make --once return a non-zero exit when the hook does not run or exits unsuccessfully. Verify both semantics with the relevant certbot command paths.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
cli
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
64/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。