aboutsummaryrefslogtreecommitdiffstats
path: root/dns
diff options
context:
space:
mode:
Diffstat (limited to 'dns')
-rw-r--r--dns/README.md57
-rw-r--r--dns/bootstrap/user._bitcoin-payment.coinos.io.zone6
-rw-r--r--dns/bootstrap/user._bitcoin-payment.staging.coinos.io.zone6
-rw-r--r--dns/primary.conf58
-rw-r--r--dns/secondary.conf37
5 files changed, 164 insertions, 0 deletions
diff --git a/dns/README.md b/dns/README.md
new file mode 100644
index 0000000..f730ff8
--- /dev/null
+++ b/dns/README.md
@@ -0,0 +1,57 @@
+# BIP-353 DNS (Knot)
+
+`₿[email protected]` resolves through a DNSSEC-signed TXT record at
+`name.user._bitcoin-payment.coinos.io`. Cloudflare caps a zone at 3,500 records
+(Pro), and one record per name had coinos.io at 3,038 on 2026-11-16, so the
+per-name records live on our own Knot DNS instead:
+
+```
+Cloudflare (coinos.io zone, DNSSEC)
+ dns1.coinos.io A 51.79.52.200 (DNS only)
+ user._bitcoin-payment.coinos.io NS dns1.coinos.io + DS (the zone's KSK)
+ user._bitcoin-payment.staging.coinos.io NS dns1.coinos.io + DS
+ │
+ovh2 knot-bip353 public secondary, answers the internet (secondary.conf)
+ │ NOTIFY / AXFR+IXFR over Tailscale, TSIG key `xfr`
+cs dns hidden primary, signs the zones (primary.conf, compose `dns`)
+ │ RFC 2136 UPDATE over the compose network, TSIG key `names-update`
+cs names the registrar (names/dns-update.js), domains with `knot` in its config
+```
+
+## cs (primary)
+
+- State: `$STATE/dns/keys.conf` (both TSIG keys, `key:` list) and
+ `$STATE/dns/storage/` (zone files, journal, DNSSEC keys — back it up; losing
+ the KSK means a new DS in Cloudflare).
+- The compose service publishes port 53 on cs's Tailscale address only.
+- `docker exec dns knotc zone-status`, `docker exec dns kdig @127.0.0.1 TXT adam.user._bitcoin-payment.coinos.io`.
+- DS for Cloudflare: `docker exec dns keymgr user._bitcoin-payment.coinos.io ds` (the SHA-256 line).
+- The KSK never rolls by itself (`ksk-lifetime: 0`); ZSKs roll every 90 days
+ without anyone's help.
+
+## names config
+
+```json
+"coinos.io": { "zoneId": "…", "knot": { "zone": "user._bitcoin-payment.coinos.io", "server": "dns", "port": 53,
+ "key": { "name": "names-update", "secret": "<base64 from keys.conf>" } } }
+```
+
+One-shot moves (`names/dns-migrate.js`, inside the names container):
+`backfill` (every name → Knot), `check` (Knot matches the database),
+`cf-cleanup` (delete the per-name TXT records from Cloudflare).
+
+## ovh2 (public secondary)
+
+Installed by hand (ovh2 has no deploy hook):
+
+```
+/etc/knot-bip353/knot.conf = dns/secondary.conf
+/etc/knot-bip353/keys.conf = the `xfr` key only
+/var/lib/knot-bip353/ storage
+docker run -d --name knot-bip353 --network host --restart unless-stopped \
+ -v /etc/knot-bip353/knot.conf:/config/knot.conf:ro -v /etc/knot-bip353/keys.conf:/keys/keys.conf:ro \
+ -v /var/lib/knot-bip353:/storage cznic/knot:3.4 knotd -c /config/knot.conf
+ufw allow 53/udp; ufw allow 53/tcp
+```
+
+A config change there: copy the file over, `docker restart knot-bip353`.
diff --git a/dns/bootstrap/user._bitcoin-payment.coinos.io.zone b/dns/bootstrap/user._bitcoin-payment.coinos.io.zone
new file mode 100644
index 0000000..02be942
--- /dev/null
+++ b/dns/bootstrap/user._bitcoin-payment.coinos.io.zone
@@ -0,0 +1,6 @@
+; first contents only: the zone lives in Knot's journal after this, and the
+; names registrar fills it (names/dns-update.js)
+$ORIGIN user._bitcoin-payment.coinos.io.
+$TTL 300
+@ SOA dns1.coinos.io. hostmaster.coinos.io. 1 3600 600 1209600 300
+@ NS dns1.coinos.io.
diff --git a/dns/bootstrap/user._bitcoin-payment.staging.coinos.io.zone b/dns/bootstrap/user._bitcoin-payment.staging.coinos.io.zone
new file mode 100644
index 0000000..1d52fba
--- /dev/null
+++ b/dns/bootstrap/user._bitcoin-payment.staging.coinos.io.zone
@@ -0,0 +1,6 @@
+; first contents only: the zone lives in Knot's journal after this, and the
+; names registrar fills it (names/dns-update.js)
+$ORIGIN user._bitcoin-payment.staging.coinos.io.
+$TTL 300
+@ SOA dns1.coinos.io. hostmaster.coinos.io. 1 3600 600 1209600 300
+@ NS dns1.coinos.io.
diff --git a/dns/primary.conf b/dns/primary.conf
new file mode 100644
index 0000000..6aa1efb
--- /dev/null
+++ b/dns/primary.conf
@@ -0,0 +1,58 @@
+# Knot DNS, hidden primary on cs, for the BIP-353 records (names/dns-update.js).
+# Cloudflare's coinos.io zone delegates user._bitcoin-payment.coinos.io (and
+# the staging one) here with NS + DS records; Knot signs the zones (DNSSEC)
+# and the registrar changes them with TSIG-signed UPDATEs over the compose
+# network. Nothing on the internet reaches this server: ovh2 runs the public
+# secondary (dns/secondary.conf), notified and transferred over Tailscale.
+# Keys (TSIG names-update and xfr) live in the state dir, never in git.
+server:
+ listen: 0.0.0.0@53
+ rundir: /rundir
+
+include: /keys/keys.conf
+
+remote:
+ - id: ovh2
+ address: 100.120.75.121@53
+ key: xfr
+
+acl:
+ - id: names_update
+ key: names-update
+ action: update
+ update-type: TXT
+ - id: xfr_ovh2
+ key: xfr
+ action: transfer
+
+# The KSK never rolls on its own: its DS sits in Cloudflare by hand.
+policy:
+ - id: ecdsa
+ algorithm: ecdsap256sha256
+ ksk-lifetime: 0
+ zsk-lifetime: 90d
+ nsec3: on
+ nsec3-iterations: 0
+ nsec3-salt-length: 0
+
+template:
+ - id: default
+ storage: /storage
+ file: "%s.zone"
+ dnssec-signing: on
+ dnssec-policy: ecdsa
+ serial-policy: unixtime
+ journal-content: all
+ zonefile-load: difference-no-serial
+ zonefile-sync: 60
+ semantic-checks: on
+ notify: ovh2
+ acl: [names_update, xfr_ovh2]
+
+log:
+ - target: stdout
+ any: info
+
+zone:
+ - domain: user._bitcoin-payment.coinos.io
+ - domain: user._bitcoin-payment.staging.coinos.io
diff --git a/dns/secondary.conf b/dns/secondary.conf
new file mode 100644
index 0000000..a6f6c90
--- /dev/null
+++ b/dns/secondary.conf
@@ -0,0 +1,37 @@
+# Knot DNS, public secondary on ovh2 (51.79.52.200, dns1.coinos.io) for the
+# BIP-353 zones signed by the primary on cs (dns/primary.conf). It answers
+# the internet and keeps answering while cs or its uplink is down.
+# Installed by hand on ovh2: /etc/knot-bip353/{knot.conf,keys.conf}, docker
+# container `knot-bip353` (host network). See dns/README.md.
+server:
+ listen: [ 51.79.52.200@53, 100.120.75.121@53 ]
+ rundir: /rundir
+
+include: /keys/keys.conf
+
+remote:
+ - id: cs
+ address: 100.119.250.121@53
+ key: xfr
+
+acl:
+ - id: notify_cs
+ address: 100.119.250.121
+ key: xfr
+ action: notify
+
+template:
+ - id: default
+ storage: /storage
+ file: "%s.zone"
+ master: cs
+ acl: notify_cs
+ zonefile-sync: 60
+
+log:
+ - target: stdout
+ any: info
+
+zone:
+ - domain: user._bitcoin-payment.coinos.io
+ - domain: user._bitcoin-payment.staging.coinos.io