Skip to content

Commit

Permalink
Add Dyn DNS provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Broer committed Mar 30, 2016
1 parent 1922446 commit 46f12b3
Show file tree
Hide file tree
Showing 4 changed files with 301 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Godeps/Godeps.json

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

264 changes: 264 additions & 0 deletions Godeps/_workspace/src/github.com/xenolf/lego/providers/dns/dyn/dyn.go

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

3 changes: 3 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ func (c *Context) InitContext() {
AwsSecretKey: os.Getenv("AWS_SECRET_KEY"),
DNSimpleEmail: os.Getenv("DNSIMPLE_EMAIL"),
DNSimpleKey: os.Getenv("DNSIMPLE_KEY"),
DynCustomerName: os.Getenv("DYN_CUSTOMER_NAME"),
DynUserName: os.Getenv("DYN_USER_NAME"),
DynPassword: os.Getenv("DYN_PASSWORD"),
AwsRegionName: "us-east-1",
}

Expand Down
30 changes: 29 additions & 1 deletion letsencrypt/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/xenolf/lego/providers/dns/cloudflare"
"github.com/xenolf/lego/providers/dns/digitalocean"
"github.com/xenolf/lego/providers/dns/dnsimple"
"github.com/xenolf/lego/providers/dns/dyn"
"github.com/xenolf/lego/providers/dns/route53"
)

Expand All @@ -31,6 +32,11 @@ type ProviderOpts struct {
// DNSimple credentials
DNSimpleEmail string
DNSimpleKey string

// Dyn credentials
DynCustomerName string
DynUserName string
DynPassword string
}

type DnsProvider string
Expand All @@ -40,13 +46,15 @@ const (
DIGITALOCEAN = DnsProvider("DigitalOcean")
ROUTE53 = DnsProvider("Route53")
DNSIMPLE = DnsProvider("DNSimple")
DYN = DnsProvider("Dyn")
)

var dnsProviderFactory = map[DnsProvider]interface{}{
CLOUDFLARE: makeCloudflareProvider,
DIGITALOCEAN: makeDigitalOceanProvider,
ROUTE53: makeRoute53Provider,
DNSIMPLE: makeDNSimpleProvider,
DYN: makeDynProvider,
}

func getProvider(opts ProviderOpts) (lego.ChallengeProvider, error) {
Expand Down Expand Up @@ -115,7 +123,7 @@ func makeRoute53Provider(opts ProviderOpts) (lego.ChallengeProvider, error) {
// returns a preconfigured DNSimple lego.ChallengeProvider
func makeDNSimpleProvider(opts ProviderOpts) (lego.ChallengeProvider, error) {
if len(opts.DNSimpleEmail) == 0 {
return nil, fmt.Errorf("DNSimple Email not set")
return nil, fmt.Errorf("DNSimple Email is not set")
}
if len(opts.DNSimpleKey) == 0 {
return nil, fmt.Errorf("DNSimple API key is not set")
Expand All @@ -127,3 +135,23 @@ func makeDNSimpleProvider(opts ProviderOpts) (lego.ChallengeProvider, error) {
}
return provider, nil
}

// returns a preconfigured Dyn lego.ChallengeProvider
func makeDynProvider(opts ProviderOpts) (lego.ChallengeProvider, error) {
if len(opts.DynCustomerName) == 0 {
return nil, fmt.Errorf("Dyn customer name is not set")
}
if len(opts.DynUserName) == 0 {
return nil, fmt.Errorf("Dyn user name is not set")
}
if len(opts.DynPassword) == 0 {
return nil, fmt.Errorf("Dyn password is not set")
}

provider, err := dyn.NewDNSProviderCredentials(opts.DynCustomerName,
opts.DynUserName, opts.DynPassword)
if err != nil {
return nil, err
}
return provider, nil
}

0 comments on commit 46f12b3

Please sign in to comment.