Commit graph

305 commits

Author SHA1 Message Date
Tom Limoncelli b6fd4dffd7
Cleanups: Fix many issues reported by staticcheck.io (#837)
* Lint: Fix ST1005: error strings should not be capitalized

* Cleanup: Fix a lot of staticcheck.io warnings
2020-08-30 20:38:08 -04:00
Tom Misilo cb9a82717b
Allow for Name's that start with _ (#830)
* Allow for Name's that start with _

* update tests

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2020-08-30 20:35:07 -04:00
Tom Limoncelli de308c0952
Lint: Fix ST1005: error strings should not be capitalized (#834) 2020-08-30 19:52:37 -04:00
Tom Limoncelli d6dd13820f
gofmt (#826) 2020-08-26 13:45:02 -04:00
Mike Cochrane 59747a96f0
Cleanup: Bubble errors up from diff instead of panic (#799) (#817) 2020-08-20 15:49:00 -04:00
Patrik Kernstock 576c2bd582
New feature: require_glob() (similar to require() but supports globs) (#804)
* Initial implementation of findFiles/globe/glob

* Fixed path, some small improvements

* filepath.Dir() calls Clean() automatically anyway

* Relative path support (like require()), renamed func

* Check file ext prefix, further comments, var renaming

* Updated static.go after merge

* Added doc for glob()

* Tiny adjustment of description of glob()

* Updated docs for possible pattern

* Reworked glob, added public-facing require_glob()

* Updated docs with examples

* Updated static.go

* go generate
2020-08-19 14:00:40 -04:00
Mike Cochrane 960dc66bd2
New feature: IGNORE_TARGET. Rename INGORE to IGNORE_NAME (#806) 2020-08-18 11:14:34 -04:00
Mike Cochrane 889ed75668
Notifications: Add support for Microsoft Teams (#812) 2020-08-14 12:23:54 -04:00
Patrik Kernstock d2d210a5af
New features: DU() and getConfiguredDomains() to assist modifying domains (#800)
* Added DU() and getConfiguredDomains()

* Added docs for both new functions

* Added a space between option and its value

* Renamed "DU" to "D_EXTEND", adjusted docs

* Fixed: Changed old DU() calls to D_EXTEND()
2020-08-04 09:43:02 -04:00
Michael Russell f21c8fc400
SPF Optimizer: Enable the use of TXTMulti records to support longer SPF records (#794)
* Add multiple string support to SPF optimizer

Notes:

* This implements [RFC 4408][rfc] for the SPF optimizer. Allowing for
more SPF records to fit within the 10 lookups by using multiple strings.
* By default the max size of the TXT remains at 255. Meaning users will
still only get a single 255 length string unless they modify `txtMaxSize`
and opt into this feature.
* The general recommendation when using multiple strings for TXT records
is to keep the size within a single UDP packet. It seems like the
maximum size for this depends on a bunch of factors that are sometimes
outside of your control. A similar tool has a [formula for estimating the
maximum allowed size][formula]. However I felt giving a user
configurable size would fit with the current configuration style that
dnscontrol has. Similar to how dnscontrol recommends only flattening a
record if absolutely needed, I can see this length being increased by
only enough to get you within 10 lookups.

[rfc]: https://tools.ietf.org/html/rfc4408#section-3.1.3
[formula]: https://github.com/oasys/mkspf/blob/master/Overhead.md

* Add a nice comment for the Chunks function
2020-07-31 13:28:13 -04:00
Michael Russell 237c573c2a
Make it possible to disable the raw SPF optimizer debug record (#795)
Open to other configuration opens for how best to make this optional. Or
potentially making this an opt in configuration item which would be a
breaking change.

The main reason that someone would want to disable this is if their raw
SPF record goes over the 255 characters. This is potentially another
place that could get some multi string support. But as it is only used
for debugging purposes it seems like there should be a way to outright
disable it too.
2020-07-31 10:40:22 -04:00
Tom Limoncelli 530bf10bfa
NEW: spf flattener can make first record extra short (#781)
* NEW: spf flattener can make first record extra short

* fixup!
2020-07-09 12:52:49 -04:00
Tom Limoncelli 541bb805da
linting (#777) 2020-07-06 20:18:24 -04:00
Tom Limoncelli 367a14ab44
Sort updates (cosmetic) (#772)
* Sort updates (cosmetic)

* comments

* More comments
2020-07-01 05:55:20 -04:00
Matthew Huxtable ff8ce26cee
Provider support for DS records as children only (#765)
This functionality is required by the GCLOUD provider, which supports
recordsets of type DS but only for child records of the zone, to enable
further delegation. It does not support them at the apex of the zone (@)
because Google Cloud DNS is not itself a registrar which needs to model
this information.

A related change (14ff68b151, #760) was
previously introduced to enable DS support in Google, which broke
integration tests with this provider.

To cleanly support this, we introduce a new provider capability
CanUseDSForChildren and appropriate integration tests. Further, it is no
longer possible to verify a provider has the proper capabilities for a
zone simply by existence of particular records; we adapt the capability
checks to enable inspection of the individual recordsets where this is
required.

Closes #762
2020-06-18 17:24:13 -04:00
Tom Limoncelli 676d98fc4a
Linting (#767)
What could possibly go wrong?
2020-06-18 09:37:57 -04:00
Tom Limoncelli 97d91cda4c
Implement a simple lexagraphic sort. (#755) 2020-05-30 12:03:33 -04:00
Nicolai Ehemann 4713bbad7d Rebase and regenerate 2020-05-30 11:06:13 -04:00
Tom Limoncelli e57eaccac9 Merge 2020-05-30 11:06:13 -04:00
Tom Limoncelli c0354a585d DS: More cleanups 2020-05-30 11:06:12 -04:00
Tom Limoncelli a89ab89ab6
Fix the merge mess I made with the DS merge (#754)
* DS: More cleanups

* Added DS for cloudflare provider with tests

* Merge

* Added generated files

* Regenerated documentation matrix

* rebased and regenerated

* Updated integration tests

* Rebase and regenerate

* More cleanups

Co-authored-by: Robert Koch <robert@kochie.io>
Co-authored-by: Nicolai Ehemann <nicolai.ehemann@enerko-informatik.de>
2020-05-30 11:05:54 -04:00
Tom Limoncelli 87a5c4b339
New RTYPE: DS records now supported! (#753)
Thanks to @haraldkoch for starting this, @McNetic for picking it up.

* Added DS record type

* Added DS for cloudflare provider with tests

* Removed DS validation, fixed parse test

* Added generated files

* Added dnsimple ds record

* Regenerated documentation matrix

* rebased and regenerated

* Updated integration tests

* Rebase and regenerate

* Enable DS record type for provider desec

* Added DS record type

* Added DS for cloudflare provider with tests

* Removed DS validation, fixed parse test

* Added generated files

* Added dnsimple ds record

* Regenerated documentation matrix

* rebased and regenerated

* Updated integration tests

* Rebase and regenerate

* Enable DS record type for provider desec

* Rebase and fixes

Co-authored-by: Robert Koch <robert@kochie.io>
Co-authored-by: Nicolai Ehemann <nicolai.ehemann@enerko-informatik.de>
2020-05-30 10:40:21 -04:00
ddrght12345 5269540827
Add _domainconnect to the underscore whitelist (#751) 2020-05-29 21:41:40 -04:00
Tom Limoncelli 6263e856c9
get-certs now generates a .pem file in addition to .key and .crt (#750) 2020-05-29 16:56:46 -04:00
Jan-Philipp Benecke d3a90f0a2d
Added slack notifications (#749)
* Added slack notification

* Added slack notification to doc.

* Send notifications as single message & updated doc. example

* Remove not needed variable
2020-05-29 09:26:48 -04:00
Tom Limoncelli 87607da685
'get-certs' permissions too open (#745)
Fixes https://github.com/StackExchange/dnscontrol/issues/728
2020-05-22 10:26:22 -04:00
Tom Limoncelli 24b7d0641e Update github.com/StackExchange/dnscontrol/v2 2020-04-14 16:49:03 -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 24484f1e0c
move providers/diff to pkg/diff like we should have 2 years ago (#692)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2020-03-10 16:35:43 -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
Tom Limoncelli 798cdffd81
CLOUDFLARE: get-zones --ttl flag should handle CF's magic TTLs better (#657)
Fixes https://github.com/StackExchange/dnscontrol/issues/630
2020-02-27 11:11:59 -05:00
Tom Limoncelli 7789b4dbdc
get-zones: Implement --ttl flag for pretty and dsl (#654) 2020-02-25 07:23:40 -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 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
Tom Limoncelli 7384743f6d
pretty helpers.js (#649) 2020-02-22 12:07:10 -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
Tom Limoncelli 36a05608e0
DOCS: Explain nameservers vs ns (#608) 2020-01-29 13:47:32 -05:00
Tom Limoncelli 92b51dbc65
Update github.com/mjibson/esc (#515)
* Update github.com/mjibson/esc

* Update github.com/mjibson/esc
* Fix generate.go to new signature for esc.Run

* Internal: Upgrade to lastest "esc"
2020-01-29 13:43:25 -05:00
Patrick Gaskin 6e8d5b59ab Fixed issues from go vet (#605)
* CloudFlare provider is missing quotes on a JSON struct tag.
* ACME package has a unnecessary JSON struct tag.
* Route53 provider has an unreachable return.
2020-01-28 12:10:58 -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
Anton Yurchenko 262acdd3d8 get-certs: DNS01 challenge skipping preCheckDNS (#591) 2020-01-23 17:54:07 -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
Craig Peterson 2ee086d41c
switch to new go-acme imports from xenolf. Fix api changes (#540)
* switch to new go-acme imports from xenolf. Fix api changes

* update many vault related dependencies
2019-07-29 10:54:32 -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
Craig Peterson be5b588035
add must_staple option to cert. Default false (#502) 2019-05-29 14:03:36 -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
Tom Limoncelli df163c0042
OVH: Update to use newer client library (#445)
* xlucas/go-ovh is deprecated, use ovh/go-ovh instead.

* vendor github.com/ovh/go-ovh

* Fix 022-sshfp.json test
2019-05-20 15:39:19 -04:00
Tom Limoncelli 5f77888296
DOCUMENTATION: Document bugid 491 (#492) 2019-05-20 14:37:23 -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
Craig Peterson 6d6f685f70
trim trailing dots from discovered nameservers in central place 2019-05-15 12:57:17 -04:00
Craig Peterson 5c24f6ce39 fix some tests 2019-05-06 11:12:42 -04:00
Craig Peterson e242f5a152
Increase 'just because' sleep to 60s 2019-05-02 19:31:15 -04: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
Craig Peterson 5c03761fa6
notifications for get-certs command (#451) 2019-02-21 19:58:50 -05:00
Craig Peterson 7e5a1fb96d add tls.combined field to vault cert backend 2019-02-06 15:21:08 -05:00
Tom Limoncelli 061ea63322
require() should handle paths as relative (like nodeJS) (#443)
* Integrate @nlowe's documentation and tests
* Use filepath.Clean() instead of filepath.Abs()
* Use a stackless implementation
2019-01-29 10:29:00 -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 1b1f37da9d Fix TLSA parse_test. 2019-01-11 10:34:13 -05:00
Tom Limoncelli a5e14a5f93 fixup! 2018-12-19 10:22:37 -05:00
Tom Limoncelli f83b624ea1
BUG: parse_tests: Fix (revert) earlier reformatting (#431) 2018-12-19 10:19:50 -05:00
Tom Limoncelli ff3d446681
Codestyle: Fix formatting on parse_test JSON (#427)
* Fix failing parse_test 021
* Fix JSON formatting in parse_test directory
* js_test.go now reports json content length
2018-12-13 11:46:43 -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 cf7f199462
allow ecc certs if desired (#411) 2018-10-09 18:51:48 -04:00
Craig Peterson 6764811c5f
Abstraction for Certificate Storage (+ vault storage) (#406)
* new abstraction around storage

* re-work completely to fit new acme package pre-solving paradigm

* vault storage plugin

* add some vendor

* delete old vendor pinning mechanism
2018-10-08 16:11:19 -04:00
Ed Bardsley 06ee4d6fb1 Verbose debug logging via the ConsolePrinter and printer package. (#404)
This:
 * adds a global -v flag for verbosity
 * refactors the "printer" package to have a DefaultPrinter and package
   functions that call it, similar to net/http's DefaultServeMux
 * adds printer tests
 * moves current users of Debugf to Printf
 * moves most users of the "log" package to use "printer"
 * demotes noticably noisy log messages to "Debugf", like "IGNORE"-
   and "NO_PURGE"-related messages
2018-10-08 16:10:44 -04:00
Craig Peterson e30cbff674 fix build 2018-09-07 14:17:02 -04:00
Ed Bardsley 61281d7046 Add NAMESERVER_TTL and associated documentation. (#398) 2018-09-04 10:57:11 -04:00
Andrew Rafferty 402fc449e2 Certs: Create directories with execute permissions so they can be opened (#395)
* Create directories with execute permissions so they can be opened
* Use 0700 permissions on certificate directories instead of 0755
2018-08-27 12:12:53 -04:00
Kieran Jacobsen 95ebf1d35b Include PTR types in SPF Builder (#378)
* Include PTR types in SPF

* Simplify PTR and Exists logic

* Include PTR test case

* Include PTR test case

* Remove extra }
2018-08-02 10:57:41 -04:00
Tom Limoncelli b40f188fae Flatten: Improve spfcache.json instructions (#375) 2018-07-24 16:37:25 -04:00
Craig Peterson 6c60eac7c7
Work around extra whitespace in spf records (#361)
* handle empty spf parts from bad records

* update spf tool
2018-05-03 10:03:38 -04:00
Kieran Jacobsen f77f202b65 Add support for "exists" element in SPF. (#356)
* Include support for "exists" element in SPF.
* Add exists: SPF entry to test support
2018-05-03 08:54:19 -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
Craig Peterson 2e8c4a758f
Let's Encrypt Certificate Generation (#327)
* Manual rebase of get-certs branch

* fix endpoints, add verbose flag

* more stable pre-check behaviour

* start of docs

* docs for get-certs

* don't require cert for dnscontrol

* fix up directory paths

* small doc tweaks
2018-04-26 13:11:13 -04:00
Craig Peterson 558aea906a make bonfire notifications multiple posts for markdown compatibility 2018-03-28 10:00:05 -04:00
Craig Peterson 2a7b382767 Better validate NAMESERVER format. (#350)
* remove misleading ip field we don't touch
2018-03-22 11:52:52 -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 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 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 324b1ea930 UPdate static.go 2018-02-09 14:04:07 -05:00
Ismael Peral 06404fdcf9 Fix CAA Support: helpers.js CAA_CRITICAL flag=128 (#318) (#319)
* Update helpers.js CAA_CRITICAL flag=128 (#318)

CAA flag "Issuer Critical Flag" sets first bit (bit 0) to 1 where bit 0 is the 8th bit in the flag, so it's doing the change by left shift 7 positions the value 1.

* Change caa tests

Apply changes for Travis-CI, now caaflag must be 128 instead of 1.

* generated static.go and matrix.html
2018-02-09 14:03:40 -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
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
Craig Peterson 0b329bf0ee add emphasis 2018-01-11 12:44:52 -05:00
Craig Peterson 9dbd4a3066
Simple notification framework (#297)
* bonfire notifications working

* make interface to make more extensible

* some docs

* typo

* rename typo
2018-01-11 11:15:19 -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 1a91a7f536 go generate 2018-01-06 15:13:57 -05:00
Tom Limoncelli 2dd9049582 helpders.js: Run prettier. 2018-01-06 15:13:22 -05:00
Tom Limoncelli a03c8f19e8
Add syntax for very long DKIM strings (#295)
* Add DKIM() function to split long strings.
* Add parse_test for DKIM()
2018-01-04 21:17:08 -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 21e4cb4fc3 go generate && add more RelEng docs. 2017-12-06 17:03:07 -05:00
Tom Limoncelli d8e22b4e2c
pkg/js/helpers.js: Prettier. (#280) 2017-12-06 15:56:57 -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
Pat Moroney 106790b0d5 throw an error if a domain name is declared more than once (#247)
* throw an error if a domain name is declared more than once in the js file
2017-11-14 23:14:45 -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
rbelnap eafc18a77e add initial URL support to namecheap provider (#237)
* add initial URL support to namecheap provider

* add URL / FRAME records to namecheap provider
2017-10-23 12:54:31 -04: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
Craig Peterson e4ad084494 update some dependencies (#208)
* update some dependencies

* some more

* add these

* remove things?

* regen
2017-09-18 15:35:10 -04:00
Manatsawin Hanmongkolchai 4bffc37d15 Format helpers.js (#205)
* Format helpers.js with prettier

* Adding docs on how to run prettier
2017-09-15 13:12:09 -04:00
Craig Peterson a520a24628 add some backslash parse tests 2017-09-15 10:29:28 -04:00
eliheady 4aac517d62 Add TLSA record support (#165) (#203) 2017-09-15 09:03:29 -04:00
Craig Peterson 1d9d2b1a19 Refactor to use better cli command framework (#177)
* starting to refactor commands

* work

* not sure

* all commands working!

* actually add file

* work in delay flag again

* start to refactor out console printing

* i hate line endings

* simple travis test to find direct output

* remove all direct printing from push/preview

* checkin vendor

* don't need this yet

* forgot to commit these

* make version explicit command

* some code review

* Add "check" subcommand.

* move stuff to commands package

* fix

* comment out check for printlns. for now

* alphabet hax

* activedir flags gone. use creds instead

* active dir doc update

* remove bind specific flags. creds instead

* default to zones dir

* fix linux build

* fix test

* cleanup random global* vars

* Clean up PowerShell docs

* rename dump-ir to print-ir. combine with print-js
2017-09-13 10:00:41 -04:00
Tom Limoncelli fba8b3ee0c go generate 2017-09-11 20:16:53 -04:00
Tom Limoncelli e15b28c3b6 ROUTE53: Fix broken integration test. 2017-09-08 17:13:59 -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
Manatsawin Hanmongkolchai 73962470bc Refactor addRecord to recordBuilder (#157) (#163)
* helpers.js: Refactor addRecord to recordBuilder

* Fixed failing dns test

* helpers.js: Fixed a typo in SRV handling

* helpers.js: Move type to top level argument

* Removed support for numeric modifiers

* helpers.js: Added IMPORT_TRANSFORM ttl argument back
2017-08-11 14:48:43 -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
Craig Peterson 710d14b1a9 tests that would have caught tag renaming bug. js tests now don't marahsl expected through the go object. Instead minify both sides to compare 2017-07-20 17:41:15 -04:00
Craig Peterson d106c88488 fix js field name 2017-07-20 17:20:47 -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 e563c53658 PTR should handle "Classless in-addr.arpa delegation" RFC2317 (#149)
* Handle IPv4 "Classless in-addr.arpa delegation" RFC2317 (partial).
* Validate PTR name when in RFC2317 "Classless in-addr.arpa delegation" domains.
* Update docs
* Set CanUsePTR for Route53 and Google CloudDNS.
* BIND: Replace "/" with "_" in filenames.
2017-07-10 19:24:55 -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
Craig Peterson 89a2784f35 gen 2017-06-08 09:19:47 -04:00
Craig Peterson 32a056e2b7 magic string durations 2017-06-08 09:15:14 -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
Craig Peterson 4bb2562d45 Merge branch 'master' of github.com:StackExchange/dnscontrol 2017-06-05 15:08:38 -04:00
Craig Peterson 6a80f71d66 Canonicalize IPv6 addresses. (Fixes #25) (#129) 2017-06-05 14:57:32 -04:00
Craig Peterson 5de49a6264 adding flat/tests 2017-06-05 14:26:59 -04:00
Craig Peterson 9eb1589d8c consolidate 2017-06-05 14:10:12 -04:00
Craig Peterson 0e87177481 Merge remote-tracking branch 'origin/master' into ptr 2017-06-05 14:09:05 -04:00
Craig Peterson 5abf06e059 merge/fix 2017-06-05 13:58:02 -04:00
Tom Limoncelli cf2208ebfc Merge branch 'master' into tlim_cfaliases 2017-05-25 20:38:48 -04:00
Craig Peterson 42ef9f4b9e moving a bunch of packages under pkg (#124)
* moving a bunch of packages under pkg

* fix gen

* fix tst

* oops

* fix test fo real

* parse mx/a
2017-05-25 14:25:39 -04:00