Commit 69366580 authored by Matthew Holt's avatar Matthew Holt

letsencrypt: Work with latest lego changes

parent b5b31e39
...@@ -152,7 +152,7 @@ func newClient(leEmail string) (*acme.Client, error) { ...@@ -152,7 +152,7 @@ func newClient(leEmail string) (*acme.Client, error) {
} }
// The client facilitates our communication with the CA server. // The client facilitates our communication with the CA server.
client := acme.NewClient(caURL, &leUser, rsaKeySizeToUse, exposePort, true) // TODO: Dev mode is enabled client := acme.NewClient(caURL, &leUser, rsaKeySizeToUse, exposePort)
// If not registered, the user must register an account with the CA // If not registered, the user must register an account with the CA
// and agree to terms // and agree to terms
...@@ -164,7 +164,7 @@ func newClient(leEmail string) (*acme.Client, error) { ...@@ -164,7 +164,7 @@ func newClient(leEmail string) (*acme.Client, error) {
leUser.Registration = reg leUser.Registration = reg
// TODO: we can just do the agreement once: when registering, right? // TODO: we can just do the agreement once: when registering, right?
err = client.AgreeToTos() err = client.AgreeToTOS()
if err != nil { if err != nil {
saveUser(leUser) // TODO: Might as well try, right? Error check? saveUser(leUser) // TODO: Might as well try, right? Error check?
return nil, errors.New("error agreeing to terms: " + err.Error()) return nil, errors.New("error agreeing to terms: " + err.Error())
...@@ -189,7 +189,7 @@ func obtainCertificates(client *acme.Client, serverConfigs []*server.Config) ([] ...@@ -189,7 +189,7 @@ func obtainCertificates(client *acme.Client, serverConfigs []*server.Config) ([]
hosts = append(hosts, cfg.Host) hosts = append(hosts, cfg.Host)
} }
certificates, err := client.ObtainCertificates(hosts) certificates, err := client.ObtainCertificates(hosts, true)
if err != nil { if err != nil {
return nil, errors.New("error obtaining certs: " + err.Error()) return nil, errors.New("error obtaining certs: " + err.Error())
} }
......
...@@ -84,10 +84,10 @@ func processCertificateRenewal(configs []server.Config) []error { ...@@ -84,10 +84,10 @@ func processCertificateRenewal(configs []server.Config) []error {
// Renew certificate. // Renew certificate.
// TODO: revokeOld should be an option in the caddyfile // TODO: revokeOld should be an option in the caddyfile
newCertMeta, err := client.RenewCertificate(certMeta, true) newCertMeta, err := client.RenewCertificate(certMeta, true, true)
if err != nil { if err != nil {
time.Sleep(10 * time.Second) time.Sleep(10 * time.Second)
newCertMeta, err = client.RenewCertificate(certMeta, true) newCertMeta, err = client.RenewCertificate(certMeta, true, true)
if err != nil { if err != nil {
errs = append(errs, err) errs = append(errs, err)
continue continue
......
...@@ -89,13 +89,12 @@ func main() { ...@@ -89,13 +89,12 @@ func main() {
log.Fatal("FILE LISTENER:", err) log.Fatal("FILE LISTENER:", err)
} }
var ok bool lnf, ok := ln.(server.ListenerFile)
ln, ok = ln.(server.ListenerFile)
if !ok { if !ok {
log.Fatal("Listener was not a ListenerFile") log.Fatal("Listener was not a ListenerFile")
} }
err = s.Serve(ln.(server.ListenerFile)) err = s.Serve(lnf)
// TODO: Better error logging... also, is it even necessary? // TODO: Better error logging... also, is it even necessary?
if err != nil { if err != nil {
log.Println(err) log.Println(err)
...@@ -204,7 +203,7 @@ func loadConfigs() (config.Group, error) { ...@@ -204,7 +203,7 @@ func loadConfigs() (config.Group, error) {
} }
} }
// Command line Arg // Command line args
if flag.NArg() > 0 { if flag.NArg() > 0 {
confBody := ":" + config.DefaultPort + "\n" + strings.Join(flag.Args(), "\n") confBody := ":" + config.DefaultPort + "\n" + strings.Join(flag.Args(), "\n")
return config.Load("args", bytes.NewBufferString(confBody)) return config.Load("args", bytes.NewBufferString(confBody))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment