Commit graph

425 commits

Author SHA1 Message Date
Sukka
00f1bd8e85
DOCS: Update Vercel provider docs (#3877)
Made a few mistakes when creating the initial version of the docs back
in #3542

Fix typos, adjust a few wordings, descriptions, etc.

Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-12-03 09:11:16 -05:00
tridion
f1b30a1a04
feat: Add IGNORE_EXTERNAL_DNS() for Kubernetes external-dns coexistence (#3869)s
## Summary

This PR adds a new domain modifier `IGNORE_EXTERNAL_DNS()` that
automatically detects and ignores DNS records managed by Kubernetes
[external-dns](https://github.com/kubernetes-sigs/external-dns)
controller.

**Related Issue:** This addresses the feature request discussed in
StackExchange/dnscontrol#935 (Idea: Ownership system), where
@tlimoncelli indicated openness to accepting a PR for this
functionality.

## Problem

When running DNSControl alongside Kubernetes external-dns, users face a
challenge:

- **external-dns** dynamically creates DNS records based on Kubernetes
Ingress/Service resources
- Users cannot use `IGNORE()` because they cannot predict which record
names external-dns will create
- Using `NO_PURGE()` is too broad - it prevents DNSControl from cleaning
up any orphaned records

The fundamental issue is that `IGNORE()` requires static patterns known
at config-time, but external-dns creates records dynamically at runtime.

## Solution

`IGNORE_EXTERNAL_DNS()` solves this by detecting external-dns managed
records at runtime:

```javascript
D("example.com", REG_CHANGEME, DnsProvider(DSP_MY_PROVIDER),
    IGNORE_EXTERNAL_DNS(),  // Automatically ignore external-dns managed records
    A("@", "1.2.3.4"),
    CNAME("www", "@")
);
```

### How It Works

external-dns uses a TXT record registry to track ownership. For each
managed record, it creates a TXT record like:

- `a-myapp.example.com` → TXT containing
`heritage=external-dns,external-dns/owner=...`
- `cname-api.example.com` → TXT containing
`heritage=external-dns,external-dns/owner=...`

This PR:
1. Scans existing TXT records for the `heritage=external-dns` marker
2. Parses the TXT record name prefix (e.g., `a-`, `cname-`) to determine
the managed record type
3. Automatically adds those records to the ignore list during diff
operations

## Changes

| File | Purpose |
|------|---------|
| `models/domain.go` | Add `IgnoreExternalDNS` field to DomainConfig |
| `pkg/js/helpers.js` | Add `IGNORE_EXTERNAL_DNS()` JavaScript helper |
| `pkg/diff2/externaldns.go` | Core detection logic for external-dns TXT
records |
| `pkg/diff2/externaldns_test.go` | Unit tests for detection logic |
| `pkg/diff2/handsoff.go` | Integrate external-dns detection into
handsoff() |
| `pkg/diff2/diff2.go` | Pass IgnoreExternalDNS flag to handsoff() |
| `commands/types/dnscontrol.d.ts` | TypeScript definitions for IDE
support |
| `documentation/.../IGNORE_EXTERNAL_DNS.md` | User documentation |

## Design Philosophy

This follows DNSControl's pattern of convenience builders (like
`M365_BUILDER`, `SPF_BUILDER`, `DKIM_BUILDER`) that make complex
operations simple. Just as those builders abstract away implementation
details, `IGNORE_EXTERNAL_DNS()` abstracts away the complexity of
detecting external-dns managed records.

## Testing

All unit tests pass:
```
go test ./pkg/diff2/... -v  # Tests detection logic
go test ./pkg/js/...        # Tests JS helpers
go build ./...              # Builds successfully
```

## Caveats Documented

- Only supports TXT registry (the default for external-dns)
- Requires external-dns to use default naming conventions
- May need updates if external-dns changes its registry format

---------

Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-12-03 08:56:55 -05:00
Patrik Kernstock
6e42ccfb31
INWX: Enable concurrency support (#3856)
Tested dnscontrol with `CanConcur()` enabled and seems to work fine.
Read #2873 to see what to do, and hope below is the right way to test.

```text
$ go build -race -o dnscontrol-race
$ ./dnscontrol-race version
v4.27.2-0.20251127184623-cf6b870052c0+dirty

$ dnscontrol-race preview
CONCURRENTLY checking for 16 zone(s)
SERIALLY checking for 6 zone(s)
Serially checking for zone: "domainX.tld"
Serially checking for zone: "domainX.tld"
Serially checking for zone: "domainX.tld"
Serially checking for zone: "domainX.tld"
Serially checking for zone: "domainX.tld"
Serially checking for zone: "domainX.tld"
Waiting for concurrent checking(s) to complete...DONE
CONCURRENTLY gathering records of 16 zone(s)
SERIALLY gathering records of 6 zone(s)
Serially Gathering: "domainX.tld"
Serially Gathering: "domainX.tld"
Serially Gathering: "domainX.tld"
Serially Gathering: "domainX.tld"
Serially Gathering: "domainX.tld"
Serially Gathering: "domainX.tld"
Waiting for concurrent gathering(s) to complete...DONE
******************** Domain: domainX.tld
INFO#1: 4 records not being deleted because of NO_PURGE:
[...]
******************** Domain: domainX.tld
******************** Domain: domainX.tld
INFO#1: 4 records not being deleted because of NO_PURGE:
[...]
******************** Domain: domainX.tld
******************** Domain: domainX.tld
******************** Domain: domainX.tld
1 correction (PK-INWX)
INFO#1: 1 records not being deleted because of IGNORE*():
[...]
******************** Domain: domainX.tld
******************** Domain: domainX.tld
******************** Domain: domainX.tld
******************** Domain: domainX.tld
30 corrections (PK-INWX)
[...]
******************** Domain: domainX.tld
******************** Domain: domainX.tld
2 corrections (PK-INWX)
[...]
******************** Domain: domainX.tld
******************** Domain: domainX.tld
******************** Domain: domainX.tld
******************** Domain: domainX.tld
2 corrections (PK-INWX)
[...]
******************** Domain: domainX.tld
******************** Domain: domainX.tld
Done. 37 corrections.
```

Unfortunately INWX sandbox is sporadically still broken so `go test` is
of limited help:
```text
$ go test -v -verbose -profile INWX
=== RUN   TestDNSProviders
Testing Profile="INWX" (TYPE="INWX")
    helpers_test.go:122: INWX: Unable to login
--- FAIL: TestDNSProviders (30.03s)
=== RUN   TestDualProviders
Testing Profile="INWX" (TYPE="INWX")
    provider_test.go:50: Clearing everything
    provider_test.go:57: Adding test nameservers
    provider_test.go:44: #1:
        + CREATE dnscontrol-inwx.com NS ns1.example.com. ttl=300
    provider_test.go:44: #2:
        + CREATE dnscontrol-inwx.com NS ns2.example.com. ttl=300
    provider_test.go:60: Running again to ensure stability
    provider_test.go:76: Removing test nameservers
    provider_test.go:44: #1:
        - DELETE dnscontrol-inwx.com NS ns1.example.com. ttl=300
    provider_test.go:44: #2:
        - DELETE dnscontrol-inwx.com NS ns2.example.com. ttl=300
--- PASS: TestDualProviders (2.44s)
=== RUN   TestNameserverDots
Testing Profile="INWX" (TYPE="INWX")
=== RUN   TestNameserverDots/No_trailing_dot_in_nameserver
--- PASS: TestNameserverDots (0.30s)
    --- PASS: TestNameserverDots/No_trailing_dot_in_nameserver (0.00s)
=== RUN   TestDuplicateNameservers
Testing Profile="INWX" (TYPE="INWX")
    provider_test.go:145: Skipping. Deduplication logic is not implemented for this provider.
--- SKIP: TestDuplicateNameservers (0.35s)
FAIL
exit status 1
FAIL    github.com/StackExchange/dnscontrol/v4/integrationTest  33.127s
```
2025-12-01 09:13:06 -05:00
Kevin Ji
ec9a9e23af
CLOUDFLARE: Add LOC support (#3857)
Fixes #2798.

I tested this locally and it seems to update the `LOC` record correctly.
2025-12-01 09:12:10 -05:00
Sukka
daf5a7a501
VERCEL: Implement Vercel DNS Provider (#3379) (#3542)
Fixes https://github.com/StackExchange/dnscontrol/issues/3379

Thanks to @SukkaW for adding this provider!  Even though you claimed to be "not familiar with Go at all" the new code looks excellent!  Great job!
2025-12-01 08:41:56 -05:00
Jakob Ackermann
1e67585e8f
HETZNER_V2: Add provider for Hetzner DNS API (#3837)
Closes https://github.com/StackExchange/dnscontrol/issues/3787

This PR is adding a `HETZNER_V2` provider for the "new" Hetzner DNS API.

Testing:
- The integration tests are passing.
- Manual testing:
  - `preview` (see diff for existing zone)
- `preview --populate-on-preview` (see full diff for newly created zone)
  - `push` (see full diff; no diff after push)
- `push` (see full diff; no diff after push to newly created zone --
i.e. single pass and done)

```js
var REG_NONE = NewRegistrar('none')
var DSP = NewDnsProvider('HETZNER_V2')

D('testing-2025-11-14-7.dev', REG_NONE, DnsProvider(DSP),
    A('@', '127.0.0.1')
)
```

<details>

```
# push for newly created zone
CONCURRENTLY checking for 1 zone(s)
SERIALLY checking for 0 zone(s)
Waiting for concurrent checking(s) to complete...DONE
******************** Domain: testing-2025-11-14-7.dev
1 correction (HETZNER_V2)
#1: Ensuring zone "testing-2025-11-14-7.dev" exists in "HETZNER_V2"
SUCCESS!
CONCURRENTLY gathering records of 1 zone(s)
SERIALLY gathering records of 0 zone(s)
Waiting for concurrent gathering(s) to complete...DONE
******************** Domain: testing-2025-11-14-7.dev
4 corrections (HETZNER_V2)
#1: ± MODIFY-TTL testing-2025-11-14-7.dev NS helium.ns.hetzner.de. ttl=(3600->300)
± MODIFY-TTL testing-2025-11-14-7.dev NS hydrogen.ns.hetzner.com. ttl=(3600->300)
± MODIFY-TTL testing-2025-11-14-7.dev NS oxygen.ns.hetzner.com. ttl=(3600->300)
SUCCESS!
#2: + CREATE testing-2025-11-14-7.dev A 127.0.0.1 ttl=300
SUCCESS!
Done. 5 corrections.
```
</details>

Feedback for @jooola and @LKaemmerling:
- The SDK was very useful in getting 80% there! Nice! 🎉 
- Footgun:
- The `result` values are not "up-to-date" after waiting for an
`Action`, e.g. `Zone.AuthoritativeNameservers.Assigned` is not set when
`Client.Zone.Create()` returns and the following "wait" will not update
it.
- Taking a step back here: Waiting for an `Action` with a separate SDK
call does not seem very natural to me. Does the SDK-user need to know
that you are processing operations asynchronous? (Which seems like an
implementation detail to me, something that the SDK could abstrct over.)
Can `Client.Zone.Create()` return the final `Zone` instead of the
intermediate result?
- Features missing compared to the DNS Console, in priority order:
- It is no longer possible to remove your provided name servers from the
root/apex. Use-case: dual-home/multi-home zone with fewer than three
servers from Hetzner. I'm operating one of these and cannot migrate over
until this is fixed.
- Performance regression due to lack of bulk create/modify. E.g. [one of
the test
suites](a71b89e5a2/integrationTest/integration_test.go (L619))
spends about 4.5 minutes on making creating 100 record-sets and then
another 4 minutes for deleting them in sequence again. With your async
API, these are `create 2*100 + delete 2*100 = 400` API calls.
Previously, these were `create 1 + delete 100 = 101` API calls. Are you
planning on adding batch processing again?
- Usability nits
- Compared to other record-set based APIs, upserts for record-sets are
missing. This applies to records of a record-set and the ttl of the
record-set (see separate SDK calls for the cases `diff2.CREATE` vs
`diff2.CHANGE` and two calls in `diff2.CHANGE` for updating the TTL vs
records).
- Some SDK methods return an `Action` (e.g. `Zone.ChangeRRSetTTL()`),
others wrap the `Action` in a struct (`Client.Zone.CreateRRSet()`) --
even when the struct has a single field (`ZoneRRSetDeleteResult`).

---------

Co-authored-by: "Jonas L." <jooola@users.noreply.github.com>
Co-authored-by: "Lukas Kämmerling" <LKaemmerling@users.noreply.github.com>
Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-11-30 09:14:54 -05:00
Tom Limoncelli
1b2f5d4d34
BUGFIX: IDN support is broken for domain names (#3845)
# Issue

Fixes https://github.com/StackExchange/dnscontrol/issues/3842

CC @das7pad

# Resolution

Convert domain.Name to IDN earlier in the pipeline. Hack the --domains
processing to convert everything to IDN.

* Domain names are now stored 3 ways: The original input from
dnsconfig.js, canonical IDN format (`xn--...`), and Unicode format. All
are downcased. Providers that haven't been updated will receive the IDN
format instead of the original input format. This might break some
providers but only for users with unicode in their D("domain.tld").
PLEASE TEST YOUR PROVIDER.
* BIND filename formatting options have been added to access the new
formats.

# Breaking changes

* BIND zonefiles may change. The default used the name input in the D()
statement. It now defaults to the IDN name + "!tag" if there is a tag.
* Providers that are not IDN-aware may break (hopefully only if they
weren't processing IDN already)

---------

Co-authored-by: Jakob Ackermann <das7pad@outlook.com>
2025-11-29 12:17:44 -05:00
Gabe Van Engel
bdf8bef203
DEPS: Switch to maintained fork of shoutrrr (#3838) 2025-11-17 11:52:26 -05:00
Gabe Van Engel
97209bc2fc
AKAMAIEDGEDNS: Add ALIAS and AKAMAITLC support to the Akamai Edge DNS provider (#3836) 2025-11-14 09:48:42 -05:00
Kevin Neufeld
9d4cb301f3
feat(report): --report output now includes detailed list of changes (#3835) 2025-11-13 13:16:32 -05:00
Elvis Ratzlaff
8f13dd1030
POWERDNS: Split horizon feature now enabled by flag (#3829) 2025-11-04 09:15:24 -05:00
Peter Feigl
25dd06aaa3
POWERDNS: Map dnscontrol Tags to powerdns Variants (#3803)
Co-authored-by: Peter Feigl <peter.feigl@nexoid.at>
Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-11-03 11:46:09 -05:00
Eli Heady
c1b90d06a0
INWX: Let the API (not DNSControl) enforce the RFC 7505 prohibition of mixed regular/null MX records (#3805)
Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-11-03 11:44:40 -05:00
Kevin Neufeld
24f602a5a1
feat(Route53): Add support for RoleArn and ExternalId #3816 (#3817)
Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-11-03 11:38:13 -05:00
Vincent Hagen
f365902508
DOCS: Add internals for ordering (#3811) 2025-11-03 11:33:21 -05:00
Matteo Trubini
d8aa89028e
refactor(DKIM_BUILDER): improve input validation and error handling (#3812) 2025-11-03 11:33:09 -05:00
Elvis Ratzlaff
2a4e2509bc
POWERDNS: New record type: LUA (#3815) 2025-11-03 11:32:28 -05:00
Peter
6ef0648778
NETCUP: add TLSA support (#3802) 2025-10-23 10:41:35 -04:00
Tom Limoncelli
237de6f2e1
docs(backups) Emphasize the warning about BIND backups (#3799) 2025-10-21 10:43:43 -04:00
Jan von Aschwege
a71b89e5a2
NEW FEATURE: Add SMIMEA support for BIND and deSEC (#3786) 2025-10-10 11:16:13 -04:00
Louis Laureys
2122390f29
DOCS: Fill some question marks for cloudns (#3767)
Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-10-01 15:47:50 -04:00
Paul Sütterlin
589cb77c68
CAA: Support issuemail / issuevmc tag in CAA builder (#3774)
Co-authored-by: Paul Sütterlin <psuet@kawo1.rwth-aachen.de>
2025-09-22 16:12:30 -04:00
Tom Limoncelli
f2ff95a20e
FEATURE: Optionally disable spfcache.json (#3765)
Co-authored-by: Jeffrey Cafferata <jeffrey@jcid.nl>
2025-09-13 12:23:46 -04:00
Eli Heady
cca9a1e433
DESEC: improve formatting of DS records on domain creation (#3766) 2025-09-12 11:04:01 -04:00
Eli Heady
8b73de0765
DOCS: Fix many minor typos (#3752)
Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-09-02 11:00:25 -04:00
Mynacol
a41e8d20e8
DOCS: AXFR+DDNS uses TCP by default (#3713)
Co-authored-by: Mynacol <Mynacol@users.noreply.github.com>
Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-08-28 12:27:58 -04:00
James O'Gorman
89ac03faca
PORKBUN: Configurable retry parameters (#3746) 2025-08-28 12:24:40 -04:00
Klemens Nanni
9edeb73d76
DOCS: Added requested provider Yandex Cloud DNS (#3738) 2025-08-24 09:21:22 -04:00
Jeffrey Cafferata
60bbab6fa1
DOCS: Clarification on quotes in TXT record. (#3721) 2025-08-13 09:58:19 -04:00
Georg
e79c43f6eb
DOCS/rtypes: consistently use pushd (#3719)
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-08-11 11:06:38 -04:00
Georg
8c8948e69a
NEW RECORD TYPE: OPENPGPKEY (basic) (#3718)
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-08-11 10:44:12 -04:00
Jeffrey Cafferata
b2c88ac762
DOCS: AdGuardHome feedback (#3701) 2025-08-09 10:36:38 -04:00
Alex Trull
ca64774004
Joker: Implement DNS Provider (#3661)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-08-04 16:37:20 -04:00
Tom Limoncelli
b947bddf95
CHORE: generate-all.sh (#3699) 2025-07-30 20:49:54 -04:00
Tom Limoncelli
b0a57e5c3e
DOCS: Improve docs and error messages related to apex domains (#3690) 2025-07-30 20:43:42 -04:00
Jeffrey Cafferata
088ea41ee1
DOCS: Getting started get-zones (feedback) (#3700) 2025-07-30 20:43:12 -04:00
Andrew Backeby
a9243aa554
DOCS: Improve grammar/typos in AXFR+DDNS provider documentation (#3697) 2025-07-30 09:28:57 -04:00
Tom Limoncelli
1f86d69b09
DOCS: Warn that "" should be "@" in error messages & docs. Update docs to suggest safer onboarding process. (#3691) 2025-07-29 14:50:59 -04:00
Tom Limoncelli
b578604d48 Revert "Add docs"
This reverts commit 51b50565d1.
2025-07-24 14:59:04 -04:00
Tom Limoncelli
51b50565d1 Add docs 2025-07-24 14:58:23 -04:00
Paul Donald
e84925b491
Loopia: feature updates (#3686) 2025-07-24 14:41:57 -04:00
Phil Pennock
3f4f9b8083
DNSIMPLE: DOCS: handle multiple provider instances (#3678) 2025-07-22 12:51:21 -04:00
Phil Pennock
ecbc4992d0
DOCS: expand upon concurrency (#3676) 2025-07-22 10:01:10 -04:00
Phil Pennock
af5907aafd
DNSIMPLE: preview data is now gathered concurrently (CanConcur) (#3675) 2025-07-21 15:09:44 -04:00
Ishan Jain
58afc59440
ADGUARDHOME: updated documentation with links to AGH pages (#3672) 2025-07-21 09:25:59 -04:00
Costas Drogos
c842eb26a5
NEW FEATURE: DKIM_BUILDER() adds a DKIM record builder (#3627)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-07-18 10:38:50 -04:00
Klett IT
a815bdcf45
FORTIGATE: Add NS and MX record support (#3671)
Co-authored-by: Klett IT <git@klett-it.net>
2025-07-18 10:22:37 -04:00
e9b49e23aa
LUADNS: Support HTTPS record type, enable concurrency, adopt newest SDK (#3640) 2025-07-10 10:50:33 -04:00
Tom Limoncelli
a0d04a181a
CHORE: Remove "get-certs" command (#3657) 2025-07-09 14:01:23 -04:00
Tom Limoncelli
c5e9cd1cb4 Revert "Remove docs"
This reverts commit e0e610c6ca.
2025-07-09 13:07:46 -04:00