Commit graph

93 commits

Author SHA1 Message Date
PJ Eby a3ef53574c
Support RFC 7505 "null MX" (#702) (#703)
* Fix #702: Spurious null MX changes on CloudFlare

* Test roundtripping null MX on Cloudflare

* Use an if instead of TrimSuffix

* Add other providers that support RFC 7505

* Suppress test for non-compliant providers
2020-03-25 09:53:28 -04:00
Tom Limoncelli 1b5935d1af
Release 3.0.0 Candidate (#699)
Final changes before V3.0.0 release

* Remove old Gandi.  Fixes #575
* Many cleanups
* go mod tidy && go mod vendor

* integration_test.go: Output subtest name

* Cleanups

* integration_test.go: Description should include sub-test name
* Add a whitespace test to js/parse_tests/017-txt.js

* Cloudflare strips whitespace from end of TXT

* Fixes https://github.com/StackExchange/dnscontrol/issues/700

* Whitespace at end of TXT records

Name.com strips the whitespace from the end of a TXT record. There's
nothing we can do other than file a bug.

* Fixes https://github.com/StackExchange/dnscontrol/issues/701
2020-03-22 13:38:37 -04:00
Tom Limoncelli 14e48b9b07
linting (#693)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2020-03-10 16:53:17 -04:00
Tom Limoncelli 67e78f7e15
refactor into groups (#684)
* Refactor tests into "groups", each with its own filter (not/only/requires) to select which providers are appropriate.
* Test driver code is now a lot more simple and clear.
* Add support for not(), only(), and requires() as a way to select/reject providers for a test.
* Add docs explaining how to add tests
* Logging messages are much cleaner now, especially when tests are skipped.
* -start and -end now refer to test groups, not individual tests.  Log messages list the group numbers clearly.
* Add stringer for Capabilities
* Change the order of the tests so that simple tests are first
* Removed knownFailures from providers.json
* fmtjson providers.json

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2020-03-10 10:13:20 -04:00
Vatsalya Goel 884118f6dd
AZURE_DNS: Add support for Alias: AZURE_ALIAS() (#675)
* Add support for Alias in Azure

* Actioned comments and added parse tests

* GetTargetDebug

* Go formatting
2020-03-02 11:25:42 -05:00
Brice Figureau e082c74de2
(#667) Remove unneeded SSHFP integration test (#677)
The test 49 was changing the fingerprint type of a SSHFP DNS RR,
but not the fingerprint hash. Changing the type of hash function
changes the hash result size (there's only two defined hash type of
different size in the RFC, SHA-1 and SHA-256).
This was failing with the OVH provider, because OVH is validating
the hash sizes of any created SSHFP RR and was finding an inconsistency.
Since there's already the test 50 which is both changing the type
and the fingerprint, the functionality is still covered and we
can remove test 49.
2020-03-02 11:23:47 -05:00
Brice Figureau bdddd466bf
(#628) Add get-zones to the OVH provider (#666)
Commit 87ad01d added the very useful `get-zones` command, which
requires providers to implement a new method `GetZoneRecords`.
This changes make the OVH provider support this.
2020-02-28 11:14:02 -05:00
Joel Margolis a57bf35788
EXOSCALE: Update exoscale/egoscale client to v0.23.0 (#664)
* Update Exoscale provider

* Update vendor folder for exoscale/egoscale v0.23.0

* Fix typos and SRV parsing

* Add . at the end of SRV records for exoscale
2020-02-27 23:06:12 -05:00
Joel Margolis 1232c17293
HEXONET: Update hexonet-sdk to v2.2.3+incompatible (#662)
* Update hexonet-sdk to v2.2.3+incompatible

* Update vendor

* Go mod tidy
2020-02-27 13:04:17 -05:00
Tom Limoncelli 05cedab5a7
Remove test for empty TXT strings. (#633) 2020-02-18 15:24:04 -05:00
Tom Limoncelli e172df2817
Integration testing: Standardize "empty" usage (#612)
* All tests start with an "empty", not end.
* "empty" formatted the same way for all tests.
2020-01-30 10:05:37 -05:00
Patrick Gaskin 825ba2d081 Switch to Go 1.13 error wrapping (#604)
* Replaced errors.Wrap with fmt.Errorf (#589)

* Find:    errors\.Wrap\(([^,]+),\s+(["`][^"`]*)(["`])\)
  Replace: fmt.Errorf($2: %w$3, $1)

* Replaced errors.Wrapf with fmt.Errorf (#589)

* Find:    errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])\)
  Replace: fmt.Errorf($2: %w$3, $1)
* Find:    errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])(,[^)]+)\)
* Replace: fmt.Errorf($2: %w$3$4, $1)

* Replaced errors.Errorf with fmt.Errorf (#589)

* Find:    errors\.Errorf
  Replace: fmt.Errorf

* Cleaned up remaining imports

* Cleanup

* Regenerate provider support matrix

This was broken by #533 ... and it's now the third time this has been missed.
2020-01-28 11:06:56 -05:00
Patrick Gaskin 2f83aa9302 Internals: Switch to v2 go.mod, drop GOPATH, and fix Azure Pipelines (#595)
* Switched to v2 go.mod

Also set GO111MODULE=on in build stuff to always use Go modules
even when in GOPATH.

* Ensure go.mod, go.sum, and vendor are up to date

* Attempt to fix Azure pipelines

* Add set -e to properly fail on exit (it didn't seem to be
  propagating properly before).
* Set workingDirectory for GoFmt and GoGen (this might be why it
  fails unlike compile and unitests).

* Another attempt to fix Azure Pipelines

* Use the Go env template for all go-related jobs.

* Completely fixed Azure Pipelines

* Added a display name to GoFmt for consistency.
* Fixed diffs for GoFmt and GoGen.
* Show git status for checks.

* Drop GOPATH for tests

TODO: Do the same for integration tests.

* Drop GOPATH for integration tests

* Show more diffs

* Regenerate provider support matrix

This wasn't done in #590...
2020-01-28 10:42:31 -05:00
Juho Teperi bfa36ebbf8 DIGITALOCEAN: CAA is supported with some caveats (#592)
Change the tests to skip test case with CAA `;` value for Digitalocean,
because that specific feature isn't supported.

Closes #588
2020-01-24 12:21:01 -05:00
Tom Limoncelli d3dc5a5eb7
Integration test: Add test for TXT with null string (#597) 2020-01-24 12:10:27 -05:00
Tom Limoncelli f6ce421fdd
NEW PROVIDER: GANDI_V5 (deprecates GANDI) (#572)
* GANDI_v5: Add Registrar support
* Add GANDI deprecation warning
* vendor github.com/tiramiseb/go-gandi
2020-01-20 14:13:32 -05:00
Anton Yurchenko 253cd07154 NEW PROVIDER: ClouDNS (#578)
* ClouDNS: first version of provider
* ClouDNS: documentation
* ClouDNS: code cleanup
* ClouDNS: GetNameservers now uses ClouDNS API to fetch NS servers list
* ClouDNS: CAA support
* ClouDNS: TLSA support
* ClouDNS: tests credentials now use variables instead of hardcoded values
* ClouDNS: SSHFP support
* ClouDNS: export only necessary methods
2020-01-20 14:07:38 -05:00
Anton Yurchenko 35e37ff91f Use ns1.example.com, not ns1.otherdomain.tld, in integration tests 2020-01-14 18:19:53 -05:00
Tom Limoncelli 2c0361b0d5
BUG: Correctly spell Cabability (#582) 2020-01-12 11:24:10 -05:00
Tom Limoncelli eed8e43fbd CLOUDFLARE: Integration tests should use API Token, not user/key (#557)
* providers/cloudflare: Support API tokens

Cloudflare API tokens are a new way to authenticate to Cloudflare API.
Unlike the Global API key, tokens can be given specific permissions to
only access parts of the API. See [1] for details.

[1] https://blog.cloudflare.com/api-tokens-general-availability/

This commit introduces a new credential for cloudflare called
`apitoken`, which is mutually exclusive with `apiuser` and `apikey`.

In order for DNSControl to work with this token, it should have the
right to read DNS zones and edit DNS records.

Closes #534

* CLOUDFLARE: Update integration tests for api token
2019-12-09 14:04:52 -05:00
Patrick Gaskin 70ce16ff23 Fix handling of SRV records with no target (indicated by ".")
According to the RFC, the way to indicate that a SRV has no target is to set the target to ".".  Some providers do not handle this, or the API returns "" instead of ".".  This situation is now tested in the integration tests and all providers (that support this) have been fixed.



* Cloudflare: Fix decoding empty SRV target (fixes #561)

SRV records with empty (".") targets are now returned as false by
the API, which breaks Unmarshaling it into a string.

* Use custom type for Cloudflare SRV target

Rewrote the SRV target decoding to use a custom type for (un)marshaling, as
Cloudflare returns false for null targets, but it requires a single period
for giving it one. The target code has also been made more flexible to future
API changes with additional normalization.

This has been tested with record creation, deletion, and update and works
as of 2019-11-05.

* DigitalOcean: Fix target FQDN for null targets

Without this, dnscontrol thinks an update is needed (.. != .) even
when the SRV target is correct.

* DNSimple: Fix parsing of null SRV target

DNSimple only returns two fields when the target is null.

* NameDotCom: Add note about not supporting null SRV targets, skip test

* DNSimple: Do not append a . unless we have all three parts

Signed-off-by: Amelia Aronsohn <squirrel@wearing.black>

* Regenerated provider matrix
2019-11-14 11:25:20 -05:00
Vatsalya Goel 443401d2a7 Upgrade go version to 1.13 (#550)
Sustained Engineering
2019-10-05 10:45:57 -04:00
Vatsalya Goel 813a186865 Add Azure DNS (#547)
* Add Azure DNS

* Remove unused code

* Fix failing tests and update build
2019-09-18 21:45:13 -04:00
Craig Peterson 364aac5073 fix format 2019-06-27 01:21:23 -04:00
Craig Peterson 394b9ccf41
respect max batch size for r53 (#509) 2019-06-26 23:45:34 -04:00
Tom Limoncelli a5dcad06a3
Fix integration tests (NAMEDOTCOM, CLOUDFLARE) (#498)
NAMEDOTCOM: TXTMulti is broken. Disable.
CLOUDFLARE: Fix SSHFP tests.
2019-05-27 15:10:00 -04:00
Koen Vlaswinkel 5538de6682 IGNORE() now supports glob pattern/wildcards (#463) 2019-05-27 10:14:29 -04:00
Peter Dunaskin 7383751803 Fix integration test. 2019-04-17 11:23:32 +02:00
Peter Dunaskin 7566c0428e Attempt to add NAPTR support. 2019-03-28 15:40:13 +01:00
Pierre-Emmanuel Jacquier 511c0bf7de NEW PROVIDER: Exoscale (#390)
* Add exoscale provider

Signed-off-by: Pierre-Emmanuel Jacquier <pierre-emmanuel.jacquier@epitech.eu>

* Fix validation

Signed-off-by: Pierre-Emmanuel Jacquier <pierre-emmanuel.jacquier@epitech.eu>

* Fix DualProvider

Signed-off-by: Pierre-Emmanuel Jacquier <pierre-emmanuel.jacquier@epitech.eu>
2019-02-22 09:10:23 -05:00
Craig Peterson 9a6af836dc
Activedirectory: Full support for managing NS records. (#450)
* condense AD 'unsupported record type' warnings

* active directory provider can create/modify/delete NS records!

* ad passes more of the tests now

* skip root NS records for safety

* clarifying comment
2019-02-20 12:30:35 -05:00
karlism f9fc6243d4 Add SSHFP DNS record support. (#439)
* Add SSHFP DNS record support.
* Fix integration test.
2019-01-28 17:26:20 -05:00
Tom Limoncelli 93a36cbba9
GCLOUD: Support TXTMulti (#415)
* GCLOUD: Support TXTMulti
* Testing: Test max TXT record length
2018-10-14 10:53:11 -04:00
Amy Aronsohn 4e417eaa06 Fix DNSimple SRV and MX records (#413)
* Fix SRV and MX records, update knownFailures

This gets us back to tests passing

Signed-off-by: Amy Aronsohn <WagThatTail@Me.com>

* Better comment

Signed-off-by: Amy Aronsohn <WagThatTail@Me.com>
2018-10-14 00:30:13 -04:00
Craig Peterson d006f62f8f make sure key/value grouping always uses fqdn 2018-09-07 13:46:44 -04:00
Kai Schwarz 3e5d223675 new provider module HEXONET (#373) 2018-08-30 08:54:42 -04:00
Craig Peterson 2c400b2d93 some more ad tests to fail 2018-03-29 14:46:21 -04:00
Craig Peterson 554e8a40e1
Update AD integration failures (#353) 2018-03-29 14:03:34 -04:00
Antoine Cœur 0d52745164 typo (#338) 2018-03-21 08:12:05 -04:00
Tom Limoncelli a7eba97ada
Refactor in preparation to unexport RecordConfig.{Name,NameFQDN,Target} (#337)
* Preparing for the unexport of Name/NameFQDN/Target
* Cleanups
2018-03-19 17:18:58 -04:00
Tom Limoncelli bf9007fde4 add example and tips 2018-03-09 06:53:43 -05:00
Koen Vlaswinkel afa80c24bd LINODE: Fix Linode provider (#333) 2018-03-08 13:48:11 -05:00
Craig Peterson 19ca760072 fix for deleting wildcard from r53. includes failing integration test 2018-03-01 10:09:02 -05:00
Tom Limoncelli 54de1ff698
NEW PROVIDER: OctoDNS (#309)
* govendor gopkg.in/yaml.v2
* Ignore YAML and BIND test data litter.  Create README.txt files to force git to create subdirectories.
* Update convertzone to also read OctoDNS files
2018-02-27 17:36:47 -05:00
Tom Limoncelli b83630044f Correction: Fix error message. 2018-02-27 16:53:02 -05:00
Tom Limoncelli 1097c96fcc
New Provider: GANDI-LIVEDNS (API v5) (#320)
* Add gandi LiveDNS api provider
* vendor testify and gandi live DNS
* govendor update github.com/prasmussen/gandi-api/{client,live_dns}
* Fix Gandi-livedns TXT unit test
* TravisCI should use go 1.10
2018-02-24 13:40:18 -05:00
Tom Limoncelli 65f8fb63f0
Better .gitignore of integration test stuff. (#316) 2018-02-05 10:28:58 -05:00
Brice Figureau 7b8d608019 ROUTE53: Support Route53's ALIAS record type (#239) (#301)
* Stable comparison of metadata (#239)

Iterating over a map in Go never produces twice the same ordering.
Thus when comparing two metadata map with more than one key, the
`differ` is always finding differences.

To properly compare records metadata, we need to iterate the maps
in a deterministic way.

Signed-off-by: Brice Figureau <brice@daysofwonder.com>

* Support for Route53 ALIAS record type (#239)

Route53 ALIAS doesn't behave like a regular ALIAS, and is much more
limited as its target can only be some specific AWS resources or
another record in the same zone.

According to #239, this change adds a new directive R53_ALIAS which
implements this specific alias. This record type can only be used
with the Route53 provider.

This directive usage looks like this:
```js
D("example.com", REGISTRAR, DnsProvider("ROUTE53"),
R53_ALIAS("foo1", "A", "bar") // record in same zone
R53_ALIAS("foo2", "A",
  "blahblah.elasticloadbalancing.us-west-1.amazonaws.com",
   R53_ZONE('Z368ELLRRE2KJ0')) // ELB in us-west-1

```

Unfortunately, Route53 requires indicating the hosted zone id
where the target is defined (those are listed in AWS documentation,
see the R53_ALIAS documentation for links).
2018-01-16 05:53:12 -05:00
Brice Figureau 2fc55dfdc4 Add IGNORE(label) which ignores label at the provider (#183) (#300)
* Add support for the IGNORE(name) directive (#183)

IGNORE is like NO_PURGE but for a spefic record instead of the whole
zone. This is very useful for instance if you have a zone where
only some records are managed externally from dnscontrol (for instance
using kubernetes external dns system).

Adding IGNORE("foo") in the zone will make dnscontrol not trying
to manage the "foo" record (and especially not deleting it).
dnscontrol will error out if the "foo" record is both ignored and
managed in dnscontrol.

This can be seen as a generic Cloudflare's ignored label.

Signed-off-by: Brice Figureau <brice@daysofwonder.com>

* Deprecate CloudFlare ignoredLabels in favor of IGNORE (#183)

Since IGNORE implements a generic `ignoredLabels` system, let
the user know CF `ignoredLabels` are deprecated.

Signed-off-by: Brice Figureau <brice@daysofwonder.com>
2018-01-15 15:39:29 -05:00
Pat Moroney 91e2cf67ef NAMEDOTCOM: add TXTMulti capability (#299)
* add TXTMulti capability to the namedotcom provider
* run go generate
* escape multi txt records before sending to the API
2018-01-11 07:23:59 -05:00