Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
410ece83
Commit
410ece83
authored
May 19, 2017
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tls: Only require renewed cert at startup 7 days out (issue #1680)
parent
ebf4279e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
caddytls/maintain.go
caddytls/maintain.go
+18
-7
No files found.
caddytls/maintain.go
View file @
410ece83
...
...
@@ -25,6 +25,13 @@ const (
// RenewDurationBefore is how long before expiration to renew certificates.
RenewDurationBefore
=
(
24
*
time
.
Hour
)
*
30
// RenewDurationBeforeAtStartup is how long before expiration to require
// a renewed certificate when the process is first starting up (see #1680).
// A wider window between RenewDurationBefore and this value will allow
// Caddy to start under duress but hopefully this duration will give it
// enough time for the blockage to be relieved.
RenewDurationBeforeAtStartup
=
(
24
*
time
.
Hour
)
*
7
// OCSPInterval is how often to check if OCSP stapling needs updating.
OCSPInterval
=
1
*
time
.
Hour
)
...
...
@@ -126,13 +133,17 @@ func RenewManagedCertificates(allowPrompts bool) (err error) {
err
:=
cert
.
Config
.
RenewCert
(
renewName
,
allowPrompts
)
if
err
!=
nil
{
if
allowPrompts
{
// Certificate renewal failed and the operator is present; we should stop
// immediately and return the error. See a discussion in issue 642
// about this. For a while, we only stopped if the certificate was
// expired, but in reality, there is no difference between reporting
// it now versus later, except that there's somebody present to deal
// with it now, so require it.
return
err
// Certificate renewal failed and the operator is present. See a discussion
// about this in issue 642. For a while, we only stopped if the certificate
// was expired, but in reality, there is no difference between reporting
// it now versus later, except that there's somebody present to deal with
// it right now.
timeLeft
:=
cert
.
NotAfter
.
Sub
(
time
.
Now
()
.
UTC
())
if
timeLeft
<
RenewDurationBeforeAtStartup
{
// See issue 1680. Only fail at startup if the certificate is dangerously
// close to expiration.
return
err
}
}
log
.
Printf
(
"[ERROR] %v"
,
err
)
if
cert
.
Config
.
OnDemand
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment