diff options
-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 { |