Commit graph

462 commits

Author SHA1 Message Date
Tom Limoncelli
703084160f
REFACTOR: BIND/GANDI_V5 add "RP" record type, rewrite CLOUDFLAREAPI CF_* and more (#3886)
# Issue

* New record type: "RP" (supported by BIND and GANDI_V5) 
* Cloudflare: CF_REDIRECT/CF_TEMP_REDIRECT now generate
CF_SINGLE_REDIRECT records. All PAGE_RULE-based code is removed.
PAGE_RULEs are deprecated at Cloudflare. (be careful when upgrading!)
* New "v2" RecordConfig: RP and CF_SINGLE_REDIRECT are the only record
types that use this method. It shifts most of the work out of JavaScript
and into the Go code, making new record types easier to make, easier to
test, and easier to use by providers. This opens the door to new things
like a potential code-generator for rtypes. Converting existing rtypes
will happen over the next year.
* When only the TTL changes (MODIFY-TTL), the output lists the TTL
change first, not at the end of the line where it is visually lost.
* CF_REDIRECT/CF_TEMP_REDIRECT generate different rule "names". They
will be updated the first time you "push" with this release. The order
of the rules may also change. If you rules depend on a particular order,
be very careful with this upgrade!

Refactoring:

* New "v2" RecordConfig: Record types using this new method simply
package the parameters from dnsconfig.js statements like
CF_REDIRECT(foo,bar) and send them (raw) to the Go code. The Go code
does all processing, validation, etc. and turns them into RecordConfig
that store all the rdata in `RecordConfig.F`. No more adding fields to
RecordConfig for each new record type!
* RecordConfig.IsModernType() returns true if the record uses the new v2
record mechanism.
* PostProcess is now a method on DnsConfig and DomainConfig.
* DOC: How to create new rtypes using the v2 method (incomplete)

Other things:

* Integration tests for CF "full proxy" are removed. This feature
doesn't exist any more.
* DEV: Debugger tips now includes VSCode advice
* TESTING: The names of testgroup's can now have extra spaces to make
data align better
* CF_TEMP_REDIRECT/CF_REDIRECT is now a "builder" that generates
CLOUDFLAREAPI_SINGLE_REDIRECT records.
* And more!

# Resolution

---------

Co-authored-by: Jakob Ackermann <das7pad@outlook.com>
2025-12-04 16:42:20 -05:00
Jiacheng
bcef7f52fc
ALIDNS: Implement ALIDNS Provider (#3878)
<!--
## Before submiting a pull request

Please make sure you've run the following commands from the root
directory.

    bin/generate-all.sh

(this runs commands like "go generate", fixes formatting, and so on)

## Release changelog section

Help keep the release changelog clear by pre-naming the proper section
in the GitHub pull request title.

Some examples:
* CICD: Add required GHA permissions for goreleaser
* DOCS: Fixed providers with "contributor support" table
* ROUTE53: Allow R53_ALIAS records to enable target health evaluation

More examples/context can be found in the file .goreleaser.yml under the
'build' > 'changelog' key.
!-->

https://github.com/StackExchange/dnscontrol/issues/420


Please create the GitHub label 'provider-ALIDNS'

---------

Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
2025-12-04 10:55:14 -05:00
Tom Limoncelli
7dc81bb4b1
CHORE: FIx lint in diff2 (#3885) 2025-12-04 10:30:19 -05:00
Tom Limoncelli
c11a523982
FEATURE: Fixing IDN support for domains (#3879)
# Issue

The previous fix had backwards compatibility issues and treated
uppercase Unicode incorrectly.

# Resolution

* Don't call strings.ToUpper() on Unicode strings. Only call it on the
output of ToASCII.
* Fix BIND's "filenameformat" to be more compatible (only breaks if you
had uppercase unicode in a domain name... which you probably didn't)
* Change IDN to ASCII in most places (Thanks for the suggestion,
@KaiSchwarz-cnic!)
* Update BIND documentation
2025-12-03 20:31:59 -05:00
Tom Limoncelli
e87f03a8a3
CHORE: fmt (#3882) 2025-12-03 14:53:02 -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
Tom Limoncelli
b8f2167bf9
BUGFIX: Reverse order of domain ascii/unicode displayed (#3872)
# Issue

Consensus in https://github.com/StackExchange/dnscontrol/pull/2874 is
that the domains should be displayed as:

    xn--p1ai.com (рф.com)
2025-12-02 10:47:11 -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
Patrik Kernstock
9aad2926fb
INWX: Fix INWX provider after their unexpected data-type breaking-change (#3855)
Fixes #3854 

Unfortunately I couldn't run the integrationTests properly as INWX
doesn't seem to have properly updated their sandbox environment (it
still presents `int` instead of `string` like production). Hence, the
tests do fail. I don't want to run this against my own production
account, to be frank.

See:
```shell
$ curl -X POST https://api.ote.domrobot.com/xmlrpc/ -H "Content-Type: application/xml" -d '<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
   <methodName>nameserver.info</methodName>
   <params>
      <param>
         <value>
            <struct>
               <member>
                  <name>user</name>
                  <value>
                     <string>[USER]</string>
                  </value>
               </member>
               <member>
                  <name>lang</name>
                  <value>
                     <string>en</string>
                  </value>
               </member>
               <member>
                  <name>pass</name>
                  <value>
                     <string>[PASS]</string>
                  </value>
               </member>
               <member>
                  <name>domain</name>
                  <value>
                     <string>[DOMAIN]</string>
                  </value>
               </member>
            </struct>
         </value>
      </param>
   </params>
</methodCall>' | xmllint --format - | grep -iE "id|roId" -C3
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3968    0  2971  100   997  13375   4488 --:--:-- --:--:-- --:--:-- 17954
            <value>
              <struct>
                <member>
                  <name>roId</name>
                  <value>
                    <int>9677</int>
                  </value>
--
                        <value>
                          <struct>
                            <member>
                              <name>id</name>
                              <value>
                                <int>118057</int>
                              </value>
--
                        <value>
                          <struct>
                            <member>
                              <name>id</name>
                              <value>
                                <int>118060</int>
                              </value>
--
                        <value>
                          <struct>
                            <member>
                              <name>id</name>
                              <value>
                                <int>79610</int>
                              </value>
--
                        <value>
                          <struct>
                            <member>
                              <name>id</name>
                              <value>
                                <int>77243</int>
                              </value>
--
            </value>
          </member>
          <member>
            <name>svTRID</name>
            <value>
              <string>20251127--ote</string>
            </value>
```

Hence, only done manualy tests via `dnscontrol push --domains
<example.com>`:
(tested create, delete and modify)

```text
CONCURRENTLY checking for 0 zone(s)
SERIALLY checking for 1 zone(s)
Serially checking for zone: "example.tld"
CONCURRENTLY gathering records of 0 zone(s)
SERIALLY gathering records of 1 zone(s)
Serially Gathering: "example.tld"
******************** Domain: example.tld
3 corrections (PK-INWX)
#1: - DELETE _test1.example.tld TXT "123" ttl=43200
SUCCESS!
#2: ± MODIFY _test2.example.tld TXT ("1234" ttl=43200) -> ("12345" ttl=43200)
SUCCESS!
#3: + CREATE _test4.example.tld TXT "123" ttl=43200
SUCCESS!
Done. 3 corrections.
```
2025-11-29 12:17:13 -05:00
Tom Limoncelli
4d29c2c2a5
NEW FEATURE: Empty creds.json should not be an error (#3844) 2025-11-21 10:46:18 -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
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
Matteo Trubini
b7c4cac759
fix(DKIM_BUILDER): allow empty pubkey (#3800) 2025-10-22 09:42:53 -04:00
Tom Limoncelli
db21e30abb
Update deps (#3790) 2025-10-10 14:16:46 -04:00
Tom Limoncelli
3eddfcd037
feat(validation): Validation errors now include the line number (#3788) 2025-10-10 13:48:41 -04:00
Jan von Aschwege
a71b89e5a2
NEW FEATURE: Add SMIMEA support for BIND and deSEC (#3786) 2025-10-10 11:16:13 -04:00
Tom Limoncelli
30d91d5f60
CHORE: Update deps (#3782) 2025-10-01 15:44:02 -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
networkException
f874b5fc1d
FEATURE: Support RFC 9495 issuemail tag in CAA records (#3762) 2025-09-05 16:07:42 -04:00
Amin Vakil
6e0c7b1c82
Make native telegram alert text similar to shoutrrr (#3750) 2025-08-29 10:50:27 -04:00
Tom Limoncelli
4ee1ed6ad2
CHORE: upgrade deps, fix OPENPGPKEY test (#3726) 2025-08-14 12:17:25 -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
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
633196e328
Warn if IGNORE() is unreliable for this provider (#3683) 2025-07-30 20:41:49 -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
78c2313d71
fmt (#3684) 2025-07-23 17:49:24 -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
Tom Limoncelli
a8a3ea73ba
CHORE: remove unused module pkg/acme (get-certs) (#3667) 2025-07-14 15:40:31 -04:00
James O'Gorman
74e1bb50da
BUG: Output better "version" string when running main.go directly (#3658) 2025-07-09 16:35:23 -04:00
Tom Limoncelli
8a6baa7c24 Reapply "CHORE: Remove the MSDNS provider (#3656)"
This reverts commit e9f136036f.
2025-07-09 13:07:03 -04:00
Tom Limoncelli
e9f136036f Revert "CHORE: Remove the MSDNS provider (#3656)"
This reverts commit 1ccd5eb532.
2025-07-09 13:06:42 -04:00
Tom Limoncelli
1ccd5eb532
CHORE: Remove the MSDNS provider (#3656) 2025-07-09 12:47:48 -04:00
Ishan Jain
e1830abb58
NEW PROVIDER: ADGUARDHOME (#3638) 2025-07-09 12:06:34 -04:00
James O'Gorman
4ce19352e9
PORKBUN: Improve retry handling, mark as concurrent (#3652) 2025-07-09 12:03:59 -04:00
James O'Gorman
cd8892f9bb
BUG: User-Agent should include DNSControl version (#3653)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-07-09 10:56:38 -04:00
Tom Limoncelli
874ba798d4
REFACTOR: Rename commands/zonecache.go (#3646) 2025-06-30 16:16:58 -04:00
Tom Limoncelli
d37736e1f0
CHORE: Linting (#3645) 2025-06-30 13:35:12 -04:00
Hamish Moffatt
d042b3edf7
FEATURE: --notify now makes errors visible to make debugging easier (#3614) 2025-06-12 10:03:46 -04:00
Max Chernoff
3ea7ea84c9
FEATURE: Support ignoring the ech= parameter in HTTPS/SVCB RR types (#3485) 2025-06-11 11:16:15 -04:00
Eli Heady
d0fffaf8c2
BUGFIX: types fix: CAA_BUILDER accepts string[] or string for issue (#3546) 2025-05-03 08:21:44 -04:00
Tom Limoncelli
7a4c16f447
BUGFIX: REV fails in D_EXTEND for IPv6 addresses (#3552) 2025-05-03 08:20:44 -04:00
Tom Limoncelli
475f99b8d5
bug(rev) D_EXTEND does not work with REV (#3488) 2025-03-21 12:39:23 -04:00
Steven Rombauts
063d8b06e8
BUNNY_DNS: Add support for Redirect record (#3472) 2025-03-07 09:07:25 -05:00
Jan-Piet Mens
f8ae1ee8c4
Bug: HASH() outputs debug info (#3483) 2025-03-07 09:06:32 -05:00
Eli Heady
48c99f7065
Improve tagged domain handling in support of Split Horizon feature (#3444)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-02-25 12:27:24 -05:00
Costas Drogos
4f5655e510
NS1: remove deprecated NS1_URLFWD (#3400)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2025-01-27 10:29:26 -05:00
Tom Limoncelli
70e9659014
MSDNS: Provider is failing due to lint fix gone wrong (#3396) 2025-01-21 14:29:53 -05:00