Commit graph

60 commits

Author SHA1 Message Date
Tom Limoncelli 7ae27aa0b9 Security: Fix many staticcheck warnings 2021-12-14 09:47:32 -05:00
Tom Limoncelli 654736be29
Improve MSDNS naptr support (#1165)
* MSDNS: Improve reliability of zone dump

* Update tests

* MSDNS: Add initial NAPTR support

* Update

* fix tests

* fix tests

* Fixing integration tests for NAPTR

* Handle bad JSON. Handle NAPTR TTLs
2021-06-24 18:26:21 -04:00
Tom Limoncelli 8d139d182f
gofmt all (#1144) 2021-05-04 14:15:31 -04:00
Tom Limoncelli e69e6f27e4
Linting (#1087)
* fix linting
* rename AuditRecordsor to RecordAuditor
* gandi_v5 to gandiv5
2021-03-08 20:14:30 -05:00
Tom Limoncelli fb0bcaac64
Clarify that create-domains does not purchase them (#1086)
* Make GCLOUD and GANDI_V5 modules consistant

Fixes https://github.com/StackExchange/dnscontrol/issues/1060
Fixes https://github.com/StackExchange/dnscontrol/issues/1059

* Fix help text
2021-03-07 15:24:23 -05:00
Tom Limoncelli 8dea9edc34
Re-engineer TXT records for simplicity and better compliance (#1063)
TXT records are now handled different.

1. The raw input from dnsconfig.js is passed all the way to the provider. The provider can determine if it can or can't handle such records (auditrecords.go) and processes them internally as such.
2. The CanUseTXTMulti capability is no longer needed.

* DSPs now register a table of functions
* Use audits for txt record variations
* unit tests pass. integration fails.
* fix deepcopy problem
* rename to AuditRecordSupport
* Reduce use of TXTMulti
* Remove CanUseTXTMulti
* fix Test Skip
* fix DO
* fix vultr
* fix NDC
* msdns fixes
* Fix powerdns and cloudflare
* HEDNS: Fix usage of target field to resolve TXT handling (#1067)
* Fix HEXONET

Co-authored-by: Robert Blenkinsopp <robert@blenkinsopp.net>
Co-authored-by: Jakob Ackermann <das7pad@outlook.com>
2021-03-07 13:19:22 -05:00
Tom Limoncelli 21e85e6528
"Target" RecordConfig should not be exported (#1061)
* Unexport RecordConfig.Target
* Fix tests
* HEDNS: Fix usage of target field to resolve TXT handling (#1067)

Co-authored-by: Robert Blenkinsopp <robert@blenkinsopp.net>
2021-03-04 18:58:23 -05:00
Tom Limoncelli 541e6027aa
Improvements to fmt (#1076)
* fmt should include newline at end
* fmt should use stderr
2021-03-02 16:02:51 -05:00
Jan-Philipp Benecke 37b02b6540
New Feature: JS formatter and prettifier (#917)
FYI: This is an experimental feature. It depends on an external module that may not be supported in the long term.

* PoC: JS formatter
* No default value for output file
2021-03-02 15:51:27 -05:00
Tom Limoncelli c547beacc0
NEW FEATURE: Support Split Horizon DNS (#1034)
* Implement main feature
* BIND: Permit printf-like file name formats
* BIND: Make filenameformat work forwards and backwards.
* Fix extrator test cases
2021-02-05 12:12:45 -05:00
Tom Limoncelli 236cffa9b9 wrap more errors 2021-02-01 07:33:56 -05:00
Yuhui Xu 6efedd689d
New feature: FETCH() permits http gets in dnsconfig.js (#1007)
add PANIC() and error-handled FETCH()
2021-01-06 10:45:32 -05:00
Tom Limoncelli d6b191bae4
CLOUDFLARE: get-zones now outputs "orange cloud" status (#952)
* CLOUDFLARE: get-zones now outputs "orange cloud" status
2020-11-24 10:30:21 -05:00
Jan-Philipp Benecke 512aa7d4b3
NEW FEATURE: Set JS variables from command line (#913)
* Add ability to specify variables that are passed to js

* Use SplitN to respect a = in value part

* Add JSON parsing for cli variables

* Remove JSON parsing for cli variables

* Add a function to set CLI defaults

* Update static.go
2020-10-27 10:43:00 -04:00
Tom Limoncelli 74ea58f514 Better error messages 2020-09-21 09:39:45 -04:00
Andreas Lutro 8e9aa14882
print-ir: print validation warnings/errors to stderr (#841) 2020-08-31 16:01:56 -04:00
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 Limoncelli de308c0952
Lint: Fix ST1005: error strings should not be capitalized (#834) 2020-08-30 19:52:37 -04:00
Tom Limoncelli 541bb805da
linting (#777) 2020-07-06 20:18:24 -04:00
Tom Limoncelli 5f66991458 Fix failing test 2020-06-19 17:15:26 -04:00
Ben 84fd4ae33e
get-zone documentation and help fixes (#766) 2020-06-18 09:37:09 -04:00
Tom Limoncelli 6348b1d995
get-zones should comment out NAMESERVER() (#743)
* get-zones should comment out NAMESERVER()

* Edits
2020-05-22 10:20:10 -04:00
Tom Limoncelli 22b9afee3b
get-zones: generate R53_ALIAS right (#721)
* get-zones: generate R53_ALIAS right
* R53_ALIAS.md: Examples should use ' not "
* Handle TTLs
2020-04-20 11:48:34 -04:00
Tom Limoncelli 24b7d0641e Update github.com/StackExchange/dnscontrol/v2 2020-04-14 16:49:03 -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 4edf360854
get-zones output should work as input into preview (#688)
* Add tests for get-zones
* fix CAA, SSHFP, TLSA and other bugs
* New format for get-zones: "djs" which is js but uses "disco commas"
* Print diffs using github.com/andreyvit/diff

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2020-03-10 11:32:47 -04:00
Tom Limoncelli 58569c1253
Rename get-zones formats as pretty/dsl/tsv to zone/js/tsv (#687)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2020-03-09 11:42:48 -04:00
Tom Limoncelli a7e0ec258d
Add check-creds subcommand (#665) 2020-02-29 09:07:05 -05:00
Tom Limoncelli c98b922170
get-zones: NAMESERVER() never has TTL() (#658)
* NAMESERVER() never has TTL()

Fixes https://github.com/StackExchange/dnscontrol/issues/630
2020-02-27 23:56:49 -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 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 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
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 891c4162df
Upgrade urfave/cli to v2 (#614)
* Upgrade cli to v2
* Re-vendor
2020-02-03 12:44:11 -05:00
Tom Limoncelli f2c77b6541 linting 2020-02-02 09:50:07 -05:00
Tom Limoncelli fcccb2b9dc
LETS_ENCRYPT: Try all cert renewals before returning error. (#611) 2020-01-30 16:29:39 -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
wsuff b928e7c22f Fix typo in invalid cert name error message (#565)
BUG: validateCertificateList error message has valid spelled wrong.
2019-11-22 08:30:57 -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
Craig Peterson 364aac5073 fix format 2019-06-27 01:21:23 -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
Craig Peterson 5c03761fa6
notifications for get-certs command (#451) 2019-02-21 19:58:50 -05:00
Miguel Bernabeu Diaz d4947fce23 Add --expect-no-changes flag to preview (#449)
We want to offer a return-code oriented interface to detect changes
pending to be applied. The preview command, by default, returns 0
regardless of pending changes.

We add a flag, `--expect-no-changes`, that will return non-zero if
there are changes pending application, and 0 if there are none.
2019-02-13 20:11:26 -05:00
Craig Peterson f6b26f24c6
revert exit code changes. 2019-02-06 23:41:24 -05:00
Miguel Bernabeu Diaz b0715e96e4 Return error for pending corrections in preview (#438)
Return a non-zero error code if there are corrections for preview
step. This is especially useful for automated alerting and scripting
around changes to the zone not reflected in the configuration.
2019-02-01 09:30:04 -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
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