Commit 36b440c0 authored by Matthew Holt's avatar Matthew Holt

https: Refuse start only if renewal fails on expired cert (closes #642)

parent 2a46f2a1
......@@ -89,8 +89,13 @@ func renewManagedCertificates(allowPrompts bool) (err error) {
err := client.Renew(cert.Names[0]) // managed certs better have only one name
if err != nil {
if client.AllowPrompts {
// User is present, so stop immediately and report the error
if client.AllowPrompts && timeLeft < 0 {
// Certificate renewal failed, the operator is present, and the certificate
// is already expired; we should stop immediately and return the error. Note
// that we used to do this any time a renewal failed at startup. However,
// after discussion in https://github.com/mholt/caddy/issues/642 we decided to
// only stop startup if the certificate is expired. We still log the error
// otherwise.
certCacheMu.RUnlock()
return err
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment