aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/acme/config.go8
-rw-r--r--cmd/acme/main.go9
2 files changed, 8 insertions, 9 deletions
diff --git a/cmd/acme/config.go b/cmd/acme/config.go
index 36d5f46..bec6a19 100644
--- a/cmd/acme/config.go
+++ b/cmd/acme/config.go
@@ -1,7 +1,6 @@
package main
import (
- "crypto/x509"
"errors"
"io/ioutil"
"os/user"
@@ -170,10 +169,3 @@ func checkWWW(altnames []string) []string {
}
return altnames
}
-
-func (d domain) needsRenew(cert *x509.Certificate) bool {
- if cert == nil {
- return true
- }
- return time.Now().Add(d.Gracetime).After(cert.NotAfter)
-}
diff --git a/cmd/acme/main.go b/cmd/acme/main.go
index ffa74c9..67838f7 100644
--- a/cmd/acme/main.go
+++ b/cmd/acme/main.go
@@ -4,6 +4,7 @@ package main
import (
"flag"
"log"
+ "time"
"dim13.org/acme"
)
@@ -90,7 +91,13 @@ func requestCert(prov *acme.Provider, acc *acme.Account, d domain) error {
return err
}
}
- if !d.needsRenew(c.Leaf) && !*forceRenew {
+ needsRenew := func() bool {
+ if c.Leaf == nil {
+ return true
+ }
+ return time.Now().Add(d.Gracetime).After(c.Leaf.NotAfter)
+ }
+ if !needsRenew() && !*forceRenew {
log.Println("skip valid until", c.Leaf.NotAfter)
return nil
}