mirror of
https://github.com/go-acme/lego.git
synced 2024-12-23 01:07:23 +02:00
auroradns: update authentification (#1669)
This commit is contained in:
parent
f7d8c9668e
commit
6a53daad64
@ -214,8 +214,8 @@ func displayDNSHelp(name string) error {
|
||||
ew.writeln()
|
||||
|
||||
ew.writeln(`Credentials:`)
|
||||
ew.writeln(` - "AURORA_KEY": User API key`)
|
||||
ew.writeln(` - "AURORA_USER_ID": User ID`)
|
||||
ew.writeln(` - "AURORA_API_KEY": API key or username to used`)
|
||||
ew.writeln(` - "AURORA_SECRET": Secret password to be used`)
|
||||
ew.writeln()
|
||||
|
||||
ew.writeln(`Additional Configuration:`)
|
||||
|
@ -6,7 +6,7 @@ slug: auroradns
|
||||
dnsprovider:
|
||||
since: "v0.4.0"
|
||||
code: "auroradns"
|
||||
url: "https://www.pcextreme.com/aurora/dns"
|
||||
url: "https://www.pcextreme.com/dns-health-checks"
|
||||
---
|
||||
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
@ -14,7 +14,7 @@ dnsprovider:
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
|
||||
|
||||
Configuration for [Aurora DNS](https://www.pcextreme.com/aurora/dns).
|
||||
Configuration for [Aurora DNS](https://www.pcextreme.com/dns-health-checks).
|
||||
|
||||
|
||||
<!--more-->
|
||||
@ -26,8 +26,8 @@ Configuration for [Aurora DNS](https://www.pcextreme.com/aurora/dns).
|
||||
Here is an example bash command using the Aurora DNS provider:
|
||||
|
||||
```bash
|
||||
AURORA_USER_ID=xxxxx \
|
||||
AURORA_KEY=yyyyyy \
|
||||
AURORA_API_KEY=xxxxx \
|
||||
AURORA_SECRET_KEY=yyyyyy \
|
||||
lego --email you@example.com --dns auroradns --domains my.example.org run
|
||||
```
|
||||
|
||||
@ -38,8 +38,8 @@ lego --email you@example.com --dns auroradns --domains my.example.org run
|
||||
|
||||
| Environment Variable Name | Description |
|
||||
|-----------------------|-------------|
|
||||
| `AURORA_KEY` | User API key |
|
||||
| `AURORA_USER_ID` | User ID |
|
||||
| `AURORA_API_KEY` | API key or username to used |
|
||||
| `AURORA_SECRET` | Secret password to be used |
|
||||
|
||||
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
||||
More information [here]({{< ref "dns#configuration-and-credentials" >}}).
|
||||
|
8
go.mod
8
go.mod
@ -34,7 +34,7 @@ require (
|
||||
github.com/mimuret/golang-iij-dpf v0.7.1
|
||||
github.com/mitchellh/mapstructure v1.4.1
|
||||
github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04
|
||||
github.com/nrdcg/auroradns v1.0.1
|
||||
github.com/nrdcg/auroradns v1.1.0
|
||||
github.com/nrdcg/desec v0.6.0
|
||||
github.com/nrdcg/dnspod-go v0.4.0
|
||||
github.com/nrdcg/freemyip v0.2.0
|
||||
@ -48,7 +48,7 @@ require (
|
||||
github.com/sacloud/libsacloud v1.36.2
|
||||
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210127161313-bd30bebeac4f
|
||||
github.com/softlayer/softlayer-go v1.0.3
|
||||
github.com/stretchr/testify v1.7.1
|
||||
github.com/stretchr/testify v1.7.5
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.287
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.287
|
||||
github.com/transip/gotransip/v6 v6.6.1
|
||||
@ -110,7 +110,7 @@ require (
|
||||
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9 // indirect
|
||||
github.com/softlayer/xmlrpc v0.0.0-20200409220501-5f089df7cb7e // indirect
|
||||
github.com/spf13/cast v1.3.1 // indirect
|
||||
github.com/stretchr/objx v0.3.0 // indirect
|
||||
github.com/stretchr/objx v0.4.0 // indirect
|
||||
go.opencensus.io v0.22.3 // indirect
|
||||
go.uber.org/ratelimit v0.0.0-20180316092928-c15da0234277 // indirect
|
||||
golang.org/x/mod v0.4.2 // indirect
|
||||
@ -123,5 +123,5 @@ require (
|
||||
google.golang.org/grpc v1.27.1 // indirect
|
||||
google.golang.org/protobuf v1.27.1 // indirect
|
||||
gopkg.in/ini.v1 v1.62.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
13
go.sum
13
go.sum
@ -358,8 +358,8 @@ github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY
|
||||
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/nrdcg/auroradns v1.0.1 h1:m/kBq83Xvy3cU261MOknd8BdnOk12q4lAWM+kOdsC2Y=
|
||||
github.com/nrdcg/auroradns v1.0.1/go.mod h1:y4pc0i9QXYlFCWrhWrUSIETnZgrf4KuwjDIWmmXo3JI=
|
||||
github.com/nrdcg/auroradns v1.1.0 h1:KekGh8kmf2MNwqZVVYo/fw/ZONt8QMEmbMFOeljteWo=
|
||||
github.com/nrdcg/auroradns v1.1.0/go.mod h1:O7tViUZbAcnykVnrGkXzIJTHoQCHcgalgAe6X1mzHfk=
|
||||
github.com/nrdcg/desec v0.6.0 h1:kZ9JtsYEW3LNfuPIM+2tXoxoQlF9koWfQTWTQsA7Sr8=
|
||||
github.com/nrdcg/desec v0.6.0/go.mod h1:wybWg5cRrNmtXLYpUCPCLvz4jfFNEGZQEnoUiX9WqcY=
|
||||
github.com/nrdcg/dnspod-go v0.4.0 h1:c/jn1mLZNKF3/osJ6mz3QPxTudvPArXTjpkmYj0uK6U=
|
||||
@ -473,15 +473,17 @@ github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q
|
||||
github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As=
|
||||
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.5 h1:s5PTfem8p8EbKQOctVV53k6jCJt3UX4IEJzwh+C324Q=
|
||||
github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.287 h1:ohsyW4WffPdd2JLPio2Sd0qGr93hzkawAt9vWdCFLgY=
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.287/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
|
||||
@ -821,8 +823,9 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
@ -18,8 +18,8 @@ const defaultBaseURL = "https://api.auroradns.eu"
|
||||
const (
|
||||
envNamespace = "AURORA_"
|
||||
|
||||
EnvUserID = envNamespace + "USER_ID"
|
||||
EnvKey = envNamespace + "KEY"
|
||||
EnvAPIKey = envNamespace + "API_KEY"
|
||||
EnvSecret = envNamespace + "SECRET"
|
||||
EnvEndpoint = envNamespace + "ENDPOINT"
|
||||
|
||||
EnvTTL = envNamespace + "TTL"
|
||||
@ -30,8 +30,8 @@ const (
|
||||
// Config is used to configure the creation of the DNSProvider.
|
||||
type Config struct {
|
||||
BaseURL string
|
||||
UserID string
|
||||
Key string
|
||||
APIKey string
|
||||
Secret string
|
||||
PropagationTimeout time.Duration
|
||||
PollingInterval time.Duration
|
||||
TTL int
|
||||
@ -56,17 +56,17 @@ type DNSProvider struct {
|
||||
|
||||
// NewDNSProvider returns a DNSProvider instance configured for AuroraDNS.
|
||||
// Credentials must be passed in the environment variables:
|
||||
// AURORA_USER_ID and AURORA_KEY.
|
||||
// AURORA_API_KEY and AURORA_SECRET.
|
||||
func NewDNSProvider() (*DNSProvider, error) {
|
||||
values, err := env.Get(EnvUserID, EnvKey)
|
||||
values, err := env.Get(EnvAPIKey, EnvSecret)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("aurora: %w", err)
|
||||
}
|
||||
|
||||
config := NewDefaultConfig()
|
||||
config.BaseURL = env.GetOrFile(EnvEndpoint)
|
||||
config.UserID = values[EnvUserID]
|
||||
config.Key = values[EnvKey]
|
||||
config.APIKey = values[EnvAPIKey]
|
||||
config.Secret = values[EnvSecret]
|
||||
|
||||
return NewDNSProviderConfig(config)
|
||||
}
|
||||
@ -77,7 +77,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
||||
return nil, errors.New("aurora: the configuration of the DNS provider is nil")
|
||||
}
|
||||
|
||||
if config.UserID == "" || config.Key == "" {
|
||||
if config.APIKey == "" || config.Secret == "" {
|
||||
return nil, errors.New("aurora: some credentials information are missing")
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
||||
config.BaseURL = defaultBaseURL
|
||||
}
|
||||
|
||||
tr, err := auroradns.NewTokenTransport(config.UserID, config.Key)
|
||||
tr, err := auroradns.NewTokenTransport(config.APIKey, config.Secret)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("aurora: %w", err)
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
Name = "Aurora DNS"
|
||||
Description = ''''''
|
||||
URL = "https://www.pcextreme.com/aurora/dns"
|
||||
URL = "https://www.pcextreme.com/dns-health-checks"
|
||||
Code = "auroradns"
|
||||
Since = "v0.4.0"
|
||||
|
||||
Example = '''
|
||||
AURORA_USER_ID=xxxxx \
|
||||
AURORA_KEY=yyyyyy \
|
||||
AURORA_API_KEY=xxxxx \
|
||||
AURORA_SECRET=yyyyyy \
|
||||
lego --email you@example.com --dns auroradns --domains my.example.org run
|
||||
'''
|
||||
|
||||
[Configuration]
|
||||
[Configuration.Credentials]
|
||||
AURORA_USER_ID = "User ID"
|
||||
AURORA_KEY = "User API key"
|
||||
AURORA_API_KEY = "API key or username to used"
|
||||
AURORA_SECRET = "Secret password to be used"
|
||||
[Configuration.Additional]
|
||||
AURORA_ENDPOINT = "API endpoint URL"
|
||||
AURORA_POLLING_INTERVAL = "Time between DNS propagation check"
|
||||
|
@ -12,9 +12,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var envTest = tester.NewEnvTest(
|
||||
EnvUserID,
|
||||
EnvKey)
|
||||
var envTest = tester.NewEnvTest(EnvAPIKey, EnvSecret)
|
||||
|
||||
func setupTest(t *testing.T) (*DNSProvider, *http.ServeMux) {
|
||||
t.Helper()
|
||||
@ -24,8 +22,8 @@ func setupTest(t *testing.T) (*DNSProvider, *http.ServeMux) {
|
||||
t.Cleanup(server.Close)
|
||||
|
||||
config := NewDefaultConfig()
|
||||
config.UserID = "asdf1234"
|
||||
config.Key = "key"
|
||||
config.APIKey = "asdf1234"
|
||||
config.Secret = "key"
|
||||
config.BaseURL = server.URL
|
||||
|
||||
provider, err := NewDNSProviderConfig(config)
|
||||
@ -43,33 +41,33 @@ func TestNewDNSProvider(t *testing.T) {
|
||||
{
|
||||
desc: "success",
|
||||
envVars: map[string]string{
|
||||
EnvUserID: "123",
|
||||
EnvKey: "456",
|
||||
EnvAPIKey: "123",
|
||||
EnvSecret: "456",
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "missing credentials",
|
||||
envVars: map[string]string{
|
||||
EnvUserID: "",
|
||||
EnvKey: "",
|
||||
EnvAPIKey: "",
|
||||
EnvSecret: "",
|
||||
},
|
||||
expected: "aurora: some credentials information are missing: AURORA_USER_ID,AURORA_KEY",
|
||||
expected: "aurora: some credentials information are missing: AURORA_API_KEY,AURORA_SECRET",
|
||||
},
|
||||
{
|
||||
desc: "missing user id",
|
||||
desc: "missing api key",
|
||||
envVars: map[string]string{
|
||||
EnvUserID: "",
|
||||
EnvKey: "456",
|
||||
EnvAPIKey: "",
|
||||
EnvSecret: "456",
|
||||
},
|
||||
expected: "aurora: some credentials information are missing: AURORA_USER_ID",
|
||||
expected: "aurora: some credentials information are missing: AURORA_API_KEY",
|
||||
},
|
||||
{
|
||||
desc: "missing key",
|
||||
desc: "missing secret key",
|
||||
envVars: map[string]string{
|
||||
EnvUserID: "123",
|
||||
EnvKey: "",
|
||||
EnvAPIKey: "123",
|
||||
EnvSecret: "",
|
||||
},
|
||||
expected: "aurora: some credentials information are missing: AURORA_KEY",
|
||||
expected: "aurora: some credentials information are missing: AURORA_SECRET",
|
||||
},
|
||||
}
|
||||
|
||||
@ -97,31 +95,31 @@ func TestNewDNSProvider(t *testing.T) {
|
||||
func TestNewDNSProviderConfig(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
userID string
|
||||
key string
|
||||
apiKey string
|
||||
secret string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
desc: "success",
|
||||
userID: "123",
|
||||
key: "456",
|
||||
apiKey: "123",
|
||||
secret: "456",
|
||||
},
|
||||
{
|
||||
desc: "missing credentials",
|
||||
userID: "",
|
||||
key: "",
|
||||
apiKey: "",
|
||||
secret: "",
|
||||
expected: "aurora: some credentials information are missing",
|
||||
},
|
||||
{
|
||||
desc: "missing user id",
|
||||
userID: "",
|
||||
key: "456",
|
||||
apiKey: "",
|
||||
secret: "456",
|
||||
expected: "aurora: some credentials information are missing",
|
||||
},
|
||||
{
|
||||
desc: "missing key",
|
||||
userID: "123",
|
||||
key: "",
|
||||
apiKey: "123",
|
||||
secret: "",
|
||||
expected: "aurora: some credentials information are missing",
|
||||
},
|
||||
}
|
||||
@ -129,8 +127,8 @@ func TestNewDNSProviderConfig(t *testing.T) {
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
config := NewDefaultConfig()
|
||||
config.UserID = test.userID
|
||||
config.Key = test.key
|
||||
config.APIKey = test.apiKey
|
||||
config.Secret = test.secret
|
||||
|
||||
p, err := NewDNSProviderConfig(config)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user