I'm happy to report success. My first challenge was to get stubby working, testing it within the router wasn't easy. I didn't want to install tools that pulled dependencies that could break the OS.
The working config is this in case someone needs it:
I've left a couple of commented out lines so we can see the format that is needed in.
Then on Unbound custom options:
If I entered my OPNSense LAN address it wouldn't work. All tests from OPNSense would give servfail and unfortunately there are no logs to tell why. It was trial and error. Enable DNSSEC support in Unbound is not selected.
In System, General, Settings the DNS has 127.0.0.1. Again the LAN ip wouldn't work. There are no other settings selected on this page.
Edit 28/06/2021: I am unsure what changed but after some time and normal reboots I noticed I had no name resolution on the firewall itself i.e. for checking packages, system or plugins updates. I had to change in System, General, Settings and select (tick) "Do not use the local DNS service as a nameserver for this system".
And from gpb advice I've set in Services, DHCPv4, DNS Servers for my single pool the LAN ip of the pi-hole. This ip is a reserved one, also on this page.
Finally, in pi-hole, in Settings, DNS I've set a "Custom Upstream DNS Servers" with the (again static) LAN ip address of OPNSense.
Now the basic setup is done I can move on to analysing any rogues dns queries with firewall rules. Also I look forward to utilising the rest of OPNSense capabilities.
The working config is this in case someone needs it:
Code Select
resolution_type: GETDNS_RESOLUTION_STUB
dns_transport_list:
- GETDNS_TRANSPORT_TLS
tls_authentication: GETDNS_AUTHENTICATION_REQUIRED
dnssec_return_status: GETDNS_EXTENSION_TRUE
tls_query_padding_blocksize: 128
edns_client_subnet_private : 1
round_robin_upstreams: 1
idle_timeout: 10000
tls_ca_path: "/etc/ssl/"
tls_cipher_list: "EECDH+AESGCM:EECDH+CHACHA20"
tls_ciphersuites: "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256"
tls_min_version: GETDNS_TLS1_2
tls_max_version: GETDNS_TLS1_3
listen_addresses:
- 127.0.0.1@8053
# - 0::1@8053
#dnssec: GETDNS_EXTENSION_TRUE
appdata_dir: "/var/cache/stubby"
#dnssec_trust_anchors: "/usr/local/sbin/unbound-anchor"
dnssec_trust_anchors:
- "/usr/local/etc/unbound/root.key"
tls_ca_file: "/usr/local/share/certs/ca-root-nss.crt"
upstream_recursive_servers:
## Quad 9 'secure' service - Filters, does DNSSEC, doesn't send ECS
- address_data: 9.9.9.9
tls_auth_name: "dns.quad9.net"
tls_port: 853
## Cloudflare 1.1.1.1 and 1.0.0.1
- address_data: 1.1.1.1
tls_auth_name: "cloudflare-dns.com"
tls_port: 853
I've left a couple of commented out lines so we can see the format that is needed in.
Then on Unbound custom options:
Code Select
server:
do-not-query-localhost: no
forward-zone:
name: "."
forward-addr: 127.0.0.1@8053
If I entered my OPNSense LAN address it wouldn't work. All tests from OPNSense would give servfail and unfortunately there are no logs to tell why. It was trial and error. Enable DNSSEC support in Unbound is not selected.
In System, General, Settings the DNS has 127.0.0.1. Again the LAN ip wouldn't work. There are no other settings selected on this page.
Edit 28/06/2021: I am unsure what changed but after some time and normal reboots I noticed I had no name resolution on the firewall itself i.e. for checking packages, system or plugins updates. I had to change in System, General, Settings and select (tick) "Do not use the local DNS service as a nameserver for this system".
And from gpb advice I've set in Services, DHCPv4, DNS Servers for my single pool the LAN ip of the pi-hole. This ip is a reserved one, also on this page.
Finally, in pi-hole, in Settings, DNS I've set a "Custom Upstream DNS Servers" with the (again static) LAN ip address of OPNSense.
Now the basic setup is done I can move on to analysing any rogues dns queries with firewall rules. Also I look forward to utilising the rest of OPNSense capabilities.
"