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) {
}
// 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
// and agree to terms
......@@ -164,7 +164,7 @@ func newClient(leEmail string) (*acme.Client, error) {
leUser.Registration = reg
// TODO: we can just do the agreement once: when registering, right?
err = client.AgreeToTos()
err = client.AgreeToTOS()
if err != nil {
saveUser(leUser) // TODO: Might as well try, right? Error check?
return nil, errors.New("error agreeing to terms: " + err.Error())
......@@ -189,7 +189,7 @@ func obtainCertificates(client *acme.Client, serverConfigs []*server.Config) ([]
hosts = append(hosts, cfg.Host)
}
certificates, err := client.ObtainCertificates(hosts)
certificates, err := client.ObtainCertificates(hosts, true)
if err != nil {
return nil, errors.New("error obtaining certs: " + err.Error())
}
......
......@@ -84,10 +84,10 @@ func processCertificateRenewal(configs []server.Config) []error {
// Renew certificate.
// 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 {
time.Sleep(10 * time.Second)
newCertMeta, err = client.RenewCertificate(certMeta, true)
newCertMeta, err = client.RenewCertificate(certMeta, true, true)
if err != nil {
errs = append(errs, err)
continue
......
......@@ -89,13 +89,12 @@ func main() {
log.Fatal("FILE LISTENER:", err)
}
var ok bool
ln, ok = ln.(server.ListenerFile)
lnf, ok := ln.(server.ListenerFile)
if !ok {
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?
if err != nil {
log.Println(err)
......@@ -204,7 +203,7 @@ func loadConfigs() (config.Group, error) {
}
}
// Command line Arg
// Command line args
if flag.NArg() > 0 {
confBody := ":" + config.DefaultPort + "\n" + strings.Join(flag.Args(), "\n")
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