Skip to content

Commit

Permalink
Bump version of lego to 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
asdek committed Jun 10, 2018
1 parent 58248b9 commit eb89fad
Show file tree
Hide file tree
Showing 319 changed files with 24,142 additions and 49,916 deletions.
Empty file modified .gitignore
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM alpine:3.5

RUN apk add --no-cache ca-certificates openssl bash

ENV LETSENCRYPT_RELEASE v0.5.0
ENV LETSENCRYPT_RELEASE v1.0.0
ENV SSL_SCRIPT_COMMIT 08278ace626ada71384fc949bd637f4c15b03b53

RUN wget -O /usr/bin/update-rancher-ssl https://raw.githubusercontent.com/rancher/rancher/${SSL_SCRIPT_COMMIT}/server/bin/update-rancher-ssl && \
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.5.0
v1.0.0
33 changes: 14 additions & 19 deletions letsencrypt/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import (

"github.com/Sirupsen/logrus"
lego "github.com/xenolf/lego/acme"
loge "github.com/xenolf/lego/log"
)

const (
StorageDir = "/etc/letsencrypt"
ProductionApiUri = "https://acme-v01.api.letsencrypt.org/directory"
ProductionApiUri = "https://acme-v02.api.letsencrypt.org/directory"
StagingApiUri = "https://acme-staging.api.letsencrypt.org/directory"
)

Expand Down Expand Up @@ -97,23 +98,16 @@ func NewClient(email string, kt KeyType, apiVer ApiVersion, dnsResolvers []strin
return nil, fmt.Errorf("Could not create client: %v", err)
}

lego.Logger = log.New(ioutil.Discard, "", 0)
loge.Logger = log.New(ioutil.Discard, "", 0)

