diff options
author | Dimitri Sokolyuk <demon@dim13.org> | 2016-03-09 05:33:29 +0100 |
---|---|---|
committer | Dimitri Sokolyuk <demon@dim13.org> | 2016-03-09 05:33:29 +0100 |
commit | c12834eb15a69bb8c9f676998029f8a338c6b294 (patch) | |
tree | e52db460883bf9a74f262bb8539a14b1d494d946 | |
parent | b5eb551c192b2c5df650584b674ced716b28a961 (diff) |
Skip reregistration
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | cmd/acme/main.go | 21 |
2 files changed, 25 insertions, 8 deletions
@@ -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 { |