Skip to content

Commit

Permalink
Merge pull request #41 from edeckers/add-auroradns
Browse files Browse the repository at this point in the history
Add support for AuroraDNS
  • Loading branch information
janeczku authored Feb 7, 2017
2 parents b4ef8ae + e373445 commit b7293e3
Show file tree
Hide file tree
Showing 21 changed files with 1,361 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ RUN tar -zxvf /tmp/rancher-letsencrypt.tar.gz -C /usr/bin \
&& chmod +x /usr/bin/rancher-letsencrypt

ENTRYPOINT ["/usr/bin/rancher-letsencrypt"]
EXPOSE 80
EXPOSE 80
36 changes: 36 additions & 0 deletions Godeps/Godeps.json

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

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ A [Rancher](http://rancher.com/rancher/) service that obtains free SSL/TLS certi
#### Requirements
* Rancher Server >= v1.2.0
* If using a DNS-based challenge, existing account with one of the supported DNS providers:
* `Aurora DNS`
* `AWS Route 53`
* `Azure DNS`
* `CloudFlare`
Expand Down
3 changes: 3 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ func (c *Context) InitContext() {
AzureSubscriptionId: getEnvOption("AZURE_SUBSCRIPTION_ID", false),
AzureTenantId: getEnvOption("AZURE_TENANT_ID", false),
AzureResourceGroup: getEnvOption("AZURE_RESOURCE_GROUP", false),
AuroraUserId: getEnvOption("AURORA_USER_ID", false),
AuroraKey: getEnvOption("AURORA_KEY", false),
AuroraEndpoint: getEnvOption("AURORA_ENDPOINT", false),
CloudflareEmail: getEnvOption("CLOUDFLARE_EMAIL", false),
CloudflareKey: getEnvOption("CLOUDFLARE_KEY", false),
DoAccessToken: getEnvOption("DO_ACCESS_TOKEN", false),
Expand Down
33 changes: 33 additions & 0 deletions letsencrypt/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"

lego "github.com/xenolf/lego/acme"
"github.com/xenolf/lego/providers/dns/auroradns"
"github.com/xenolf/lego/providers/dns/azure"
"github.com/xenolf/lego/providers/dns/cloudflare"
"github.com/xenolf/lego/providers/dns/digitalocean"
Expand All @@ -22,6 +23,11 @@ import (
type ProviderOpts struct {
Provider Provider

// Aurora credentials
AuroraUserId string
AuroraKey string
AuroraEndpoint string

// AWS Route 53 credentials
AwsAccessKey string
AwsSecretKey string
Expand Down Expand Up @@ -67,6 +73,7 @@ type ProviderOpts struct {
type Provider string

const (
AURORA = Provider("Aurora")
AZURE = Provider("Azure")
CLOUDFLARE = Provider("CloudFlare")
DIGITALOCEAN = Provider("DigitalOcean")
Expand All @@ -86,6 +93,7 @@ type ProviderFactory struct {
}

var providerFactory = map[Provider]ProviderFactory{
AURORA: ProviderFactory{makeAuroraProvider, lego.DNS01},
AZURE: ProviderFactory{makeAzureProvider, lego.DNS01},
CLOUDFLARE: ProviderFactory{makeCloudflareProvider, lego.DNS01},
DIGITALOCEAN: ProviderFactory{makeDigitalOceanProvider, lego.DNS01},
Expand All @@ -111,6 +119,31 @@ func getProvider(opts ProviderOpts) (lego.ChallengeProvider, lego.Challenge, err
return nil, irrelevant, fmt.Errorf("Unsupported provider: %s", opts.Provider)
}

// returns a preconfigured Aurora lego.ChallengeProvider
func makeAuroraProvider(opts ProviderOpts) (lego.ChallengeProvider, error) {
if len(opts.AuroraUserId) == 0 {
return nil, fmt.Errorf("Aurora User Id is not set")
}

if len(opts.AuroraKey) == 0 {
return nil, fmt.Errorf("Aurora Key is not set")
}

endpoint := opts.AuroraEndpoint
if len(endpoint) == 0 {
endpoint = "https://api.auroradns.eu"
}

provider, err := auroradns.NewDNSProviderCredentials(endpoint, opts.AuroraUserId,
opts.AuroraKey)

if err != nil {
return nil, err
}

return provider, nil
}

// returns a preconfigured CloudFlare lego.ChallengeProvider
func makeCloudflareProvider(opts ProviderOpts) (lego.ChallengeProvider, error) {
if len(opts.CloudflareEmail) == 0 {
Expand Down
4 changes: 4 additions & 0 deletions vendor/github.com/edeckers/auroradnsclient/.gitignore

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

12 changes: 12 additions & 0 deletions vendor/github.com/edeckers/auroradnsclient/.travis.yml

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

Loading

0 comments on commit b7293e3

Please sign in to comment.