Commit graph

256 commits

Author SHA1 Message Date
Phil Pennock 4fed6534c7
Tests: ensure provider capabilities are checked (#650)
* Tests: ensure provider capabilities are checked

Adds test: `TestCapabilitiesAreFiltered`

We have a number of records and pseudo-records which in theory can only
be used with a given provider if that provider indicates support.  In
practice, we've been missing the checks for that support and have been
passing the records down anyway.  The advice comment in the
providers/capabilities.go file to edit `checkProviderCapabilities()` has
not been reliably followed.

We need an internal self-consistency test.  The constants are not
directly exported or enumerable based solely on the package interfaces
at run-time, but with source access for a test suite, we can use the
`go/ast` and related interfaces to examine the code, extract all the
constants from a given package, figure out which ones we want to be
handled, and then insist that they're handled.

Before my recent work, we only checked:

    ALIAS PTR SRV CAA TLSA

After this commit, we check:

    ALIAS AUTODNSSEC CAA NAPTR PTR R53_ALIAS SSHFP SRV TLSA

I've added `AUTODNSSEC` as a new feature; `SSHFP` and `PTR` were caught
in other recent commits from me; implementing this test caused me to
have to add `NAPTR` and `R53_ALIAS`.  I whitelist `CanUseTXTMulti` as a
special-case.

This should prevent regressions.  We will probably want to post publicly
to warn people that if they're using SSHFP/PTR/NAPTR/R53_ALIAS then they
should check the feature matrix and if they don't see their provider
listed, to report is as "hey that actually works" so we can update the
provider flags.  Bonus: our feature matrix will suddenly be more
accurate.

* Add comments/docs for capabilities authors

* fixup!

* fixup!
2020-02-25 07:22:32 -05:00
Tom Limoncelli 772ca4e7dd
Linting (#647)
* linting
* Fix adding-new-rtypes.md to include validation
* BIND: improve docs wrt SOA records, get-zones
2020-02-23 14:47:14 -05:00
Tom Limoncelli 9812ecd9ff
BIND: Improve SOA serial number handling (#651)
* github.com/miekg/dns
* Greatly simplify the logic for handling serial numbers. Related code was all over the place. Now it is abstracted into one testable method makeSoa. This simplifies code in many other places.
* Update docs/_providers/bind.md: Edit old text. Add SOA description.
* SOA records are now treated like any other record internally. You still can't specify them in dnsconfig.js, but that's by design.
* The URL for issue 491 was wrong in many places
* BIND: Clarify GENERATE_ZONEFILE message
2020-02-23 13:58:49 -05:00
Phil Pennock 3c41a39252
BIND: Implement AutoDNSSEC (#648)
There's a philosophy issue here around what is the Bind output meant to
do.  Since AFAIK we're not integrating into Bind's catalog zones or the
like, we're just targeting the zonefiles, we're not in a position to do
_anything_ relating to registrar options such as setting up DS glue.

So at one level, enabling AutoDNSSEC for Bind is a lie. But without
this, folks can't target a Bind zone as a secondary provider for their
domain, to get debug dumps of the zone output, because the checks for
"Can" block it.  So I think this commit achieves a happy compromise: we
write a comment into the Bind zonefile, indicating that DNSSEC was
requested.

Actually: we add support for arbitrary zone comments to be written into
a zonefile via a slightly ugly "can be `nil`" parameter.  We then write
in a generation timestamp comment, and if AutoDNSSEC was requested we
then write that in too.
2020-02-22 13:27:24 -05:00
Phil Pennock 9b239f41a3
Add AUTODNSSEC, implement for DNSimple (#640)
* Add AUTODNSSEC, implement for DNSimple

There are two models for DNSSEC in DNS management: either dnscontrol
manages all the DNSSEC records and has to be invoked regularly for
re-signing, or the provider manages DNSSEC automatically and dnscontrol
is not involved beyond saying "yeah, do that".

This implements the latter, as a model, and for one provider.

Potentially we could tune/configure options for DNSSEC such as
algorithm, but DNSimple don't expose that API so I haven't implemented
it.

This minimal model should be something which maps into other providers
cleanly.

* Fix missing CanAutoDNSSEC on provider

* Validation fix for master broken

This is broken in master and causing Travis in my branch to fail.  The
validation tool runs with `gofmt -s` to require "simplify", and so
rejects an ignored second bound variable to range iteration.

* Correct wire in the AUTODNSSEC validation step
2020-02-22 07:09:31 -05:00
Tom Limoncelli 3c507d6b77
get-zones: new output format nameonly; remove tsvfqdn (#644)
* Add nameonly; remove tsvfqdn

* document tsv fields
2020-02-21 14:59:47 -05:00
Phil Pennock d221471e38
dnsimple: bug-fix SSHFP, add multi TXT support (#639)
* dnsimple: bug-fix SSHFP, add multi TXT support

The default logic for encoding SSHFP records was dropping the key and
hash algorithms and just posting the content, the `Can` check didn't
stop attempts to use SSHFP.  So, implement SSHFP support.

DNSimple support multiple DNS strings in a TXT record, by representing
the payload as quoted strings already.  This doesn't appear to be
documented, but it does actually work.

* Update docs support matrix too

* fix go fmt missing upstream

Tests failing on my branch for something broken upstream

* fix typo in error message
2020-02-21 13:23:30 -05:00
Amelia Aronsohn b45c6b6b6c
DNSimple: Implement GetZones and ListZones (#637)
* Update to latest dnsimple-go

* Implement GetZoneRecords

* Better naming

* Return NS records in GetZoneRecords

* Be clearer with the comment.

As an employee I confirm this is exactly how this works. No guessing needed.

* Respect that Puncycode encoding can blow up

* Implement ListZones and the ZoneLister Interface

* Categorize DNSIMPLE

* Update docs with go generate

* vendor modules

* Don't store intermediary Zone data
2020-02-20 14:52:19 -05:00
Juho Teperi ca99517ced
Do get zones (#635)
* Implement GetZoneRecords for Digitalocean provider
* Clean fixme comment from digitalocean provider
2020-02-19 13:11:49 -05:00
Vatsalya Goel f12d4bb8d6
Implement Get Zone for Azure DNS (#631)
* Implement Get Zone for Azure DNS

* Internalize getExistingRecord
2020-02-18 11:35:13 -05:00
Tom Limoncelli 87ad01d194
Add "get-zone" command (#613)
* Add GetZoneRecords to DNSProvider interface
* dnscontrol now uses ufave/cli/v2
* NEW: get-zones.md
* HasRecordTypeName should be a method on models.Records not models.DomainConfig
* Implement BIND's GetZoneRecords
* new WriteZoneFile implemented
* go mod vendor
* Update docs to use get-zone instead of convertzone
* Add CanGetZone capability and update all providers.
* Get all zones for a provider at once (#626)
* implement GetZoneRecords for cloudflare
* munge cloudflare ttls
* Implement GetZoneRecords for cloudflare (#625)

Co-authored-by: Craig Peterson <192540+captncraig@users.noreply.github.com>
2020-02-18 08:59:18 -05:00
Tom Limoncelli 8123b05d43 Clarify versions in RE 2020-02-14 15:01:39 -05:00
Tom Limoncelli 6680e9e2a7 DOCS: Document release note bprocess 2020-02-12 13:51:00 -05:00
Tom Limoncelli 36a05608e0
DOCS: Explain nameservers vs ns (#608) 2020-01-29 13:47:32 -05:00
Tom Limoncelli 75756136cb
RELENG: Doc should list correct version numbers (#607)
* RELENG: Release numbers no longer begin with 0.
2020-01-28 16:59:09 -05:00
Tom Limoncelli 071d9377c2 fixup! 2020-01-28 14:38:53 -05:00
Tom Limoncelli 88abe122cf
Docs: Clarify bug triage process (#606) 2020-01-28 14:36:28 -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
Tom Limoncelli ae3a730e64
Documentation: Add vendoring details. (#596)
* Add vendoring details.

* Address @geek1011's comments.

* fixup!
2020-01-28 10:44:07 -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
Tom Limoncelli d19eedaa63
DOC: Improve internetbs doc (#603) 2020-01-28 07:44:52 -05:00
Anton Yurchenko 2d88d81392 NEW PROVIDER: Internet.bs (#590)
* Ineternet.bs: first version of provider
* Ineternet.bs: code and documentation cleanup
2020-01-27 08:25:20 -05:00
Patrick Gaskin c0a68fae4f Regenerate provider support matrix (fixes #592) (#599)
Also see #595.
2020-01-24 17:20:41 -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 28d650207b
Improve Lets Encrypt docs (#594)
* Mention certbot
* Link to get-certs.md from the main page
* Rename lets-encrypt.md -> get-certs.md
2020-01-23 17:49:43 -05:00
Tom Limoncelli 9857a320a2 Update get-certs docs 2020-01-23 17:42:12 -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
Tom Limoncelli 2c6878237e go generate 2020-01-20 14:08:09 -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
Will Power 31188c3a70 ROUTE53: Document Minimum access policy learned from #548 (#586) 2020-01-18 13:31:10 -05:00
Vatsalya Goel df3adef5ec Do some cleanup for AzureDNS code (#551) 2019-12-09 13:51:23 -05:00
Hugo Barros 0f396cd135 ROUTE53: Add AWS_PROFILE functionality (#567)
* Add AWS_PROFILE functionality for Route53 provider

* Document named profiles authentication option for Route53
2019-12-04 10:17:28 -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
Benoît Knecht 1b9780495d DOCUMENTATION: Fix small typo in Cloudflare (#556)
Remove trailing "rather" at the end of a sentence.
2019-10-23 13:27:04 -04:00
Benoît Knecht 4e6d05b716 CLOUDFLARE: Support API tokens (#555)
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
2019-10-23 11:48:00 -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
Patrick Gaskin cafd4d387a vultr: Added support for SSHFP records (#531) 2019-07-15 12:28:37 -04:00
Tom Limoncelli be10c5f7c2
Bugfix: redirect: should be redirect= (#507) 2019-06-21 07:48:59 -04:00
Tom Limoncelli 2d9d93653b
SPF Optimizer: Add "redirect:" support (#506)
FYI: The support is very minimal. It only supports redirect if it is the last item in an SPF record. At that point, it is equivalent to include.

* In SFP, treat redirect like a special include.
* Document SPF redirect: limited implementation.
2019-06-19 18:46:56 +01:00
Patrik Kernstock 539820f87a CF: Add ability to manage UniversalSSL (#496)
* Added Cloudflare UniveralSSL control
* Added CF_UNIVERSALSSL_ON/OFF macros
* Updated docs
* Small docs update
* go generate
2019-06-13 07:32:54 -04:00
Tom Limoncelli 8b86eec6bf go generate 2019-05-30 19:52:35 -04:00
Tom Limoncelli 766773afa5 Remove unneeded "0." prefix on version. 2019-05-27 15:56:57 -04:00
Koen Vlaswinkel 5538de6682 IGNORE() now supports glob pattern/wildcards (#463) 2019-05-27 10:14:29 -04:00
Nikolay Kolev b3e35b56a2 DOC: Apply brand-preferred case (#429)
* Apply brand-preferred case

* Apply case to own branding as well
2019-05-23 09:29:21 -04:00
Oscar Moreno Garza 608dd7af56 NEW: require() now supports loading JSON too (#474) 2019-05-23 09:26:40 -04:00
Patrik Kernstock f9df8c744a NEW: Added support for specific TTL when using SPF_BUILDER (#476)
* Added support for specific TTL for SPF_BUILDER

* Added updated static.go file

* Use IF instead of reading defaultTTL
2019-05-23 09:25:06 -04:00
Patrik Kernstock c65ba1c84c General docs improvements (#481)
* docs improvements

* Updated matrix as part of "go generate" (e.g. adds SSHFP row)

* Commiting full matrix file

* Added docs for SSHFP record

* Matrix: Mark OVH as SSHFP-capable in docs (see PR #482)
2019-05-20 22:33:50 -04:00
Patrik Kernstock a16f689d32 Added CAA_BUILDER (#478)
* Added CAA_BUILDER

* CAA-Builder: simply use "none" to refuse all CAs

* Fixed small error in documentation
2019-05-18 11:10:17 -04:00
Patrik Kernstock d782bb002b CLOUDFLARE: SPF records should be converted to TXT Fixes #446 (#480) 2019-05-18 11:08:18 -04:00
Tom Limoncelli 5044695ffe DOCS: Fix many spelling errors (#471) 2019-05-11 21:32:52 -04:00