aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-03-09 05:33:29 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-03-09 05:33:29 +0100
commitc12834eb15a69bb8c9f676998029f8a338c6b294 (patch)
treee52db460883bf9a74f262bb8539a14b1d494d946
parentb5eb551c192b2c5df650584b674ced716b28a961 (diff)
Skip reregistration
-rw-r--r--README.md12
-rw-r--r--cmd/acme/main.go21
2 files changed, 25 insertions, 8 deletions
diff --git a/README.md b/README.md
index d1d8c14..4e0b33e 100644
--- a/README.md
+++ b/README.md
@@ -107,3 +107,15 @@ slogin -R \*:80:localhost:8080 -R \*:443:localhost:8443 root@docker.moccu.com
# Outbound
outbound1.letsencrypt.org
outbound2.letsencrypt.org
+
+### ---
+
+1. no key, no cert
+ - generate key, register
+ - request new cert
+2. key present, no cert
+ - request new cert
+3. key present, cert present
+ - do nothing
+4. key present, cert exires/expired
+ - request new cert
diff --git a/cmd/acme/main.go b/cmd/acme/main.go
index 2de2705..e994189 100644
--- a/cmd/acme/main.go
+++ b/cmd/acme/main.go
@@ -43,6 +43,8 @@ func main() {
}
for _, v := range v.Account {
+ var mustRegister bool
+
log.Println("Load", v.KeyFile)
key, err := v.Load()
if err != nil {
@@ -53,6 +55,7 @@ func main() {
if err := v.Save(key); err != nil {
log.Fatal(err)
}
+ mustRegister = true
}
acc, err := acme.NewAccount(key)
@@ -60,15 +63,17 @@ func main() {
log.Fatal(err)
}
- con, err := acme.NewContacts(v.Mail, v.Phone)
- if err != nil {
- log.Fatal(err)
- }
+ if mustRegister {
+ con, err := acme.NewContacts(v.Mail, v.Phone)
+ if err != nil {
+ log.Fatal(err)
+ }
- log.Println("Register", con)
- err = prov.Register(acc, con)
- if err != nil {
- log.Fatal(err)
+ log.Println("Register", con)
+ err = prov.Register(acc, con)
+ if err != nil {
+ log.Fatal(err)
+ }
}
for _, v := range v.Domain {