Commit graph

52 commits

Author SHA1 Message Date
Tom Limoncelli 14e48b9b07
linting (#693)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2020-03-10 16:53:17 -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
Tom Limoncelli 3f68215841
GetNameservers is inconsistent across providers (#655)
* Warn if GetNameservers returns FQDN+dot strings
* Simplify logic that covers for the inconsistency
* Fix azuredns, gcloud, bind, route53
* Clean up cloudflare, digitalocean, dnsimple, gandi_v5, namedotcom
2020-03-01 10:33:24 -05:00
Tom Limoncelli b7b0b20798
Fix broken tests (#672) 2020-02-29 09:01:51 -05:00
Tom Limoncelli 4adef209c7
AZUREDNS: Do not warn about underscore for acm-validations.aws (#661)
* Check for acm-validations.aws.
2020-02-27 23:10:35 -05:00
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 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 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 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 Hughes 6c4192bf82
Add _mta-sts to labels allowed to have an underscore (#617)
Although _mta-sts is normally used with a TXT record it can
also be used with a CNAME record to delegate the authority.

See sections 3.1 and 8.2 of RFC8461 for details.
2020-02-07 14:20:24 -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
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 2c0361b0d5
BUG: Correctly spell Cabability (#582) 2020-01-12 11:24:10 -05:00
Tom Limoncelli 61a00a7d7e
Check for duplicate records much earlier (#467)
* Check for duplicate records much earlier.

* Change GetTargetDiffable to ToDiffable

* fixup!
2019-04-22 15:41:39 -04:00
Peter Dunaskin bb278caf92 Set NAPTR record to FQDN. 2019-04-01 09:15:43 +02:00
Peter Dunaskin e2726dda64 Fix NAPTR record support. 2019-03-29 12:01:52 +01:00
Peter Dunaskin 7566c0428e Attempt to add NAPTR support. 2019-03-28 15:40:13 +01:00
Tom Limoncelli 963bd32e20
Add SIP/JABBER labels to underscore exception list (#453)
* Improve comments in checkLabel
* Reformat labelUnderscores to make it easier to add to
* Add to exception list for label warnings
* Add underscores in hostnames to the opinions list.
2019-03-04 12:11:25 -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 4ef9e8bc40
Fix SRV record handling when target is shortname (#422)
* models/record.go: SRV targets are case insensitive. Downcase them.
* models/t_srv.go: Rename setTargetIntAndStrings() to setTargetSRVIntAndStrings() (makes it easier to search for /setTargetSRV/).
* pkg/js/parse_tests/021-srv.js*: SRV: Add parse_tests
* pkg/normalize/validate.go: SRV targets are hostnames, turn into FQDNs.
* Add  #rtype_variations warnings for future developers
2018-12-07 16:30:04 -05:00
Craig Peterson e30cbff674 fix build 2018-09-07 14:17:02 -04:00
Tom Limoncelli b40f188fae Flatten: Improve spfcache.json instructions (#375) 2018-07-24 16:37:25 -04:00
Craig Peterson 17e64ca28d
fix names for internal transformed records (#358)
* fix names for internal transformed records

* activedirectory use standard messaged

* add test for fqdn consistency in final validation pass
2018-04-26 14:45:10 -04:00
Brice Figureau 899100b7b3 Add again setting LabelFQDN in NormalizeAndValidateConfig (#342)
This is to prevent all labels to get erased by the empty LabelFQDN
during calls to `PunyCode`, until a better fix is found.
2018-03-22 09:29:55 -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 de4455942b
Refactor RecordConfig: Add getters/setters (#314)
* Replace RecordConfig.Name and .NameFQDN with getters and setters.
* Replace RecordConfig.Target with getters and setters.
* Eliminate the CombinedTarget concept.
* Add RecordConfig.PopulateFromString to reduce code in all providers.
* encode and decode name.com txt records (#315)
* Replace fmt.Errorf with errors.Errorf
2018-02-15 12:02:50 -05:00
Tom Limoncelli 4b1dc82c9b
Switch from fmt.Error* to errors.Error* (#317) 2018-02-05 16:17:20 -05:00
Craig Peterson 7a4dca5ad5 Refactor: Prelink providers to domains (#305) 2018-02-01 11:45:53 -05:00
Tom Limoncelli b7c251190f
Vet and Lint the entire system (#296)
* govet and golint corrections
2018-01-09 12:53:16 -05:00
Tom Limoncelli de88bfe8b7
Add support for TXT records with multiple strings (BIND, ROUTE53) (#293)
* BIND: Support TXT records with multiple strings (#289)
* ROUTE53: Add support for TXT records with multiple strings (#292)
2018-01-04 19:19:35 -05:00
Tom Limoncelli c6e244d8da
Productionize the SPF optimizer (#279)
* Productionize the SPF optimizer
* SPF_BUILDER(): New helper function
* docs/spf-optimizer.md: Document SPF_BUILDER()
2017-12-06 15:50:21 -05:00
Craig Peterson 2ef1fc42f8 New validation check: Labels should not be FQDNs (#264) 2017-11-14 23:13:50 -05:00
Koen Vlaswinkel 25df50634d Add _acme-challenge as an allowed record name (#267) 2017-11-14 06:56:15 -08:00
Tom Limoncelli e7472f76f3 Downcase DNS names (#253)
* Downcase DNS names
* Document opinions
2017-11-07 14:12:17 -08:00
Craig Peterson 373b4e4b83 better error message, actually clear unused cached lookups. 2017-10-02 12:31:30 -04:00
Craig Peterson 823e8bb1a3 Add SPF flattening feature. (#126) 2017-09-29 15:30:36 -04:00
eliheady 4aac517d62 Add TLSA record support (#165) (#203) 2017-09-15 09:03:29 -04:00
Tom Limoncelli 5cf482e8e8 Clarify "must end with a (.)" error message. 2017-08-18 15:50:55 -04:00
Tom Limoncelli 2534c8eaf2 Ban NO_PURGE when using BIND and others. (#180) 2017-08-11 15:43:06 -04:00
Tom Limoncelli 2cbabd859b Make it easier to add new Rtypes. (#169)
* NEW: docs/adding-new-rtypes.md
* Mark all "if" and "switch" statements with `#rtype_variations`
* Make consistent use of `default: panic()`
2017-08-04 12:26:29 -07:00
Tom Limoncelli 2f0f5330fc Add CAA support (#161)
* Added CAA support

* Fixed bind parsing of CAA records

* Added CAA parsing test

* Renamed CAA json fields

* Added CAA tag validation

* Updated CAA docs to clarify on the value field

* parse_tests: Fixed typo in caaflags

* Added integration test

* Small cleanups
2017-07-25 14:59:40 -04:00
Tom Limoncelli e6ce3b8895 Cleanup SRV testing
* Integration tests: PTR tests should only happen if CanUsePTR
* Integration tests: SRE tests should only happen if CanUseSRV
* CanUseSRV should be validated early (in pkg/normalize/validate.go)
* CLOUDFLARE does not support SRV. Check for this during validation
* GCLOUD CanUsesRV (mostly by accident, but whatever works)
2017-07-20 15:55:26 -04:00
Tom Limoncelli d55b20ecdb Add SRV Record Type (#136)
* Add support for SRV records for NAMEDOTCOM and ROUTE53.
* Improve docs
* Rename RR() to ToRR().
* Rename RecordConfig Priority to MxPreference (affects json IR data)
2017-07-19 15:53:40 -04:00
Tom Limoncelli 582e5c2bb1 Make PTR more magical (#148)
* Initial code and tests
2017-07-07 13:59:29 -04:00
Craig Peterson 152892f62a generalize capability validation 2017-07-06 10:24:21 -04:00
Tom Limoncelli aa92817116 Enable PTR records for BIND driver (#146)
* WIP

* Enable PTR records in dnsconfig.js, in BIND provider.

* Rename REVERSE() to REV().

* More accurate PTR target checking

* Document REV()

* Fix broken test
2017-07-06 10:18:15 -04:00
Tom Limoncelli 9228c039fe fixup! 2017-06-11 09:31:26 -04:00
Tom Limoncelli 46707722f6 Fix: Validate CNAME targets (check for "/") #37 2017-06-11 09:30:12 -04:00
Manatsawin Hanmongkolchai c458594788 Added _amazonses to list of allowed name with underscore (#133)
Thanks for the PR!
2017-06-07 08:54:39 -04:00