Skip to content

Commit

Permalink
Update DNS Providers
Browse files Browse the repository at this point in the history
  • Loading branch information
vanbroup authored Jun 21, 2023
1 parent 225f39b commit d1760a0
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 44 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/dnsimple/dnsimple-go v0.71.1
github.com/entrustcorporation/entrust v0.0.0-20230314134457-b6b1cf0dd3bb
github.com/exoscale/egoscale v0.90.0
github.com/go-acme/lego/v4 v4.11.0
github.com/go-acme/lego/v4 v4.12.3
github.com/go-jose/go-jose/v3 v3.0.0
github.com/google/go-querystring v1.1.0
github.com/gophercloud/gophercloud v1.0.0
Expand Down Expand Up @@ -49,7 +49,7 @@ require (
github.com/sacloud/iaas-api-go v1.3.2
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9
github.com/simplesurance/bunny-go v0.0.0-20221115111006-e11d9dc91f04
github.com/sirupsen/logrus v1.9.0
github.com/sirupsen/logrus v1.9.3
github.com/softlayer/softlayer-go v1.0.6
github.com/stretchr/testify v1.8.1
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.490
Expand Down Expand Up @@ -121,7 +121,7 @@ require (
go.uber.org/ratelimit v0.2.0 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/go-acme/lego/v4 v4.11.0 h1:oIPoU7zBJoTfoVrbqk62+/2NsGCSgCVK1JtZSZZ28SU=
github.com/go-acme/lego/v4 v4.11.0/go.mod h1:dENL0J3/WughN2NLy0T35otK5k1EWCmXTwCw0+X5ZaE=
github.com/go-acme/lego/v4 v4.12.3 h1:aWPYhBopAZXWBASPgvi1LnWGrr5YiXOsrpVaFaVJipo=
github.com/go-acme/lego/v4 v4.12.3/go.mod h1:UZoOlhVmUYP/N0z4tEbfUjoCNHRZNObzqWZtT76DIsc=
github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs=
github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s=
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
Expand Down Expand Up @@ -486,6 +486,8 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w=
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9 h1:hp2CYQUINdZMHdvTdXtPOY2ainKl4IoMcpAXEf2xj3Q=
Expand Down Expand Up @@ -719,8 +721,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
6 changes: 2 additions & 4 deletions providers/autodns/autodns.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
Value: info.Value,
}}

// TODO(ldez) replace domain by FQDN to follow CNAME.
_, err := d.client.AddTxtRecords(context.Background(), domain, records)
_, err := d.client.AddTxtRecords(context.Background(), info.EffectiveFQDN, records)
if err != nil {
return fmt.Errorf("autodns: %w", err)
}
Expand All @@ -142,8 +141,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
Value: info.Value,
}}

