Skip to content

Commit

Permalink
deps: Update dependencies and golang version
Browse files Browse the repository at this point in the history
  • Loading branch information
project0 committed Mar 6, 2023
1 parent 0d9ea1e commit d984cdc
Show file tree
Hide file tree
Showing 9 changed files with 288 additions and 786 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18 as builder
FROM golang:1.20 as builder

WORKDIR /go/src/github.com/project0/certjunkie/

Expand Down
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewApiServer(listen string, store *certstore.CertStore) {
r.HandleFunc("/cert/{domain}/key", apiCert.getKey).Methods(http.MethodGet)
r.HandleFunc("/cert/{domain}/bundle", apiCert.getBundle).Methods(http.MethodGet)

log.Info().Msgf("Start listening http server on %s", listen)
log.Info().Str("addr", listen).Msg("Start http server")
go func() {
err := http.ListenAndServe(listen, handlers.LoggingHandler(log.With().Str("component", "api_requests").Logger(), r))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion api/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (a *apiCert) certRequest(w http.ResponseWriter, r *http.Request) *certstore
var err error
vars := mux.Vars(r)
if vars["domain"] == "" {
http.Error(w, fmt.Sprintf("Domain name %s is not valid", vars["domain"]), http.StatusBadRequest)
http.Error(w, fmt.Sprintf("Domain name %q is not valid", vars["domain"]), http.StatusBadRequest)
return nil
}
query := r.URL.Query()
Expand Down
4 changes: 2 additions & 2 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (c *Client) Get(domain string, san []string, onlyCN bool, valid int) (cert

if resp.StatusCode != http.StatusOK {
respBody, _ := ioutil.ReadAll(resp.Body)
return nil, fmt.Errorf("Failed to retrieve cert: %s", string(respBody))
return nil, fmt.Errorf("failed to retrieve cert: %s", string(respBody))
}

cert = &certstore.CertificateResource{}
Expand All @@ -69,7 +69,7 @@ func (c *Client) WriteBundle(cert *certstore.CertificateResource, filepath strin
return c.writeFile(append(cert.GetNoBundleCertificate(), cert.IssuerCertificate...), filepath)
}

// WriteKey writes the privte key to file
// WriteKey writes the private key to file
func (c *Client) WriteKey(cert *certstore.CertificateResource, filepath string) (err error) {
return c.writeFile(cert.PrivateKey, filepath)
}
Expand Down
7 changes: 4 additions & 3 deletions certstore/certstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"crypto/rsa"
"crypto/x509"
"encoding/json"
"fmt"
"sync"

"github.com/rs/zerolog/log"
Expand Down Expand Up @@ -170,7 +171,7 @@ func (c *CertStore) GetCertificate(request *CertRequest) (*CertificateResource,
}
acmeCerts, err := c.client.Certificate.Obtain(req)
if err != nil {
return nil, err
return nil, fmt.Errorf("unable to obtain new certificate: %v", err)
}

// create our own cert resource
Expand Down Expand Up @@ -217,13 +218,13 @@ func (c *CertStore) findStoredCert(r *CertRequest) (*CertificateResource, error)
for _, pair := range list {
cert := new(CertificateResource)
if err := json.Unmarshal(pair.Value, cert); err != nil {
log.Printf("Could not decode json from %s", pair.Key)
log.Err(err).Str("cert_key", pair.Key).Msg("Could not decode json from store")
continue
}

ok, err := r.matchCertificate(cert)
if err != nil {
log.Print(err)
log.Err(err).Msg("Unable to find check matched certificate")
continue
}
if ok {
Expand Down
2 changes: 1 addition & 1 deletion certstore/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (r *CertRequest) matchCertificate(cert *CertificateResource) (bool, error)
return true, nil
}
// cert is expired
log.Printf("certificate is valid until %s but needs to be valid for %d days", certInfo.NotAfter, r.ValidDays)
log.Info().Msgf("certificate is valid until %s but needs to be valid for %d days", certInfo.NotAfter, r.ValidDays)
return false, nil
}

Expand Down
140 changes: 77 additions & 63 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,133 +1,147 @@
module github.com/project0/certjunkie

go 1.18
go 1.20

require (
github.com/docker/libkv v0.2.1
github.com/go-acme/lego/v4 v4.7.0
github.com/go-acme/lego/v4 v4.10.2
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/miekg/dns v1.1.49
github.com/stretchr/testify v1.7.2
github.com/urfave/cli/v2 v2.8.1
github.com/miekg/dns v1.1.51
github.com/stretchr/testify v1.8.2
github.com/urfave/cli/v2 v2.25.0
)

require github.com/cloudflare/cloudflare-go v0.49.0 // indirect

require (
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mimuret/golang-iij-dpf v0.7.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/civo/civogo v0.3.24 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mimuret/golang-iij-dpf v0.9.1 // indirect
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
github.com/sacloud/api-client-go v0.2.6 // indirect
github.com/sacloud/go-http v0.1.4 // indirect
github.com/sacloud/iaas-api-go v1.8.3 // indirect
github.com/sacloud/packages-go v0.0.7 // indirect
github.com/ultradns/ultradns-go-sdk v1.4.1-20230224143201-0d8b0f6 // indirect
github.com/yandex-cloud/go-genproto v0.0.0-20230227093831-780473185775 // indirect
github.com/yandex-cloud/go-sdk v0.0.0-20230227095001-b676d5d7bc73 // indirect
)

require (
cloud.google.com/go/compute v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go v65.0.0+incompatible // indirect
cloud.google.com/go/compute v1.18.0 // indirect
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
github.com/Azure/go-autorest/autorest v0.11.28 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.22 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87 // indirect
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.1.1 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1641 // indirect
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.62.218 // indirect
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
github.com/aws/aws-sdk-go v1.44.36 // indirect
github.com/aws/aws-sdk-go v1.44.214 // indirect
github.com/boombuler/barcode v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cloudflare/cloudflare-go v0.41.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/cpu/goacmedns v0.1.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deepmap/oapi-codegen v1.11.0 // indirect
github.com/deepmap/oapi-codegen v1.12.4 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/dnsimple/dnsimple-go v0.71.1 // indirect
github.com/exoscale/egoscale v0.89.0 // indirect
github.com/dnsimple/dnsimple-go v1.2.0 // indirect
github.com/exoscale/egoscale v0.97.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-resty/resty/v2 v2.7.0 // indirect
github.com/gofrs/uuid v4.2.0+incompatible // indirect
github.com/golang-jwt/jwt/v4 v4.4.1 // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/gophercloud/gophercloud v0.25.0 // indirect
github.com/gophercloud/utils v0.0.0-20220307143606-8e7800759d16 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/gophercloud/gophercloud v1.2.0 // indirect
github.com/gophercloud/utils v0.0.0-20230301065655-769528992f29 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df // indirect
github.com/infobloxopen/infoblox-go-client v1.1.1 // indirect
github.com/jarcoal/httpmock v1.2.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213 // indirect
github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b // indirect
github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b // indirect
github.com/labbsr0x/bindman-dns-webhook v1.0.2 // indirect
github.com/labbsr0x/goh v1.0.1 // indirect
github.com/linode/linodego v1.8.0 // indirect
github.com/linode/linodego v1.14.1 // indirect
github.com/liquidweb/go-lwApi v0.0.5 // indirect
github.com/liquidweb/liquidweb-cli v0.6.10 // indirect
github.com/liquidweb/liquidweb-go v1.6.3 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04 // indirect
github.com/nrdcg/auroradns v1.0.1 // indirect
github.com/nrdcg/desec v0.6.0 // indirect
github.com/nrdcg/auroradns v1.1.0 // indirect
github.com/nrdcg/desec v0.7.0 // indirect
github.com/nrdcg/dnspod-go v0.4.0 // indirect
github.com/nrdcg/freemyip v0.2.0 // indirect
github.com/nrdcg/goinwx v0.8.1 // indirect
github.com/nrdcg/goinwx v0.8.2 // indirect
github.com/nrdcg/namesilo v0.2.1 // indirect
github.com/nrdcg/porkbun v0.1.1 // indirect
github.com/nrdcg/porkbun v0.2.0 // indirect
github.com/oracle/oci-go-sdk v24.3.0+incompatible // indirect
github.com/ovh/go-ovh v1.1.0 // indirect
github.com/ovh/go-ovh v1.3.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/otp v1.3.0 // indirect
github.com/rs/zerolog v1.27.0
github.com/pquerna/otp v1.4.0 // indirect
github.com/rs/zerolog v1.29.0
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sacloud/libsacloud v1.36.2 // indirect
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9 // indirect
github.com/softlayer/softlayer-go v1.0.6 // indirect
github.com/softlayer/softlayer-go v1.1.2 // indirect
github.com/softlayer/xmlrpc v0.0.0-20200409220501-5f089df7cb7e // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.422 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.422 // indirect
github.com/transip/gotransip/v6 v6.17.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.609 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.609 // indirect
github.com/transip/gotransip/v6 v6.19.1 // indirect
github.com/vinyldns/go-vinyldns v0.9.16 // indirect
github.com/vultr/govultr/v2 v2.17.2 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.opencensus.io v0.23.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/ratelimit v0.2.0 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.0.0-20220615171555-694bf12d69de // indirect
golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb // indirect
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
golang.org/x/tools v0.1.11 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
google.golang.org/api v0.84.0 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/api v0.111.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90 // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/ns1/ns1-go.v2 v2.6.5 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/ns1/ns1-go.v2 v2.7.4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit d984cdc

Please sign in to comment.