Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Linode DNS Support #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ A [Rancher](http://rancher.com/rancher/) service that obtains free SSL/TLS certi
* `DNSimple`
* `Dyn`
* `Gandi`
* `Linode`
* `NS1`
* `Ovh`
* `Vultr`
Expand Down Expand Up @@ -165,6 +166,8 @@ Then make sure that HTTP requests to `domain.com/.well-known/acme-challenge` are

`make build && make image`

This project uses [trash](https://github.com/rancher/trash) to manage dependencies.

### Contributions

PR's welcome!
1 change: 1 addition & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func (c *Context) InitContext() {
OvhConsumerKey: getEnvOption("OVH_CONSUMER_KEY", false),
GandiApiKey: getEnvOption("GANDI_API_KEY", false),
NS1ApiKey: getEnvOption("NS1_API_KEY", false),
LinodeApiKey: getEnvOption("LINODE_API_KEY", false),
}

c.Acme, err = letsencrypt.NewClient(emailParam, keyType, apiVersion, dnsResolvers, providerOpts)
Expand Down
2 changes: 1 addition & 1 deletion letsencrypt/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
const (
StorageDir = "/etc/letsencrypt"
ProductionApiUri = "https://acme-v02.api.letsencrypt.org/directory"
StagingApiUri = "https://acme-staging.api.letsencrypt.org/directory"
StagingApiUri = "https://acme-staging-v02.api.letsencrypt.org/directory"
)

type KeyType string
Expand Down
19 changes: 19 additions & 0 deletions letsencrypt/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/xenolf/lego/providers/dns/dnsimple"
"github.com/xenolf/lego/providers/dns/dyn"
"github.com/xenolf/lego/providers/dns/gandi"
"github.com/xenolf/lego/providers/dns/linode"
"github.com/xenolf/lego/providers/dns/ns1"
"github.com/xenolf/lego/providers/dns/ovh"
"github.com/xenolf/lego/providers/dns/route53"
Expand Down Expand Up @@ -58,6 +59,9 @@ type ProviderOpts struct {
// Gandi credentials
GandiApiKey string

// Linode credentials
LinodeApiKey string

// NS1 credentials
NS1ApiKey string

Expand All @@ -80,6 +84,7 @@ const (
DNSIMPLE = Provider("DNSimple")
DYN = Provider("Dyn")
GANDI = Provider("Gandi")
LINODE = Provider("Linode")
NS1 = Provider("NS1")
OVH = Provider("Ovh")
ROUTE53 = Provider("Route53")
Expand All @@ -100,6 +105,7 @@ var providerFactory = map[Provider]ProviderFactory{
DNSIMPLE: ProviderFactory{makeDNSimpleProvider, lego.DNS01},
DYN: ProviderFactory{makeDynProvider, lego.DNS01},
GANDI: ProviderFactory{makeGandiProvider, lego.DNS01},
LINODE: ProviderFactory{makeLinodeProvider, lego.DNS01},
NS1: ProviderFactory{makeNS1Provider, lego.DNS01},
OVH: ProviderFactory{makeOvhProvider, lego.DNS01},
ROUTE53: ProviderFactory{makeRoute53Provider, lego.DNS01},
Expand Down Expand Up @@ -273,6 +279,19 @@ func makeGandiProvider(opts ProviderOpts) (lego.ChallengeProvider, error) {
return provider, nil
}

// returns a preconfigured Linode lego.ChallengeProvider
func makeLinodeProvider(opts ProviderOpts) (lego.ChallengeProvider, error) {
if len(opts.LinodeApiKey) == 0 {
return nil, fmt.Errorf("Linode API key is not set")
}

provider, err := linode.NewDNSProviderCredentials(opts.LinodeApiKey)
if err != nil {
return nil, err
}
return provider, nil
}

// returns a preconfigured HTTP lego.ChallengeProvider
func makeHTTPProvider(opts ProviderOpts) (lego.ChallengeProvider, error) {
provider := lego.NewHTTPProviderServer("", "")
Expand Down
1 change: 1 addition & 0 deletions vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ 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/timewasted/linode/dns 37e8452
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that here it is need writing a path to github.com/timewasted/linode because this package whole used in file github.com/timewasted/linode/dns/dns.go.
Also I saw dependencies for this package:

  • github.com/davecgh/go-spew/
  • github.com/stretchr/testify/

These packages also need add to vendor.conf and to git commit.

github.com/xenolf/lego 7fedfd1
golang.org/x/crypto ab89591
golang.org/x/sys f845067
Expand Down
69 changes: 69 additions & 0 deletions vendor/github.com/timewasted/linode/dns/dns.go

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

63 changes: 63 additions & 0 deletions vendor/github.com/timewasted/linode/dns/domain.go

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

Loading