// TODO(ldez) replace domain by FQDN to follow CNAME.
if err := d.client.RemoveTXTRecords(context.Background(), domain, records); err != nil {
if err := d.client.RemoveTXTRecords(context.Background(), info.EffectiveFQDN, records); err != nil {
return fmt.Errorf("autodns: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion providers/designate/designate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ For more information, you can read about the different methods of authentication

[Links]
API = "https://docs.openstack.org/designate/latest/"
GoClient = "https://godoc.org/github.com/gophercloud/gophercloud/openstack/dns/v2"
GoClient = "https://pkg.go.dev/github.com/gophercloud/gophercloud/openstack/dns/v2"
3 changes: 2 additions & 1 deletion providers/dnsmadeeasy/internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func (c *Client) GetRecords(ctx context.Context, domain *Domain, recordName, rec
query := endpoint.Query()
query.Set("recordName", recordName)
query.Set("type", recordType)
endpoint.RawQuery = query.Encode()

req, err := newJSONRequest(ctx, http.MethodGet, endpoint, nil)
if err != nil {
Expand Down Expand Up @@ -113,7 +114,7 @@ func (c *Client) CreateRecord(ctx context.Context, domain *Domain, record *Recor

// DeleteRecord deletes a TXT records.
func (c *Client) DeleteRecord(ctx context.Context, record Record) error {
endpoint := c.BaseURL.JoinPath("/dns/managed", strconv.Itoa(record.SourceID), "records", strconv.Itoa(record.ID))
endpoint := c.BaseURL.JoinPath("dns", "managed", strconv.Itoa(record.SourceID), "records", strconv.Itoa(record.ID))

req, err := newJSONRequest(ctx, http.MethodDelete, endpoint, nil)
if err != nil {
Expand Down
15 changes: 0 additions & 15 deletions providers/exec/exec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,4 @@ you can use the `--` delimiter to specify the start of positional arguments, and
| default | `myprogram cleanup -- <FQDN> <record>` |
| `RAW` | `myprogram cleanup -- <domain> <token> <key_auth>` |
### Timeout
The command have to display propagation timeout and polling interval into Stdout.
The values must be formatted as JSON, and times are in seconds.
Example: `{"timeout": 30, "interval": 5}`
If an error occurs or if the command is not provided:
the default display propagation timeout and polling interval are used.
| Mode | Command |
|---------|----------------------------------------------------|
| default | `myprogram timeout` |
| `RAW` | `myprogram timeout` |
'''
2 changes: 1 addition & 1 deletion providers/pdns/pdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
}

rec := internal.Record{
Content: "\"" + info.EffectiveFQDN + "\"",
Content: "\"" + info.Value + "\"",
Disabled: false,

// pre-v1 API
Expand Down
11 changes: 9 additions & 2 deletions providers/route53/route53.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const (
EnvHostedZoneID = envNamespace + "HOSTED_ZONE_ID"
EnvMaxRetries = envNamespace + "MAX_RETRIES"
EnvAssumeRoleArn = envNamespace + "ASSUME_ROLE_ARN"
EnvExternalID = envNamespace + "EXTERNAL_ID"

EnvTTL = envNamespace + "TTL"
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
Expand All @@ -48,6 +49,7 @@ type Config struct {
HostedZoneID string
MaxRetries int
AssumeRoleArn string
ExternalID string

TTL int
PropagationTimeout time.Duration
Expand All @@ -62,6 +64,7 @@ func NewDefaultConfig() *Config {
HostedZoneID: env.GetOrFile(EnvHostedZoneID),
MaxRetries: env.GetOrDefaultInt(EnvMaxRetries, 5),
AssumeRoleArn: env.GetOrDefaultString(EnvAssumeRoleArn, ""),
ExternalID: env.GetOrDefaultString(EnvExternalID, ""),

TTL: env.GetOrDefaultInt(EnvTTL, 10),
PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, 2*time.Minute),
Expand Down Expand Up @@ -337,8 +340,12 @@ func createSession(config *Config) (*session.Session, error) {
}

return session.NewSession(&aws.Config{
Region: sess.Config.Region,
Credentials: stscreds.NewCredentials(sess, config.AssumeRoleArn),
Region: sess.Config.Region,
Credentials: stscreds.NewCredentials(sess, config.AssumeRoleArn, func(arp *stscreds.AssumeRoleProvider) {
if config.ExternalID != "" {
arp.ExternalID = &config.ExternalID
}
}),
})
}

Expand Down
3 changes: 2 additions & 1 deletion providers/route53/route53.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ Replace `Z11111112222222333333` with your hosted zone ID and `example.com` with
AWS_HOSTED_ZONE_ID = "Override the hosted zone ID."
AWS_PROFILE = "Managed by the AWS client (`AWS_PROFILE_FILE` is not supported)"
AWS_SDK_LOAD_CONFIG = "Managed by the AWS client. Retrieve the region from the CLI config file (`AWS_SDK_LOAD_CONFIG_FILE` is not supported)"
AWS_ASSUME_ROLE_ARN = "Managed by the AWS Role ARN (`AWS_ASSUME_ROLE_ARN` is not supported)"
AWS_ASSUME_ROLE_ARN = "Managed by the AWS Role ARN (`AWS_ASSUME_ROLE_ARN_FILE` is not supported)"
AWS_EXTERNAL_ID = "Managed by STS AssumeRole API operation (`AWS_EXTERNAL_ID_FILE` is not supported)"
[Configuration.Additional]
AWS_SHARED_CREDENTIALS_FILE = "Managed by the AWS client. Shared credentials file."
AWS_MAX_RETRIES = "The number of maximum returns the service will use to make an individual API request"
Expand Down
14 changes: 2 additions & 12 deletions providers/websupport/websupport.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
return nil
}

err = internal.ParseError(resp)
if err != nil {
return fmt.Errorf("websupport: %w", err)
}

return nil
return fmt.Errorf("websupport: %w", internal.ParseError(resp))
}

// CleanUp removes the TXT record matching the specified parameters.
Expand Down Expand Up @@ -172,12 +167,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
return nil
}

err = internal.ParseError(resp)
if err != nil {
return fmt.Errorf("websupport: %w", err)
}

return nil
return fmt.Errorf("websupport: %w", internal.ParseError(resp))
}

// Timeout returns the timeout and interval to use when checking for DNS propagation.
Expand Down

0 comments on commit d1760a0

Please sign in to comment.