if acc.Registration == nil {
logrus.Infof("Creating Let's Encrypt account for %s", email)
reg, err := client.Register()
reg, err := client.Register(true)
if err != nil {
return nil, fmt.Errorf("Failed to register account: %v", err)
}

acc.Registration = reg
if acc.Registration.Body.Agreement == "" {
err = client.AgreeToTOS()
if err != nil {
return nil, fmt.Errorf("Could not agree to TOS: %v", err)
}
}

err = acc.Save()
if err != nil {
logrus.Errorf("Could not save account data: %v", err)
Expand All @@ -133,9 +127,9 @@ func NewClient(email string, kt KeyType, apiVer ApiVersion, dnsResolvers []strin
}

if challenge == lego.DNS01 {
client.ExcludeChallenges([]lego.Challenge{lego.HTTP01, lego.TLSSNI01})
client.ExcludeChallenges([]lego.Challenge{lego.HTTP01})
} else if challenge == lego.HTTP01 {
client.ExcludeChallenges([]lego.Challenge{lego.TLSSNI01, lego.DNS01})
client.ExcludeChallenges([]lego.Challenge{lego.DNS01})
}

if len(dnsResolvers) > 0 {
Expand All @@ -153,20 +147,21 @@ func NewClient(email string, kt KeyType, apiVer ApiVersion, dnsResolvers []strin
func (c *Client) EnableLogs() {
logger := logrus.New()
logger.Out = os.Stdout
lego.Logger = log.New(logger.Writer(), "", 0)
loge.Logger = log.New(logger.Writer(), "", 0)
}

// Issue obtains a new SAN certificate from the Lets Encrypt CA
func (c *Client) Issue(certName string, domains []string) (*AcmeCertificate, map[string]error) {
certRes, failures := c.client.ObtainCertificate(domains, true, nil, false)
if len(failures) > 0 {
return nil, failures
func (c *Client) Issue(certName string, domains []string) (*AcmeCertificate, error) {
certRes, err := c.client.ObtainCertificate(domains, true, nil, false)
if err != nil {
return nil, err
}

dnsNames := dnsNamesIdentifier(domains)
acmeCert, err := c.saveCertificate(certName, dnsNames, certRes)
if err != nil {
logrus.Fatalf("Error saving certificate '%s': %v", certName, err)
return nil, err
}

return acmeCert, nil
Expand Down Expand Up @@ -261,7 +256,7 @@ func (c *Client) loadCertificateByName(certName string) (AcmeCertificate, error)
return acmeCert, nil
}

func (c *Client) saveCertificate(certName, dnsNames string, certRes lego.CertificateResource) (*AcmeCertificate, error) {
func (c *Client) saveCertificate(certName, dnsNames string, certRes *lego.CertificateResource) (*AcmeCertificate, error) {
expiryDate, err := lego.GetPEMCertExpiration(certRes.Certificate)
if err != nil {
return nil, fmt.Errorf("Failed to read certificate expiry date: %v", err)
Expand All @@ -272,7 +267,7 @@ func (c *Client) saveCertificate(certName, dnsNames string, certRes lego.Certifi
}

acmeCert := AcmeCertificate{
CertificateResource: certRes,
CertificateResource: *certRes,
ExpiryDate: expiryDate,
SerialNumber: serialNumber,
DnsNames: dnsNames,
Expand Down
8 changes: 3 additions & 5 deletions manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ func (c *Context) startup() {

logrus.Infof("Trying to obtain SSL certificate (%s) from Let's Encrypt %s CA", strings.Join(c.Domains, ","), c.Acme.ApiVersion())

acmeCert, failures := c.Acme.Issue(c.CertificateName, c.Domains)
if len(failures) > 0 {
for k, v := range failures {
logrus.Errorf("[%s] Error obtaining certificate: %s", k, v.Error())
}
acmeCert, err = c.Acme.Issue(c.CertificateName, c.Domains)
if err != nil {
logrus.Errorf("[%s] Error obtaining certificate: %s", err, err.Error())
os.Exit(1)
}

Expand Down
2 changes: 1 addition & 1 deletion package/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM alpine:3.5

RUN apk add --no-cache ca-certificates openssl bash

ENV LETSENCRYPT_RELEASE v0.5.0
ENV LETSENCRYPT_RELEASE v1.0.0
ENV SSL_SCRIPT_COMMIT 08278ace626ada71384fc949bd637f4c15b03b53

RUN wget -O /usr/bin/update-rancher-ssl https://raw.githubusercontent.com/rancher/rancher/${SSL_SCRIPT_COMMIT}/server/bin/update-rancher-ssl && \
Expand Down
3 changes: 3 additions & 0 deletions scripts/build_local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make deps && make -j 4 build
4 changes: 4 additions & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
env
exec "$@" &
wait
48 changes: 48 additions & 0 deletions trash.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package: github.com/vxcontrol/rancher-letsencrypt
import:
- package: github.com/Azure/azure-sdk-for-go
version: v17.3.0
- package: github.com/Azure/go-autorest
version: v10.10.0
- package: github.com/JamesClonk/vultr
version: 1.13.0
- package: github.com/Sirupsen/logrus
version: v1.0.5
- package: github.com/aws/aws-sdk-go
version: v1.14.3
- package: github.com/dgrijalva/jwt-go
version: 6c8dedd
- package: github.com/dnsimple/dnsimple-go
version: 5a5b427
- package: github.com/edeckers/auroradnsclient
version: 8b777c1
- package: github.com/go-ini/ini
version: e7fea39
- package: github.com/google/go-querystring
version: 53e6ce1
- package: github.com/gorilla/websocket
version: a91eba7
- package: github.com/jmespath/go-jmespath
version: bd40a43
- package: github.com/juju/ratelimit
version: 77ed1c8
- package: github.com/miekg/dns
version: f282f80
- package: github.com/ovh/go-ovh
version: d220717
- package: github.com/pkg/errors
version: c605e28
- package: github.com/rancher/go-rancher/v2
version: 939fd85
- package: github.com/xenolf/lego
version: 7fedfd1
- package: golang.org/x/crypto
version: ab89591
- package: golang.org/x/sys
version: f845067
- package: gopkg.in/ini.v1
version: e7fea39
- package: gopkg.in/ns1/ns1-go.v2
version: c563826
- package: gopkg.in/square/go-jose.v2
version: v2.1.6
48 changes: 23 additions & 25 deletions vendor.conf
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
# package
github.com/vxcontrol/rancher-letsencrypt

github.com/aws/aws-sdk-go v1.8.6
github.com/Azure/azure-sdk-for-go v10.0.2-beta
github.com/Azure/go-autorest v8.0.0
github.com/dgrijalva/jwt-go 6c8dedd
github.com/dnsimple/dnsimple-go 5a5b427
github.com/edeckers/auroradnsclient 8b777c1
github.com/go-ini/ini e7fea39
github.com/google/go-querystring 53e6ce1
github.com/gorilla/websocket a91eba7
github.com/JamesClonk/vultr 1.13.0
github.com/jmespath/go-jmespath bd40a43
github.com/juju/ratelimit 77ed1c8
github.com/miekg/dns f282f80
github.com/ovh/go-ovh d220717
github.com/pkg/errors c605e28
github.com/rancher/go-rancher/v2 939fd85
github.com/Sirupsen/logrus v0.11.5
github.com/xenolf/lego aaa8e70
golang.org/x/crypto ab89591
golang.org/x/net 84f0e6f
golang.org/x/sys f845067
golang.org/x/text 767daa1
gopkg.in/ini.v1 e7fea39
gopkg.in/ns1/ns1-go.v2 c563826
gopkg.in/square/go-jose.v1 aa2e30f
github.com/aws/aws-sdk-go v1.14.3
github.com/Azure/azure-sdk-for-go v17.3.0
github.com/Azure/go-autorest v10.10.0
github.com/dgrijalva/jwt-go 6c8dedd
github.com/dnsimple/dnsimple-go 5a5b427
github.com/edeckers/auroradnsclient 8b777c1
github.com/go-ini/ini e7fea39
github.com/google/go-querystring 53e6ce1
github.com/gorilla/websocket a91eba7
github.com/JamesClonk/vultr 1.13.0
github.com/jmespath/go-jmespath bd40a43
github.com/juju/ratelimit 77ed1c8
github.com/miekg/dns f282f80
github.com/ovh/go-ovh d220717
github.com/pkg/errors c605e28
github.com/rancher/go-rancher/v2 939fd85
github.com/Sirupsen/logrus v1.0.5
github.com/xenolf/lego 7fedfd1
golang.org/x/crypto ab89591
golang.org/x/sys f845067
gopkg.in/ini.v1 e7fea39
gopkg.in/ns1/ns1-go.v2 c563826
gopkg.in/square/go-jose.v2 v2.1.6
2 changes: 1 addition & 1 deletion vendor/github.com/Azure/azure-sdk-for-go/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 24 additions & 22 deletions vendor/github.com/Azure/azure-sdk-for-go/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit eb89fad

Please sign in to comment.