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

Đang mở
#1,012 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
64/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu trong dstack/certbot/src/bot.rs, theo dõi cách renew_and_run_hook báo cáo các lỗi của hook gia hạn, sau đó theo dõi đường dẫn --once trong cli/src/main.rs. Giữ nguyên hành vi hiện tại của vòng lặp daemon là ghi log rồi tiếp tục, nhưng khiến --once trả về mã thoát khác không khi hook không chạy hoặc kết thúc không thành công. Xác minh cả hai ngữ nghĩa bằng các đường dẫn lệnh certbot liên quan.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
546
Fork
96
Merge trung bình
19 giờ 22 phút
Pull request đã merge (30 ngày)
109

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Dstack-TEE/dstack

Tất cả issue của Dstack-TEE/dstack

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.