From a315ef48e25d08fe0406092dd6085b5a9a7343d4 Mon Sep 17 00:00:00 2001 From: lilly Date: Sun, 6 Dec 2026 15:09:32 +0100 Subject: [PATCH] add local PTR records in z9 to pass rfc7050 validation We configure dns64 in unbound which also automatically includes the capability to communicate the local nat64 prefix to clients via DNS as a mechanism. This mostly *just works* except that a validation of the received information is required by RFC7050 which needs requires explicit unbound configuration. That configuration is implemented here. --- inventories/z9/host_vars/z9-router.yaml | 5 +++++ roles/unbound/README.md | 2 ++ roles/unbound/defaults/main.yml | 1 + roles/unbound/meta/argument_specs.yaml | 5 +++++ roles/unbound/templates/unbound.conf.j2 | 4 ++++ 5 files changed, 17 insertions(+) diff --git a/inventories/z9/host_vars/z9-router.yaml b/inventories/z9/host_vars/z9-router.yaml index 2ff62e0..b6459fb 100644 --- a/inventories/z9/host_vars/z9-router.yaml +++ b/inventories/z9/host_vars/z9-router.yaml @@ -6,6 +6,11 @@ ansible_pull__timer_randomized_delay_sec: 0min unbound_access_control: [ "10.89.208.0/20", "2a07:c481:1::/48" ] unbound_enable_dns64: true unbound_dns64_prefix: "{{ jool_nat64__prefix }}" +unbound_local_ptr: + - "64:ff9b::c000:aa ipv4only.arpa." + - "64:ff9b::c000:ab ipv4only.arpa." + - "192.0.0.170 ipv4only.arpa." + - "192.0.0.171 ipv4only.arpa." deploy_systemd_resolved_config__enable: false deploy_systemd_resolved_config__dns: - 127.0.0.1 diff --git a/roles/unbound/README.md b/roles/unbound/README.md index d425466..4bbcfcd 100644 --- a/roles/unbound/README.md +++ b/roles/unbound/README.md @@ -27,4 +27,6 @@ The following variables can be used to customize this role: Defaults to `[]` - `unbound_enable_dns64`: Whether dns64 module should be loaded. If defined, the `unbound_dns64_prefix` option must also be set. - `unbound_dns64_prefix`: The prefix in which AAAA records are synthesized when upstream only returns an A record +- `unbound_local_ptr`: List of [local-data-ptr](https://unbound.docs.nlnetlabs.nl/en/latest/manpages/unbound.conf.html#unbound-conf-local-data-ptr) strings that will be added to the unbound config. + Defaults to `[]` diff --git a/roles/unbound/defaults/main.yml b/roles/unbound/defaults/main.yml index d166d68..8ca15a3 100644 --- a/roles/unbound/defaults/main.yml +++ b/roles/unbound/defaults/main.yml @@ -7,3 +7,4 @@ unbound_access_control: [ ] unbound_private_domain: [ ] unbound_enable_dns64: false unbound_dns64_prefix: ~ +unbound_local_ptr: [ ] diff --git a/roles/unbound/meta/argument_specs.yaml b/roles/unbound/meta/argument_specs.yaml index 7a60ec9..6a08be5 100644 --- a/roles/unbound/meta/argument_specs.yaml +++ b/roles/unbound/meta/argument_specs.yaml @@ -44,3 +44,8 @@ argument_specs: unbound_dns64_prefix: type: str required: false + + unbound_local_ptr: + type: list + elements: str + required: false diff --git a/roles/unbound/templates/unbound.conf.j2 b/roles/unbound/templates/unbound.conf.j2 index 67e532e..c99f137 100644 --- a/roles/unbound/templates/unbound.conf.j2 +++ b/roles/unbound/templates/unbound.conf.j2 @@ -49,6 +49,10 @@ server: dns64-prefix: "{{ unbound_dns64_prefix }}" {% endif -%} + {% for i in unbound_local_ptr -%} + local-data-ptr: "{{ i }}" + {% endfor -%} + # The number of seconds between printing statistics to the log for every thread. statistics-interval: 0