OPNsense Forum

English Forums => Tutorials and FAQs => Topic started by: p1n0ck10 on December 13, 2018, 10:14:12 pm

Title: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on December 13, 2018, 10:14:12 pm
[Updated on 10.03.2020]

Since opnsense 18.7.9 it is possible to use encrypted DNS with the opnsense-plugin "os-dnscrypt-proxy". Thanks to mimugmail (m.muenz@gmail.com). This plugin supports DNSCrypt (https://dnscrypt.info (https://dnscrypt.info)) and DNS over HTTPS (DoH) with DNSSEC and DNSBL.


Explanations and Differences:
DNSCrypt or DNS over HTTPS = protocol that authenticates communications between a dns-client and a dns-resolver. It encrypts the traffic and prevents dns spoofing or man-in-the-middle-attacks. DoH is standardized through IETF and standardport for resolvers is 443. DNSCrypt use different ports. Resolver on the internet often use ports like 443, 4443, 5443 or 8443 and is currently not standardized but has more privacy features.
DNSSEC = DNS Extension that allows a client to validate the dns response on supported domains and TLDs. Resolvers check the digital signature of dns responses.
DNSBL = Domain Name System Blacklists with RPZ (response policy zone) to block ads, trackers and malware domains.

This technique prevents not against ISP-censorship !!! because your browser requests for https has the Server Name Indication (SNI) unencrypted. Currently only Cloudflare and Firefox have implemented ESNI for testing. Tor or a VPN can solve this. Here the answer from the developer of DNSCrypt, Frank Denis:
https://superuser.com/questions/1318588/what-exactly-isp-can-see-when-someone-use-dnscrypt-proxy-with-dnscrypt-enabled-p (https://superuser.com/questions/1318588/what-exactly-isp-can-see-when-someone-use-dnscrypt-proxy-with-dnscrypt-enabled-p)


Scenario:
dnscrypt-proxy is only listen on the localhost addresses 127.0.0.1 (IPv4) and ::1 (IPv6) on port 5353 and handle the dns requests to the internet encrypted.
unbound dns forwards all queries to dnscrypt-proxy while itself is listening on all interfaces on port 53 (IPv4 + IPv6) and handle the dns requests for the local network unencrypted.

The reason behind that scenario is unbound dns can act as a dns-resolver for your lan with all his features. If you allow to register dhcp leases you can reach your clients via their hostnames and do not need to know their ip addresses. The dns traffic on the lan side is not encrypted because the most client's OS currently does not support this. For decentralization dnscrypt-proxy uses a pool of random servers from a public list. Normally is choosing automatically the fastest with the options you set (IPv4, IPv6, DNSCrypt, DoH, DNSSEC, NoLog, NoFilter). Every 3 hours it checks the fastest server again. You can shorten the time interval by running the existing cronjob under System/Settings/Cron "Download DNSCrypt-Proxy DNSBLs and restart". You only need dnscrypt-proxy because unbound dns (and also dnsmasq) has only limited support for DNSCrypt/DoH and DNSBL.

You can also configure dnscrypt-proxy as standalone dns-server. For this follow these instructions:
https://wiki.opnsense.org/manual/how-tos/dnscrypt-proxy.html (https://wiki.opnsense.org/manual/how-tos/dnscrypt-proxy.html)


Install DNSCrypt-Proxy:
System/Firmware/Plugins
=> Install "os-dnscrypt-proxy"


Configuration DNSCrypt-Proxy:
Services/DNSCrypt-Proxy/Configuration/General
=> Check "Enable DNSCrypt-Proxy"
=> "Listen Address" is 127.0.0.1:5353 and [::1]:5353
=> Check "Use IPv4 Servers"
=> Check "Use IPv6 Servers"
=> Check "Use DNSCrypt Servers"
=> Check "Use DNS-over-HTTPS Servers"
=> Check "Require DNSSEC"
(see attachments "Services-DNSCrypt-Proxy_01.png", "Services-DNSCrypt-Proxy_02.png")
(https://forum.opnsense.org/index.php?action=dlattach;topic=10670.0;attach=7461;image)
(https://forum.opnsense.org/index.php?action=dlattach;topic=10670.0;attach=7463;image)

=> As "Fallback Resolver" you can use the standard Quad9 Server (9.9.9.9:53) or Cloudflare (1.1.1.1:53) or what ever you want.


Optional Configuration DNSCrypt-Proxy (manual Servers):
For some business usecases is it neccessary to use manual dns server for additional dns services from Cloudflare or Cisco Umbrella. For other reason you want to use specific servers from your country. If you use the "Server List" the options (DNSSEC, NoLog, NoFilter) will be ignored.

Services/DNSCrypt-Proxy/Configuration/General
=> On "Server List" you can enter the servernames from this public list https://dnscrypt.info/public-servers/ (https://dnscrypt.info/public-servers/).
use the exactly servernames and not any IP's

Cloudflare CDN (DoH) its one of the fastest but in the past another user has make the experience that some sites are not available like oneplus.com or postbank.de because DNSSEC was broken => seems to be fixed.
In that case you had to configure unbound dns to redirect the query for this domain to another dns server. This can be done on "Services/Unbound DNS/Overrides/Domain Overrides".
Code: [Select]
cloudflare
cloudflare-ipv6

Cisco/OpenDNS (DNSCrypt) for services like Cisco Umbrella.
Code: [Select]
cisco
cisco-ipv6

(see attachment "Services-DNSCrypt-Proxy_03.png")
(https://forum.opnsense.org/index.php?action=dlattach;topic=10670.0;attach=7465;image)

Another option is to create your own server on Services/DNSCrypt-Proxy/Configuration/Servers.


Configuration Unbound DNS:
Services/Unbound DNS/General
=> Check "Enable Unbound"
=> Check "Enable DNSSEC Support"
=> Uncheck "DNS Query Forwarding"
=> Under "Custom options" you must configure unbound dns that is all forwarding to dnscrypt-proxy. I setup this for IPv4 + IPv6 because dnscrypt-proxy and unbound dns is listening on both addresses and in the original unbound.conf "interface-automatic" is set to yes, see:

ssh on opnsense: "cat /var/unbound/unbound.conf"
# Interface IP(s) to bind to
interface: 0.0.0.0
interface: ::0
interface-automatic: yes


User karlson2k figured out a solution where entries in "Services/Unbound DNS/Overrides/Domain Overrides" prevents unbound dns to start if you forward to dnscrypt-proxy. Writing "server:" at the beginning of "Custom options" solves this.
The reason is that domain overrides is included in unbound.conf before "Custom options" and domain overrides change section from "server:" to "forward-zone:".
To fix error in configuration, you need to add "server:" line before "do-not-query-localhost: no".


so the complete configuration looks like...
Code: [Select]
server:
do-not-query-localhost: no

forward-zone:
   name: "."
   forward-addr: 127.0.0.1@5353
   forward-addr: ::1@5353

=> Choose "All (recommended)" on "Outgoing Network Interfaces". In the past you had the option "localhost" but this is removed since version 19.


Configuration System DNS-Server:
System/Settings/General
=> Check that no one "DNS Server" is configured
=> Uncheck "Allow DNS server list to be overridden by DHCP/PPP on WAN"
=> Uncheck "Do not use the local DNS service as a nameserver for this system"
(see attachment "System-Settings-General.png")
(https://forum.opnsense.org/index.php?action=dlattach;topic=10670.0;attach=7467;image)


All is done!

Check if your DNS Configuration works correctly:
=> https://dnsleaktest.com (https://dnsleaktest.com)
Check against dns-leaks and what dns-server you currently use
=> https://cmdns.dev.dns-oarc.net/ (https://cmdns.dev.dns-oarc.net/)
Check your dns features
=> https://internet.nl/test-connection/ (https://internet.nl/test-connection/)
If you use IPv6 and DNSSEC
=> http://www.dnssec-or-not.com/ (http://www.dnssec-or-not.com/)
If you use DNSSEC
=> https://tools.dnsstuff.com/ (https://tools.dnsstuff.com/)
DNS-Tools and more


Recommendation to other Tutorial:
Forward all unencrypted dns traffic to OPNsense, see:
https://forum.opnsense.org/index.php?topic=9245.0 (https://forum.opnsense.org/index.php?topic=9245.0)


Kind Regards  ;)
Title: Re: HOWTO - Unbound DNS with DNSCrypt Plugin for IPv4 + IPv6
Post by: mimugmail on December 14, 2018, 05:37:46 am
Nice :)
Title: Re: HOWTO - Unbound DNS with DNSCrypt Plugin for IPv4 + IPv6
Post by: gambrinus on December 14, 2018, 10:51:49 pm
Thanks, p1n0ck10.
Title: Re: HOWTO - Unbound DNS with DNSCrypt Plugin for IPv4 + IPv6
Post by: opnsenseuser on December 16, 2018, 08:37:38 am
This technique prevents not against ISP-censorship !!! a VPN-Provider can solve this.
here the answer from the developer Frank Denis:
https://superuser.com/questions/1318588/what-exactly-isp-can-see-when-someone-use-dnscrypt-proxy-with-dnscrypt-enabled-p

First of all many thanks for this ingenious instruction.
I have two questions.

1. What settings should I make if I use a transparent proxy and at the same time have a few clients that do not use a transparent proxy and continue to receive their DNS request via unbound?

2. Now if my provider can read everything again which sense is behind this plugin to use?
Because the different servers the dnscrypt used I can enter myself also in the unbound dns server list and for that I don´t need this plugin.

thx
rené
Title: Re: HOWTO - Unbound DNS with DNSCrypt Plugin for IPv4 + IPv6
Post by: p1n0ck10 on December 16, 2018, 01:29:26 pm
1. What settings should I make if I use a transparent proxy and at the same time have a few clients that do not use a transparent proxy and continue to receive their DNS request via unbound?
Which Transparent Proxy do you mean? Web Proxy or DNS Proxy?

2. Now if my provider can read everything again which sense is behind this plugin to use?
Because the different servers the dnscrypt used I can enter myself also in the unbound dns server list and for that I don´t need this plugin.
The sense of the plugin is to encrypt the DNS traffic over DNSCrypt or DoH (DNS over HTTPS). This in combination with DNSSEC checks the digital signature of DNS responses to verify that the data match what the zone owner initially configured. It makes DNS more secure against spoofing or changing the DNS-Records do you ask for. More Info here: https://dnscrypt.info/faq/




Title: Re: HOWTO - Unbound DNS with DNSCrypt Plugin for IPv4 + IPv6
Post by: opnsenseuser on December 16, 2018, 02:08:27 pm
1. What settings should I make if I use a transparent proxy and at the same time have a few clients that do not use a transparent proxy and continue to receive their DNS request via unbound?
Which Transparent Proxy do you mean? Web Proxy or DNS Proxy?

1. Squid http(s) proxy with cert (yes, web)

2. What can i do to give the provider no way to read my surfing behavior?
You wrote something about vpn dns!
I currently do not use vpn.
Is this still possible ?
And is there any instructions for opnsense?

Title: Re: HOWTO - Unbound DNS with DNSCrypt Plugin for IPv4 + IPv6
Post by: p1n0ck10 on December 16, 2018, 02:56:47 pm
1. What settings should I make if I use a transparent proxy and at the same time have a few clients that do not use a transparent proxy and continue to receive their DNS request via unbound?

Which Transparent Proxy do you mean? Web Proxy or DNS Proxy?

Squid http(s) proxy with cert (yes, web)

Web Proxy and DNS are different things. Transparent Web Proxy catch all your clients to HTTP and HTTPS requests when you have set a NAT-Rule. Your clients will still ask for DNS even if you use the Transparent Web Proxy. In the Web Proxy you can add blocklists, too. Without DNS you can't resolve names in the internet. So DNS is a important component to search the Internet and should be encrypted like HTTPS.

2. What can i do to give the provider no way to read my surfing behavior?
You wrote something about vpn dns!
I currently do not use vpn.
Is this still possible ?
And is there any instructions for opnsense?

(all traffic not only for DNS) The opnsense-plugin "os-tor" (https://www.torproject.org/) can solve this or a VPN-Provider. First you must read what VPN-Provider do you prefer and which features it has and what do you need. here two examples:
https://nordvpn.com
https://www.perfect-privacy.com/

The most VPN-Provider supports normal IPsec and OpenVPN. OPNsense can do that ;-)


Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt Plugin for IPv4 + IPv6
Post by: PaoPao on December 19, 2018, 02:27:20 pm
Do I have to change anything for the Bind PlugIn to work together?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt Plugin for IPv4 + IPv6
Post by: donatom3 on December 25, 2018, 07:12:00 am
So follow the instructions in here and make sure that unbound is pointing to port 53530 (default for BIND).

Bind doesn't let you put in port numbers for the forwarders so you have to edit the config file.
Go to the BIND service page first and fill in 127.0.0.1 and ::1 in the forwarders section.
Also make sure DNSSEC Validation is "Auto". Now hit Save
Then you need to edit /usr/local/etc/namedb/named.conf to add in the ports for the forwarders to point to dnscrypt. I like using winscp to ssh to the unit and doing this in a txt editor but do it however you'd like
Now you should have a forwarders line
This is what my forwarder line looks like after adding in the port numbers.
forwarders    { 127.0.0.1 port 5353; ::1 port 5353; };
Basically I just added " port 5353" to the end of each forwarder IP.

It appears to be working for me. All the leak tests give me the same result I got when I was just using dnscrypt and BIND appears.

Only quirk I had is the first time after installing bind and dnscrypt-proxy I could not start dnscrypt-proxy service without restarting opnsense. After the restart it appeared to work fine.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt Plugin for IPv4 + IPv6
Post by: mimugmail on December 25, 2018, 07:55:19 am
You can also add an alias 127.0.0.8 and listen dnscrypt to this IP with port 53. Will also work ...
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt Plugin for IPv4 + IPv6
Post by: donatom3 on December 25, 2018, 07:58:44 am
You can also add an alias 127.0.0.8 and listen dnscrypt to this IP with port 53. Will also work ...

Yes that would make it easier so you wouldn't have to edit the file. I wish I thought of doing it that way.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: rickg3 on January 05, 2019, 07:13:45 pm
Thanks for the tutorial. I am always looking for ways to improve DNS security.
I know enough about networking to be dangerous. You tutorial was easy to follow and get working.

I am curious though. Before, I used Cloudflare and Google for DNS and that is reflected in DNS tests. Now when I check DNS it appears that I am using random servers, but the provider comes back as Cloudflare. I assume the fastest server available is responding but the request is encrypted?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on January 05, 2019, 10:33:48 pm
Yes, it chooses fastest one, but you can also use manual server (with next version)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: rickg3 on January 13, 2019, 01:59:21 pm
Had to give up on this plugin. While I like the idea, I had too many DNS lookup failures.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on January 13, 2019, 03:27:29 pm
And why should they be related to the plugin? If it works it works .. if you have something wrong, nothing works.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: cake on January 25, 2019, 04:23:02 am
This is great! Many thanks to the dev mimugmail (m.muenz@gmail.com) and for the tutorial!
I had a little trouble with it not starting when I entered some dns servers in the list at https://dnscrypt.info/public-servers/ (https://dnscrypt.info/public-servers/)
I ended up looking at the log located in
Code: [Select]
cat /var/log/dnscrypt-proxy/dnscrypt-proxy.log and choosing 3 of the resolvers that worked. I am wondering if one of the resolvers goes down, will this stop dnsproxy from starting at boot?

I went a different route from the tutorial in first post, I set up a Virtual IP in Firewall --> Virtual IP
I used: IP Alias | loopback | 127.0.0.2
Then configured the DNSCrypt plugin to use 127.0.0.2:53 (and deleted the default ones)
Lastly I headed over to  System --> Settings --> General and put 127.0.0.2 in the in the DNS Server box.

My test at https://www.dnsleaktest.com showed my dns queries are using dnscrypt. :-)

One feature request is to be able edit the verb for the log and also to show the log in the GUI.
Thanks again for this plugin!
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on January 25, 2019, 05:58:19 am
Log in the UI is already under review, perhaps with 19.1.
The default behavior is to use the fastest two servers, and it checks every hour which one is the fastest, so no problem :)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on January 28, 2019, 11:55:22 pm

I had a little trouble with it not starting when I entered some dns servers in the list at  
I ended up looking at the log located in  (https://dnscrypt.info/public-servers/[/url)
Code: [Select]
cat /var/log/dnscrypt-proxy/dnscrypt-proxy.log and choosing 3 of the resolvers that worked. I am wondering if one of the resolvers goes down, will this stop dnsproxy from starting at boot?

Lastly I headed over to  System --> Settings --> General and put 127.0.0.2 in the in the DNS Server box.

One feature request is to be able edit the verb for the log and also to show the log in the GUI.

Thanks again for this plugin!

I only recommend unbound and dnscrypt in this way what i wrote because i'm not a fan to have to many DNS-resolver between clients and internet. makes little bit difficult to solve dns errors. i have testet many DNS-resolver from the public list  https://dnscrypt.info/public-servers/ (https://dnscrypt.info/public-servers/)
The best way is to use the automatic option because the fastest and a pool of random servers is used. If you use the manual configuration of servers i only recommend cloudflare and cisco (opendns) because these are dnsproviders with bigger infrastructure behind the szene. Cisco (opendns) has the disadvantage thats not using DNSSEC.
The best DNS results on https://cmdns.dev.dns-oarc.net (https://cmdns.dev.dns-oarc.net) i achieved with cloudflare.

I don't know why you using 127.0.0.2 in the configuration of system/settings/general. In my opinion opnsense uses localhost as default dns-resolver. The dns-resolver in system/settings/general is normally configured with external dns resolver. that job makes dnscrypt. in my configuration is the way.
opnsense => localhost = unbound => forwarding mode to dnscrypt. thats it

Good too hear that the log is coming to the GUI  ;)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: malkovich78 on February 02, 2019, 09:33:40 pm
Hi,

After reading all configuration guides for dnscrypt-proxy plugin and several testing I wasn't able to make it work with unbound, only with dnsmaq and dnscrypt-proxy instance running on 127.0.0.2:53 and 127.0.0.2 as the only dns server on System-> settings; but with this configuration I found a problem because on boot dnsmasq is started before dnscrypt-proxy so system can't resove domains. Creating an script to start dnscrypt-proxy before dnsmasq at boot time finally solved it.
I hope this info may be useful to others.

Regards.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: zaggynl on March 20, 2019, 08:59:24 pm
I'm running into the same issue.
I can enable and start Unbound but it will not start after adding Advanced Settings part per: https://wiki.opnsense.org/manual/how-tos/dnscrypt-proxy.html
Code: [Select]
do-not-query-localhost: no
forward-zone:
name: "."
forward-addr: 127.0.0.1@5353

No error messages appear in webui or log.
I can start unbound from shell with -d -v, it shows no errors at that time in shell or in ui log.

Goal is to forward incoming requests to my pihole VM, which should get its DNS replies from dnscrypt on opnsense.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: franco on March 20, 2019, 09:23:16 pm
I'm guessing same Unbound problem as Bind has:

> When you are using Overrides in Unbound you can not use ``do-not-query-localhost``.


Cheers,
Franco
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: zaggynl on March 21, 2019, 12:40:53 pm
I'm guessing same Unbound problem as Bind has:

> When you are using Overrides in Unbound you can not use ``do-not-query-localhost``.


Cheers,
Franco

Thanks for the reply, I have a number of Overrides, after removing the do-not-query-localhost line Unbound starts!
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on March 21, 2019, 02:34:44 pm
Overrides can also be done via dnscrypt-proxy if you need them. Also Adblocking is now available vial the plugin itself.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: zaggynl on March 22, 2019, 12:45:35 pm
Overrides can also be done via dnscrypt-proxy if you need them. Also Adblocking is now available vial the plugin itself.

Thanks.
Had a look at using dnscrypt-proxy alone but the webui of pihole proved to be more featured.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on March 22, 2019, 12:54:29 pm
Indeed :)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on March 22, 2019, 03:32:35 pm
Hi All,

strange. I have 1 entry in the Host Override in Unbound and have no issues with "do-not-query-localhost: no"

great that DNSBL is implemented in the dnycrypt proxy. thanks mimugmail  ;)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: cake on April 18, 2019, 03:04:41 pm
Does anybody get server timeouts after a few days or so?  I start dnscrypt and after a couple days most servers are timeout according to the log. Not sure how to investigate. Maybe I start with making the log more verbose?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on April 18, 2019, 09:31:08 pm
But does it switch to other ones?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: cake on April 19, 2019, 01:41:17 am
Yes it does switch, maybe I have a setting wrong or some other configuration.
Here is a bit of a log, you can see at first 3 have a timeout, and 6 hours later 11 servers are timeout.
Code: [Select]
[2019-04-18 19:56:57] [NOTICE] Source [public-resolvers.md] loaded
[2019-04-18 19:56:57] [NOTICE] dnscrypt-proxy 2.0.19
[2019-04-18 19:56:57] [NOTICE] Loading the set of whitelisting rules from [whitelist.txt]
[2019-04-18 19:56:57] [NOTICE] Loading the set of blocking rules from [blacklist.txt]
[2019-04-18 19:56:57] [NOTICE] Loading the set of cloaking rules from [cloaking-rules.txt]
[2019-04-18 19:56:57] [NOTICE] Loading the set of forwarding rules from [forwarding-rules.txt]
[2019-04-18 19:56:57] [NOTICE] Now listening to 127.0.0.2:53 [UDP]
[2019-04-18 19:56:57] [NOTICE] Now listening to 127.0.0.2:53 [TCP]
[2019-04-18 19:56:57] [NOTICE] Now listening to 192.168.44.4:53 [UDP]
[2019-04-18 19:56:57] [NOTICE] Now listening to 192.168.44.4:53 [TCP]
[2019-04-18 19:56:58] [NOTICE] [arvind-io] OK (crypto v2) - rtt: 256ms
[2019-04-18 19:56:58] [NOTICE] [bottlepost-dns-nl] OK (crypto v2) - rtt: 286ms
[2019-04-18 19:57:00] [NOTICE] [charis] TIMEOUT
[2019-04-18 19:57:00] [NOTICE] [cpunks-ru] OK (crypto v1) - rtt: 313ms
[2019-04-18 19:57:01] [NOTICE] [cs-ch] OK (crypto v2) - rtt: 312ms
[2019-04-18 19:57:01] [NOTICE] [cs-swe] OK (crypto v2) - rtt: 293ms
[2019-04-18 19:57:01] [NOTICE] [cs-nl] OK (crypto v2) - rtt: 213ms
[2019-04-18 19:57:01] [NOTICE] [cs-nl2] OK (crypto v2) - rtt: 169ms
[2019-04-18 19:57:02] [NOTICE] [cs-fi] OK (crypto v2) - rtt: 200ms
[2019-04-18 19:57:02] [NOTICE] [cs-pl] OK (crypto v2) - rtt: 295ms
[2019-04-18 19:57:02] [NOTICE] [cs-dk] OK (crypto v2) - rtt: 206ms
[2019-04-18 19:57:02] [NOTICE] [cs-it] OK (crypto v2) - rtt: 170ms
[2019-04-18 19:57:02] [NOTICE] [cs-fr] OK (crypto v2) - rtt: 158ms
[2019-04-18 19:57:03] [NOTICE] [cs-fr2] OK (crypto v2) - rtt: 160ms
[2019-04-18 19:57:03] [NOTICE] [cs-pt] OK (crypto v2) - rtt: 211ms
[2019-04-18 19:57:03] [NOTICE] [cs-hk] OK (crypto v2) - rtt: 361ms
[2019-04-18 19:57:03] [NOTICE] [cs-ro] OK (crypto v2) - rtt: 191ms
[2019-04-18 19:57:03] [NOTICE] [cs-mo] OK (crypto v2) - rtt: 205ms
[2019-04-18 19:57:04] [NOTICE] [cs-lv] OK (crypto v2) - rtt: 202ms
[2019-04-18 19:57:04] [NOTICE] [cs-uk] OK (crypto v2) - rtt: 165ms
[2019-04-18 19:57:04] [NOTICE] [cs-de] OK (crypto v2) - rtt: 162ms
[2019-04-18 19:57:04] [NOTICE] [cs-de2] OK (crypto v2) - rtt: 169ms
[2019-04-18 19:57:04] [NOTICE] [cs-ca] OK (crypto v2) - rtt: 218ms
[2019-04-18 19:57:05] [NOTICE] [cs-ca2] OK (crypto v2) - rtt: 291ms
[2019-04-18 19:57:05] [NOTICE] [cs-usny] OK (crypto v2) - rtt: 274ms
[2019-04-18 19:57:05] [NOTICE] [cs-usil] OK (crypto v2) - rtt: 274ms
[2019-04-18 19:57:05] [NOTICE] [cs-usnv] OK (crypto v2) - rtt: 216ms
[2019-04-18 19:57:08] [NOTICE] [cs-uswa] TIMEOUT
[2019-04-18 19:57:08] [NOTICE] [cs-usdc] OK (crypto v2) - rtt: 264ms
[2019-04-18 19:57:08] [NOTICE] [cs-ustx] OK (crypto v2) - rtt: 242ms
[2019-04-18 19:57:08] [NOTICE] [cs-usga] OK (crypto v2) - rtt: 250ms
[2019-04-18 19:57:09] [NOTICE] [cs-usnc] OK (crypto v2) - rtt: 258ms
[2019-04-18 19:57:09] [NOTICE] [cs-usca] OK (crypto v2) - rtt: 209ms
[2019-04-18 19:57:09] [NOTICE] [cs-usor] OK (crypto v2) - rtt: 272ms
[2019-04-18 19:57:09] [NOTICE] [d0wn-is-ns2] OK (crypto v1) - rtt: 235ms
[2019-04-18 19:57:10] [NOTICE] [d0wn-tz-ns1] OK (crypto v1) - rtt: 392ms
[2019-04-18 19:57:10] [NOTICE] [de.dnsmaschine.net] OK (crypto v2) - rtt: 204ms
[2019-04-18 19:57:10] [NOTICE] [dnscrypt.ca-1] OK (crypto v2) - rtt: 297ms
[2019-04-18 19:57:11] [NOTICE] [dnscrypt.ca-2] OK (crypto v2) - rtt: 288ms
[2019-04-18 19:57:11] [NOTICE] [dnscrypt.eu-dk] OK (crypto v2) - rtt: 205ms
[2019-04-18 19:57:11] [NOTICE] [dnscrypt.eu-nl] OK (crypto v1) - rtt: 301ms
[2019-04-18 19:57:11] [NOTICE] [dnscrypt.me] OK (crypto v2) - rtt: 180ms
[2019-04-18 19:57:11] [NOTICE] [dnscrypt.nl-ns0] OK (crypto v2) - rtt: 196ms
[2019-04-18 19:57:12] [NOTICE] [dnscrypt.uk-ipv4] OK (crypto v2) - rtt: 282ms
[2019-04-18 19:57:12] [NOTICE] [ev-va] OK (crypto v2) - rtt: 274ms
[2019-04-18 19:57:12] [NOTICE] [ev-to] OK (crypto v2) - rtt: 270ms
[2019-04-18 19:57:12] [NOTICE] [freetsa.org] OK (crypto v1) - rtt: 256ms
[2019-04-18 19:57:13] [NOTICE] [ibksturm] OK (crypto v2) - rtt: 453ms
[2019-04-18 19:57:13] [NOTICE] [ipredator] OK (crypto v1) - rtt: 194ms
[2019-04-18 19:57:13] [NOTICE] [opennic-ethservices] OK (crypto v1) - rtt: 261ms
[2019-04-18 19:57:14] [NOTICE] [opennic-ethservices2] OK (crypto v1) - rtt: 259ms
[2019-04-18 19:57:14] [NOTICE] [opennic-luggs] OK (crypto v1) - rtt: 284ms
[2019-04-18 19:57:14] [NOTICE] [opennic-luggs2] OK (crypto v1) - rtt: 287ms
[2019-04-18 19:57:14] [NOTICE] [publicarray-au] OK (crypto v2) - rtt: 176ms
[2019-04-18 19:57:17] [NOTICE] [qag.me] TIMEOUT
[2019-04-18 19:57:17] [NOTICE] [quad9-dnscrypt-ip4-nofilter-pri] OK (crypto v1) - rtt: 160ms
[2019-04-18 19:57:17] [NOTICE] [quad9-dnscrypt-ip4-nofilter-alt] OK (crypto v1) - rtt: 158ms
[2019-04-18 19:57:19] [NOTICE] [qualityology.com] TIMEOUT
[2019-04-18 19:57:19] [NOTICE] [scaleway-fr] OK (crypto v2) - rtt: 162ms
[2019-04-18 19:57:19] [NOTICE] [securedns] OK (crypto v1) - rtt: 284ms
[2019-04-18 19:57:20] [NOTICE] [soltysiak] OK (crypto v1) - rtt: 280ms
[2019-04-18 19:57:20] [NOTICE] [suami] OK (crypto v2) - rtt: 161ms
[2019-04-18 19:57:20] [NOTICE] [trashvpn.de] OK (crypto v2) - rtt: 169ms
[2019-04-18 19:57:20] [NOTICE] [ventricle.us] OK (crypto v2) - rtt: 275ms
[2019-04-18 19:57:22] [NOTICE] [opennic-bongobow] TIMEOUT
[2019-04-18 19:57:22] [NOTICE] [opennic-R4SAS] OK (crypto v2) - rtt: 191ms
[2019-04-18 19:57:22] [NOTICE] Server with the lowest initial latency: cs-fr (rtt: 158ms)
[2019-04-18 19:57:22] [NOTICE] dnscrypt-proxy is ready - live servers: 61
[2019-04-18 20:57:25] [NOTICE] [charis] TIMEOUT
[2019-04-18 20:57:31] [NOTICE] [cs-uswa] OK (crypto v2) - rtt: 289ms
[2019-04-18 20:57:40] [NOTICE] [qag.me] TIMEOUT
[2019-04-18 20:57:42] [NOTICE] [qualityology.com] TIMEOUT
[2019-04-18 20:57:46] [NOTICE] [opennic-bongobow] TIMEOUT
[2019-04-18 20:58:01] [NOTICE] Server with the lowest initial latency: cs-fr (rtt: 158ms)
[2019-04-18 21:58:04] [NOTICE] [charis] TIMEOUT
[2019-04-18 21:58:18] [NOTICE] [qag.me] TIMEOUT
[2019-04-18 21:58:20] [NOTICE] [qualityology.com] TIMEOUT
[2019-04-18 21:58:24] [NOTICE] [opennic-bongobow] TIMEOUT
[2019-04-18 21:58:39] [NOTICE] Server with the lowest initial latency: cs-fr (rtt: 158ms)
[2019-04-18 22:58:42] [NOTICE] [charis] TIMEOUT
[2019-04-18 22:58:57] [NOTICE] [qag.me] TIMEOUT
[2019-04-18 22:58:59] [NOTICE] [qualityology.com] TIMEOUT
[2019-04-18 22:59:02] [NOTICE] [opennic-bongobow] TIMEOUT
[2019-04-18 22:59:17] [NOTICE] Server with the lowest initial latency: scaleway-fr (rtt: 159ms)
[2019-04-18 23:59:19] [NOTICE] [charis] TIMEOUT
[2019-04-18 23:59:25] [NOTICE] [cs-lv] TIMEOUT
[2019-04-18 23:59:27] [NOTICE] [cs-de] TIMEOUT
[2019-04-18 23:59:38] [NOTICE] [qag.me] TIMEOUT
[2019-04-18 23:59:40] [NOTICE] [qualityology.com] TIMEOUT
[2019-04-18 23:59:44] [NOTICE] [opennic-bongobow] TIMEOUT
[2019-04-18 23:59:50] [NOTICE] [cs-lv] TIMEOUT
[2019-04-18 23:59:52] [NOTICE] [cs-de] TIMEOUT
[2019-04-19 00:00:02] [NOTICE] Server with the lowest initial latency: cs-fr2 (rtt: 158ms)
[2019-04-19 01:00:05] [NOTICE] [charis] TIMEOUT
[2019-04-19 01:00:10] [NOTICE] [cs-lv] TIMEOUT
[2019-04-19 01:00:12] [NOTICE] [cs-de] TIMEOUT
[2019-04-19 01:00:16] [NOTICE] [cs-uswa] TIMEOUT
[2019-04-19 01:00:25] [NOTICE] [qag.me] TIMEOUT
[2019-04-19 01:00:27] [NOTICE] [qualityology.com] TIMEOUT
[2019-04-19 01:00:30] [NOTICE] [opennic-bongobow] TIMEOUT
[2019-04-19 01:00:37] [NOTICE] [cs-lv] TIMEOUT
[2019-04-19 01:00:39] [NOTICE] [cs-de] TIMEOUT
[2019-04-19 01:00:51] [NOTICE] [cs-uswa] TIMEOUT
[2019-04-19 01:00:51] [NOTICE] Server with the lowest initial latency: cs-fr2 (rtt: 158ms)
[2019-04-19 02:00:54] [NOTICE] [charis] TIMEOUT
[2019-04-19 02:01:00] [NOTICE] [cs-lv] TIMEOUT
[2019-04-19 02:01:02] [NOTICE] [cs-de] TIMEOUT
[2019-04-19 02:01:05] [NOTICE] [cs-uswa] TIMEOUT
[2019-04-19 02:01:12] [NOTICE] [ibksturm] TIMEOUT
[2019-04-19 02:01:16] [NOTICE] [qag.me] TIMEOUT
[2019-04-19 02:01:18] [NOTICE] [qualityology.com] TIMEOUT
[2019-04-19 02:01:22] [NOTICE] [opennic-bongobow] TIMEOUT
[2019-04-19 02:01:28] [NOTICE] [cs-lv] TIMEOUT
[2019-04-19 02:01:30] [NOTICE] [cs-de] TIMEOUT
[2019-04-19 02:01:42] [NOTICE] [cs-uswa] TIMEOUT
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: thg0432 on April 22, 2019, 05:03:10 pm
is it possible to have dnscrypt have a different set of DNS server(s) for an ip range? 
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on April 22, 2019, 05:30:48 pm
No, but manual addition
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: thg0432 on April 22, 2019, 06:51:51 pm
so essentially just add dns servers in via static ip mappings?  I have my kids devices mapped, but I was hoping to set it via range or group setting rather than manually per device.  I hope this could be a future feature.  It would be great for parental control features and being able to drill down for reports that are generated per user.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on April 22, 2019, 10:31:57 pm
Just use Port redirection for kids IPs to make use of it. Rest could go with usual DNS
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: DoomSalamander on June 27, 2019, 01:59:00 pm
While I would love to use dnscrypt I can't because of some websites apperently having broken dnssec support like postbank.de see https://community.cloudflare.com/t/problem-with-oneplus-com-and-postbank-de/29232. I currently use dns over tls and there happends the same with dnssec enabled but I can configure a override to get those sites working. I don't know how I can make this work with dnssec and dnscrypt set up because you can only use unbound overrides if "do-not-query-localhost: no" isn't being used. If anyone knows how to make it work please let me know.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on June 30, 2019, 01:03:08 pm
While I would love to use dnscrypt I can't because of some websites apperently having broken dnssec support like postbank.de see https://community.cloudflare.com/t/problem-with-oneplus-com-and-postbank-de/29232. I currently use dns over tls and there happends the same with dnssec enabled but I can configure a override to get those sites working. I don't know how I can make this work with dnssec and dnscrypt set up because you can only use unbound overrides if "do-not-query-localhost: no" isn't being used. If anyone knows how to make it work please let me know.

You must configure Unbound DNS to redirect this query to another DNS-Resolver. Example with Quad9 DNS.
Copy this to your Custom Config:
Code: [Select]
server:
do-not-query-localhost: no

forward-zone:
   name: "postbank.com"
   forward-addr: 9.9.9.9
forward-zone:
   name: "postbank.de"
   forward-addr: 9.9.9.9
forward-zone:
   name: "."
   forward-addr: ::1@5353
   forward-addr: 127.0.0.1@5353

with this config i can resolve postbank.com and postbank.de

Kind Regards
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: DoomSalamander on June 30, 2019, 01:53:49 pm
Thank you very much! Seems to work flawlessly. You should add that to your tutorial and mention that some sites may have broken dnssec support and you can add them that way as an exception.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on June 30, 2019, 02:15:28 pm
Thank you very much! Seems to work flawlessly. You should add that to your tutorial and mention that some sites may have broken dnssec support and you can add them that way as an exception.

This problem seems to be only at Cloudflare but its caused by Postbank
Another options is to use Quad9 DNS Server in the Server List of the DNSCrypt-Proxy Plugin on OPNsense
Code: [Select]
quad9-dnscrypt-ip6-filter-pri
quad9-dnscrypt-ip4-filter-pri

Then you don't have to add exceptions to the custom config in Unbound DNS. But Quad9 seems to be more slowly.

Kind Regards
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: DoomSalamander on June 30, 2019, 03:08:42 pm
This problem seems to be only at Cloudflare.
Another options is to use Quad9 DNS Server in the Server List of the DNSCrypt-Proxy Plugin on OPNsense

Yeah I read that too that this only happens with cloudflare. Apparently of their IETF implantation of DNSSEC. I wanted to use cloudflare because of their speed.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on June 30, 2019, 03:10:26 pm
i have updated the tutorial...

The different  between Cloudflare and Quad9 is that Cloudflare use QNAME Minimisation and Quad9 not and Quad9 is slower. Results on https://cmdns.dev.dns-oarc.net/

Cloudflare:
(see Attachment: Cloudflare_DNS-Results.png)
https://forum.opnsense.org/index.php?action=dlattach;topic=10670.0;attach=7441;image

Quad9:
(see Attachment: Quad9_DNS-Results.png)
https://forum.opnsense.org/index.php?action=dlattach;topic=10670.0;attach=7443;image
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on July 02, 2019, 08:33:44 pm
@mimugmail:
i have tried to configure the exceptions under Services/DNSCrypt-Proxy/Configuration/Forwarders
but it don't work. In my opinion this would be the right place? Have you any ideas?

Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on July 02, 2019, 09:57:50 pm
Sorry, can't follow. What exactly do you want to achieve.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on July 02, 2019, 10:31:55 pm
Sorry, can't follow. What exactly do you want to achieve.

If you use Cloudflare in the Server List you can't access the Domains postbank.com and postbank.de. My idea was to redirect the DNS query to another Server (example Quad9). If i use this on Unbound DNS it works. If i configure this in the DNSCrypt-Proxy under Forwarders it don't work.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: vip-123 on September 13, 2019, 05:38:49 pm
Old - Post but was reading up on the "Server List" if you want to manually use known servers like "cloudflare"

Noticed that when I add 1.1.1.1 / 1.1.1.1:53 it fails with something like no servers found.

the list does seem to work when typing cloudflare lower case then it saves and works.

SNI Still not encrypted but still a vast improvement for my testing.

- The sites not loading issue.
(figure off topic but might as well attempt to explain what I'm guess Issue is in this particular Case)

That I found is the firewall on the remote site blocking origination countries / geo IPs
I do this to on many firewalls like meraki and others.

trick is some sites are pulling css / fonts and other items from IPs that are not located in referenced IPs by Geo and if your rule is set to something like only allow these counties and deny all other traffic.  then you get the above kind of issue.

basically the bank is blocking certain countries from access.
you might be in .de however your request when using CF is routed through another country like (example) spain/france/etc for speed / backbone performance - then that might be a blocked inbound ..

the firewall for the bank is blocking inbound from either CF proxy due to too many hits from their proxy IP (which is common for a webserver that doesn't understand to strip back to the originators actual IP)

(/figure off topic but might as well attempt to explain what I'm guess Issue is in this particular Case)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: dpshak on September 23, 2019, 04:58:51 pm
HELP!?!

I've googled around, hunted high and low, and STILL haven't found an answer...I'm not sure that this is the right forum for this question, BUT it concerns the topic of what I'm trying to do.  If I'm in the wrong place, feel free to move me!

First off, I'm new to both OPNSense and *BSD.  I found my way here via the 'Security Now' podcast.  Steve Gibson mentioned pfSense in a recent podcast; he was talking about his SG1100 router equipped with pfSense and also mentioned that pfSense could be installed on a router or spare PC - the spare PC caught my attention!  :o  After investigating, I ruled out pfSense because the machine that I intended to use is an OLD, Intel P4 system - pfSense seems to have deprecated support for 32bit machines.  After more googling, I discovered that OPNSense was another fork of the old mOnOwall firewall AND it still supports 32bit machines.  :)

The reason that 'spare PC' caught my attention: I started dual booting WindowsXP and Gentoo Linux back in the early 2000s.  When XP hit its' expiration date, I moved completely over to Gentoo Linux.  That old P4 has been gathering dust and I decided I wanted to turn it into a firewall/router box.  I had the router side working, more or less, when other things came up.  So I never finished it.  When I discovered OPNSense, and realized it did EVERYTHING that I wanted, out-of-the-box, I decided to have at it.

So; 3 weeks later, after much fiddling (and googling) around, I have a working system!  Getting my primary and secondary wireless network up and running was a P.I.T.A!!!  (I have a Netgear WNR3500 and a Linksys WRT-54G, both running DD-WRT variants, that provide my primary and secondary WiFi networks.)  So, that brings me to my question...

I want to use DNSCrypt-Proxy on my OPNSense box.  EVERYTHING I've found says: go to System->Firmware->Plugins and install DNSCrypt-Proxy.  It DOES NOT exist on my box!!!  I tried changing 'repository' locations and updating, but NO DNSCrypt-Proxy in 'Plugins'!  Eventually, after reading through these forums, I found a post that helped me bring 'ports' into that box.  In turn, I was able to intall DNSCrypt-Proxy2.  HOWEVER, that's all CLI stuff.  It's installed as a 'package' on my machine and doesn't show up in the 'Services' menu.  Being a Gentoo Linux user, I'm not adverse to fiddling around with config files but, as the OP said, I REALLY don't want to mix config file setup with GUI configurations...  So, the question is: why is this NOT showing up as a plugin in System->Firmware->Plugins and, where can I go to make this happen?  If I CAN'T make this happen, is there a preferred 'how-to tutorial' site that I can go to, to configure this manually?

This is what's in the box:
Code: [Select]
OPNsense 19.7.4_1-i386
FreeBSD 11.2-RELEASE-p14-HBSD
OpenSSL 1.0.2s 28 May 2019
and the initial install was: OPNsense-19.7-OpenSSL-vga-i386.img (downloaded form OPNSense website), installed on a bootable USB drive.

TIA!!!   
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on September 23, 2019, 08:14:48 pm
Dnscrypt depends on Go language and Go is not compatible to i386 :( Sorry Dude ...
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: franco on September 24, 2019, 07:26:48 am
It's compatible, but we keep the i386 version light so that it keeps building faster. Please also note that OPNsense 20.1 (January 2020) will remove i386 altogether as planned a long time ago.


Cheers,
Franco
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: dpshak on September 24, 2019, 03:06:55 pm
Dnscrypt depends on Go language and Go is not compatible to i386 :( Sorry Dude ...

It's compatible, but we keep the i386 version light so that it keeps building faster. Please also note that OPNsense 20.1 (January 2020) will remove i386 altogether as planned a long time ago.

Cheers,
Franco


Well then...I guess that's a good excuse to upgrade the motherboard!   ;D   The board in that machine IS about 15 years old!

In the mean time: I have a FreeBSD 13.0-Current install running in Virtualbox so I can get some education on *BSD.  If I understand the *BSD system correctly, this would be the equivalent of the 'testing' branch in Linux. 

I learn best by doing, which is why I chose Gentoo when I converted to Linux.   To this day, I run ' ~AMD64' (testing branch) on MY machine.  Periodically, I run into problems but, fixing those problems is the best way, IMHO to learn more about the system!  So, by installing a 'testing' branch, I will learn more about how *BSD works!  :)

Thanks franco, and mimugmail, for your responses!  :)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on September 24, 2019, 04:22:59 pm
When you install 13 you wont get any binary updates, it's usually only for testing the current state (correct me if I'm wrong Franco). You should install 12.0, there are not many features and it's way better supported.

It's not like with linux that you have bleeding edge wifi or graphic adapters when running 13 :)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: Mr.Goodcat on October 19, 2019, 06:08:08 pm
For some odd reason the guide doesn't work for me. After activating the plugin URLs are no longer resoved. I'm on the latest version of OPN and have two WAN interfaces. There are rules on the LAN interface to allow packets going to ports 53 and 5353 on the firewall itself. Any ideas?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on October 19, 2019, 06:37:39 pm
Are only interested in DNSBL?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: Mr.Goodcat on October 19, 2019, 06:54:14 pm
I'm trying to switch to DoH, right now i'm using DoT via unbound.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: l0stnyc on October 20, 2019, 12:32:57 am
Are you using unbound and dnscrypt for DOH?  Or just using dnscrypt as standalone? 

When using unbound and dnscrypt as per the instructions in the first post (but unchecking DNSSEC in unbound) it works fine.  However when trying to use dnscrypt as standalone DNS listening on port 53, it also doesnt work.  To be more specific it works for a bit then nothing resolves.  I'm not sure why.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: Mr.Goodcat on October 20, 2019, 02:18:19 pm
I tried both, neither works.
Thanks for the hint regarding unchecking DNSSEC in unbound! However it still won't resolve any addresses :( Either I'm missing something or there are issues when using multi-WAN (fallback, not load balancing).
My settings are in attachment in case anyone is kind enough to check (I re-activeted DNSSEC in unbound and uncommented the custom options to reactivate DoT for now) :)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on October 20, 2019, 03:38:17 pm
Outgoing interface WAN doesnt make sense when it forwards to dnscrypt on localhost? Do you have ipv6 on WAN?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: Mr.Goodcat on October 20, 2019, 04:09:00 pm
I have two VLANs, one each per ISP. WAN uses IPv4+6 and WAN_elem IPv4.

You were right, the outgoing interface had to be changed to reach DNSCrypt at localhost. It's pretty obvious if you think about it, yet I completely missed it :P Thank you!
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on October 20, 2019, 05:23:49 pm
Glad you did it :)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: WhosTheBosch on December 08, 2019, 07:48:48 am
I've setup everything in this guide. It's worked great and appears to be doing it's job. I've selected only Cloudflare for my DNScrypt provider. However, when I go to Cloudflare's help page it shows me that I'm not connected and DNS over HTTPS isn't working. I was wondering if you might know why?

I use the 1.1.1.1 test page: https://1.1.1.1/help/
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on December 08, 2019, 09:46:14 am
Can you check the logs after dnscrypt-proxy restart if there is something interesting?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: WhosTheBosch on December 08, 2019, 10:34:48 am
Unbound settings:
Code: [Select]
Network interfaces: All local ones
CheckDNSSec Support
Check DHCP Registration
Check DHCP Static Mappings
Local Zone Type: Transparent
Outgoing Network Interfaces: All local ones
- Note I had this set to WAN when I was using pfSense but it doesn't work for me here

do-not-query-localhost: no

forward-zone:
   name: "."
   forward-addr: 127.0.0.1@5353

Can you check the logs after dnscrypt-proxy restart if there is something interesting?

Nothing that I could see:

Code: [Select]
[2019-12-08 08:53:59] [NOTICE] dnscrypt-proxy is ready - live servers: 1
[2019-12-08 08:53:59] [NOTICE] Server with the lowest initial latency: cloudflare (rtt: 3ms)
[2019-12-08 08:53:59] [NOTICE] [cloudflare] OK (DoH) - rtt: 3ms
[2019-12-08 08:53:59] [NOTICE] Now listening to 127.0.0.1:5353 [TCP]
[2019-12-08 08:53:59] [NOTICE] Now listening to 127.0.0.1:5353 [UDP]
[2019-12-08 08:53:59] [NOTICE] Loading the set of forwarding rules from [forwarding-rules.txt]
[2019-12-08 08:53:59] [NOTICE] Loading the set of cloaking rules from [cloaking-rules.txt]
[2019-12-08 08:53:57] [NOTICE] Loading the set of blocking rules from [blacklist.txt]
[2019-12-08 08:53:57] [NOTICE] Firefox workaround initialized
[2019-12-08 08:53:57] [NOTICE] Loading the set of whitelisting rules from [whitelist.txt]
[2019-12-08 08:53:57] [NOTICE] Source [public-resolvers.md] loaded
[2019-12-08 08:53:57] [NOTICE] Network connectivity detected
[2019-12-08 08:53:57] [NOTICE] dnscrypt-proxy 2.0.31
[2019-12-08 08:23:19] [NOTICE] Server with the lowest initial latency: cloudflare (rtt: 4ms)

When I visit https://1.1.1.1/help in Firefox (Note I have uBlock Origin installed), I also get the same message from Edge though about DoH not working.

Code: [Select]
[2019-12-08 09:00:48] 192.168.1.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.cloudflareresolve.com.cdn.cloudflare.net AAAA SYNTH 0ms -
[2019-12-08 09:00:48] 192.168.0.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.cloudflareresolve.com.cdn.cloudflare.net AAAA SYNTH 0ms -
[2019-12-08 09:00:48] 192.168.4.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.cloudflareresolve.com.cdn.cloudflare.net AAAA SYNTH 0ms -
[2019-12-08 09:00:48] 192.168.0.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.cloudflareresolve.com.cdn.cloudflare.net AAAA SYNTH 0ms -
[2019-12-08 09:00:48] 192.168.4.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.cloudflareresolve.com.cdn.cloudflare.net AAAA SYNTH 0ms -
[2019-12-08 09:00:48] 192.168.2.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.cloudflareresolve.com.cdn.cloudflare.net DS PASS 9ms cloudflare
[2019-12-08 09:00:48] 192.168.3.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.cloudflareresolve.com.cdn.cloudflare.net AAAA SYNTH 0ms -
[2019-12-08 09:00:48] 192.168.2.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.cloudflareresolve.com.cdn.cloudflare.net A PASS 4ms cloudflare
[2019-12-08 09:00:48] 192.168.4.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.cloudflareresolve.com.cdn.cloudflare.net A PASS 4ms cloudflare
[2019-12-08 09:00:48] 192.168.9.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.map.cloudflareresolve.com A PASS 10ms cloudflare
[2019-12-08 09:00:48] 192.168.4.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.map.cloudflareresolve.com A PASS 33ms cloudflare
[2019-12-08 09:00:48] 192.168.4.1 is-doh.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.1.1 is-doh.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.2.1 is-doh.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.0.1 is-doh.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.0.1 is-doh.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.4.1 is-doh.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.1.1 is-doh.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.2.1 is-doh.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.0.1 is-doh.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.9.1 is-doh.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.4.1 is-doh.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.2.1 is-doh.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.3.1 is-doh.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.2.1 is-doh.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.4.1 is-doh.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.4.1 is-doh.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.3.1 is-doh.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.0.1 is-doh.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.4.1 is-doh.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.4.1 is-doh.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.0.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.is-doh.cloudflareresolve.com A PASS 6ms cloudflare
[2019-12-08 09:00:48] 192.168.3.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.is-dot.cloudflareresolve.com A PASS 7ms cloudflare
[2019-12-08 09:00:48] 192.168.2.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.is-dot.cloudflareresolve.com A PASS 34ms cloudflare
[2019-12-08 09:00:48] 192.168.2.1 is-cf.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.0.1 is-cf.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.4.1 is-cf.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.0.1 is-cf.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.3.1 is-cf.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.2.1 is-cf.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.3.1 is-cf.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.0.1 is-cf.cloudflareresolve.com DS PASS 1ms -
[2019-12-08 09:00:48] 192.168.0.1 is-cf.cloudflareresolve.com.cdn.cloudflare.net DS PASS 0ms -
[2019-12-08 09:00:48] 192.168.4.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.is-cf.cloudflareresolve.com A PASS 77ms cloudflare
[2019-12-08 09:00:48] 192.168.4.1 is-cf.cloudflareresolve.com DS PASS 2ms -
[2019-12-08 09:00:48] 192.168.2.1 ae55910f-9418-4ad0-b84e-8635371cbcf5.is-cf.cloudflareresolve.com A PASS 19ms cloudflare
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on December 08, 2019, 11:31:18 am
Can you check with tcpdump on WAN If you see DNS traffic on 53 or just 443.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: WhosTheBosch on December 08, 2019, 12:11:17 pm
Can you check with tcpdump on WAN If you see DNS traffic on 53 or just 443.

Ya, I did that earlier, nothing on 53, although I also have a firewall rule blocking it for external networks and only allowing it for internal.

Code: [Select]
tcpdump -ni ix0 port 53
listening on ix0
0 packets captured
130285 packets received by filter
0 packets dropped by kernel

tcpdump -ni ix0 port 443
listening on ix0
3109 packets captured
2318077 packets received by filter
0 packets dropped by kernel

...
11:00:31.179125 IP 1.0.0.1:443 > WAN_IP:17505: flags [.] ack 18163, win 63, length 0
11:00:31.179377 IP 1.0.0.1:443 > WAN_IP:17505: flags [F.] seq 53635, ack 18162, win 63, length 0

tcpdump -ni ix0 host 1.0.0.1 and port 443 - I get a whole bunch more 1.0.0.1:443 traffic.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on December 08, 2019, 03:28:56 pm
Then it's surely an error at Cloudfare not detecting it as encrypted ...
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: sol on December 08, 2019, 04:04:18 pm
are you using pihole by any chance?
I have the same issue.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: WhosTheBosch on December 08, 2019, 11:02:17 pm
Then it's surely an error at Cloudfare not detecting it as encrypted ...

That's what I'm thinking, I just wanted to check to make sure I didn't have any settings wrong though.

are you using pihole by any chance?
I have the same issue.

No, I'm just using the settings from the first post here that use Unbound as a forwarder to DNScrypt which then uses DNS over HTTPS to Cloudflare (in my case) to resolve.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: WhosTheBosch on December 08, 2019, 11:05:21 pm
Question: Will this setup cause any issues with setting up Dynamic DNS? On the DDNS creation page it says:

Quote
"You must configure a DNS server in System: General setup or allow the DNS server list to be overridden by DHCP/PPP on WAN for dynamic DNS updates to work."

But with this setup both of those are not done.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: WhosTheBosch on December 09, 2019, 08:09:50 am
Question: Will this setup cause any issues with setting up Dynamic DNS? On the DDNS creation page it says:

Quote
"You must configure a DNS server in System: General setup or allow the DNS server list to be overridden by DHCP/PPP on WAN for dynamic DNS updates to work."

But with this setup both of those are not done.

At least with Namecheap Dynamic DNS this works.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: homenetworkguy on December 19, 2019, 10:48:54 pm
I found the original instructions helpful. The server list is what I was stuck on the most. I didn't realize you had to enter the name of the server rather than the IP address. It makes sense because there are sometimes multiple options per DNS server (like Quad9).

One gotcha I would like to mention in case someone finds it useful. I am running the MDNS Repeater service (so that I can make use of certain services across VLANs like being able to autodiscover and access my printer/scanner across VLANs). This service runs on port 5353 which is the default value for the dnscrypt-proxy plugin. The dnscrypt-proxy service would not start unless I changed the port to something else. Once I changed the default port and updated my configuration in the Unbound settings, I was up and running!
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on January 10, 2020, 08:39:41 pm
I have updated the Tutorial...

Happy New Year to All  ;) 8)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: karlson2k on January 13, 2020, 10:03:18 pm
A few additions/corrections.

If you use any domain overrides in Unbound then provided recipe will result in failed to (re)start Unbound.
The reason is that domain overrides is included in unbound.conf before "Custom" options and domain overrides change section from "server:" to "forward-zone:".
To fix error in configuration, you need to add "server:" line before "do-not-query-localhost: no"

Also, if you are not worried about a few leaked DNS requests, you can use option "forward-first: yes" so if DNSCrypt-Proxy is failed (or not started yet), Unbound will fallback to normal resolving. This gives you a much more stable but a bit less private configuration.

Also make sure that you did not set any specific "Outgoing Network Interfaces" otherwise Unbound will fail to connect to loopback addresses.

My resulting "Custom options" for Unbound:
Code: [Select]
server:
    do-not-query-localhost: no

forward-zone:
    name: "."
    forward-addr: 127.0.0.1@5353
    forward-first: yes
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on January 15, 2020, 10:14:20 pm
Thanks for the additional informations. I had no problems over 1 year with this config and also opnsense has this in his official documentation, see:
https://wiki.opnsense.org/manual/how-tos/dnscrypt-proxy.html?

Quote
domain overrides change section from "server:" to "forward-zone:".
To fix error in configuration, you need to add "server:" line before "do-not-query-localhost: no"
I have 1 override in unbound and all works fine. But People who has problems can try to write "server:" at the beginning on "custom options". This already exists in unbound.conf.

Quote
Also, if you are not worried about a few leaked DNS requests, you can use option "forward-first: yes" so if DNSCrypt-Proxy is failed (or not started yet), Unbound will fallback to normal resolving. This gives you a much more stable but a bit less private configuration.
If DNSCrypt does not start i want to know that. For me this is not an option that unbound use a fallback resolver or forwards dns query to the systems dns. Maybe you don't know that encrypted dns fails over weeks. DNSCrypt has a fallback resolver.

Quote
Also make sure that you did not set any specific "Outgoing Network Interfaces" otherwise Unbound will fail to connect to loopback addresses.
In the past i choosed "localhost" on Outgoing Network Interface because i had the assurance that traffic goes to DNSCrypt but this is removed since opnsense 19. Now you must choose "All".

Kind Regards
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: cake on January 17, 2020, 10:06:46 pm
The geoip with alias's addition to OpnSense came at a good time. According to ipleak.net mine was using a dnscrypt server in China. Seems like a bad idea. I had no idea dnscrypt-proxy servers in cn were add to the official list.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on January 18, 2020, 04:29:06 pm
The geoip with alias's addition to OpnSense came at a good time. According to ipleak.net mine was using a dnscrypt server in China. Seems like a bad idea. I had no idea dnscrypt-proxy servers in cn were add to the official list.

thats why you can use your trusted and favorite servers on "Server List" ;-)

Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: karlson2k on January 18, 2020, 05:34:06 pm
Thanks for the additional informations. I had no problems over 1 year with this config and also opnsense has this in his official documentation, see:
https://wiki.opnsense.org/manual/how-tos/dnscrypt-proxy.html?
Official documentation also needs to be fixed.


Quote
domain overrides change section from "server:" to "forward-zone:".
To fix error in configuration, you need to add "server:" line before "do-not-query-localhost: no"
I have 1 override in unbound and all works fine. But People who has problems can try to write "server:" at the beginning on "custom options". This already exists in unbound.conf.

This will work if you have host override. But any single domain override will break it.

On the other hand, even if you don't have any overrides, line "server:" will not harm anything.

So safe and future-proof solution is to add "server:". In this case configuration will not break after future changes, which can include domain overrides.

Quote
Also make sure that you did not set any specific "Outgoing Network Interfaces" otherwise Unbound will fail to connect to loopback addresses.
In the past i choosed "localhost" on Outgoing Network Interface because i had the assurance that traffic goes to DNSCrypt but this is removed since opnsense 19. Now you must choose "All".
Yes, it must be set to "All". Otherwise configuration will not work.
It worth to mention it in your "HOWTO".
I spent some time before figured out why my configuration doesn't work at all.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: cake on January 18, 2020, 10:26:40 pm
The geoip with alias's addition to OpnSense came at a good time. According to ipleak.net mine was using a dnscrypt server in China. Seems like a bad idea. I had no idea dnscrypt-proxy servers in cn were add to the official list.

thats why you can use your trusted and favorite servers on "Server List" ;-)

Thank you,  I will now. :-)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on January 18, 2020, 11:39:39 pm
Quote
karlson2k:
This will work if you have host override. But any single domain override will break it.

On the other hand, even if you don't have any overrides, line "server:" will not harm anything.

So safe and future-proof solution is to add "server:". In this case configuration will not break after future changes, which can include domain overrides.

thats correct. I have only 1 host override. i will add this to the Tutorial. Thank you for the explanations.

Quote
karlson2k:
Yes, it must be set to "All". Otherwise configuration will not work.
It worth to mention it in your "HOWTO".
I spent some time before figured out why my configuration doesn't work at all.

thats already in the Tutorial ;-)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: Nekromantik on January 26, 2020, 07:01:11 pm
does this replace using stubby?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on January 26, 2020, 08:52:04 pm
does this replace using stubby?

stubby uses DoT and dnscrypt-proxy uses DNSCrypt or DoH and optional DNSBL. difficult to say what is better. depend of privat/business yousecase. i think DoH for client <-> resolver requests and DoT for server <-> resolver requests. DNSCrypt seems not so populate but has more privacy features. you don't can use both for the same ports. only with different and then you must handle the request from the clients. i like the option from dnscypt-proxy to use an own serverlist from trusted server and it always use the fastest. DoH seems to be the fastest way because existing technologies and knowledge for https requests can be used for this. loadbalancer, haproxies, not blocked ports...
with an cronjob on opnsense you can restart the service from dnscrypt-proxy every 15min or 30min and it use the fastest server again. for me a good combination. all can be configured over the gui. Not necessary to install packages over cli.
If you use the firewall only for you and you are the only admin thats ok to configure the firewall with custom configurations if you know what you do.
If you use the firewall for customers/other admins or only not familiar with deep firewall knowledge its diffcult to handle custom options and manual installations of packages. stability, troubleshooting. some configs over gui. some over cli... not really supportet and so on...

but this is only my experience ;-)
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: Nekromantik on January 28, 2020, 08:24:06 pm
thanks
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: chain on March 02, 2020, 04:10:15 am
How to redirect all traffic to forward traffic to Unbound DNS/DNSCrypt  Current I have rule that

Interface LAN
Protocol TCP/UDP
Source LAN Net
Destination ANY
Destination port range DNS.

Or is related to the article that you have posted that would work with HOWTO - Redirect all DNS Requests to Opnsense injunction with you current article?
thanks
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: p1n0ck10 on March 04, 2020, 01:23:03 am
How to redirect all traffic to forward traffic to Unbound DNS/DNSCrypt  Current I have rule that

Interface LAN
Protocol TCP/UDP
Source LAN Net
Destination ANY
Destination port range DNS.

Or is related to the article that you have posted that would work with HOWTO - Redirect all DNS Requests to Opnsense injunction with you current article?
thanks

It is good explained in the HOWTO - Redirect all DNS Requests to Opnsense. It is only a recommendation and they are not dependent to each other. It should be a NAT Rule => "Firewall/NAT/Port Forward" and destination is "invert" + "Local Firewall Address" that means if your clients uses not the local firewall address for unencrypted dns (Port 53) it redirects the request to opnsense. If some clients in your network uses encrypted dns it would not apply.

I think you have a normal rule that is not correct...

Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: chain on March 04, 2020, 04:41:45 am
So the rule should look like this that I have include
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: miroco on March 04, 2020, 05:24:01 pm
I found these posts useful.

https://forum.opnsense.org/index.php?topic=5593.0
https://forum.opnsense.org/index.php?topic=9245.0
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: xpendable on March 15, 2020, 09:35:57 pm
Hello,

I just finished setting up DNScrypt-proxy on OPNsense with unbound following the provided guide, and it works great with the exception of not being able to verify DoH is enabled through cloudflare's site for example. Most likely because it knows nothing about the local DNS setup and how it's being routed through OPNsense. However I see that a local DoH server can be setup via DNScrypt-proxy: https://github.com/DNSCrypt/dnscrypt-proxy/wiki/Local-DoH

I've taken a look at the dnscrypt-proxy.toml configuration file located in /usr/local/etc/dnscrypt-proxy, however there is no section called local_doh. I assume that any changes via the OPNsense GUI would overwrite any changes done manually via the config file? Perhaps an update to the os-dnscrypt-proxy plugin could be made to allow this configuration through the GUI?

EDIT: I missed this part in the wiki near the bottom (don't pay attention to the "Secure DNS" column, the green mark will only be shown when using Cloudflare). So I guess that check will never work unless pointing to cloudflare directly, but I suppose this would be the local solution in order to enable ESNI in Firefox when using DoH. Which may be debatable on it's current usefullness due to it's lack of implementation.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: Exinus on August 19, 2020, 01:42:03 am
Install DNSCrypt-Proxy:
System/Firmware/Plugins
=> Install "os-dnscrypt-proxy"

is the plugin discontinued?
For me trying to use on OPNsense 2.1.9 the plugin (os-dnscrypt-proxy) is missing on the plugin list.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on August 19, 2020, 07:29:32 am
i386?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: Exinus on August 19, 2020, 01:57:12 pm
yes sure i386, but that shouldn't be a problem.

Version 18.7 still had the plugin in the i386 pepository
http://mirror.wjcomms.co.uk/opnsense/FreeBSD:11:i386/18.7/latest/Latest/

So it is apparently feasible in terms of programming?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on August 19, 2020, 08:16:29 pm
I think it depends on Go which is now unsupported in i386
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt Plugin for IPv4 + IPv6
Post by: Bytechanger on August 23, 2020, 09:45:53 am
You can also add an alias 127.0.0.8 and listen dnscrypt to this IP with port 53. Will also work ...

How Do I do this for IPv6 please?

Virtual IP for ::8 ??

Greets

Byte
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on August 23, 2020, 10:07:08 am
::1
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: Bytechanger on August 23, 2020, 10:39:49 am
::1

I doesn´t understand this.

127.0.0.1 doesn´t  work, because unbound dns ist listen to Port 53.
So I set 127.0.0.8 as virtual IP and listen do Port 53.

So ::1 doesn´t work, because unbound DNS listen to Port 53,
so I need another virtual IP for listen to Port 53.
e.g. ::8 Port 53 ???


Greets

Byte
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: mimugmail on August 23, 2020, 02:49:45 pm
Ah, yes, you can add as many loopback ips as you like, or just use a different port
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: Bytechanger on August 23, 2020, 02:55:10 pm
Thanks,

In BIND, you can't set Port for Forwarder in GUI.

Should ::8 work for ipv6?
And wich Adapter I shoud set?
Loopback?


Greets

Byte
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: phi6ias on November 12, 2020, 02:48:22 pm
Hi guys,

I have OPNSense installed as a VM in a Proxmox homelab test server for the purpose of trial and error (the first error is that the PC only has one physical NIC).

I setup Unbound and DNSCrypt as described in this excellent HowTo. Now to the odd behaviour:

If I use the automatic DNS option for a client, I get the expected ISP running a dnsleaktest.com extended test and if I set a DNS like the fallback resolver specified in DNSCrypt, then I get that.
However, if I set the OPNSense VM as the sole DNS then nothing will be resolved. Yet, if I specify a second DNS name server, like the one used as fallback resolver, then I do get DNScrypt results. Even more strange, I don't exclusively get DNSCrypt name server, but also the odd amazon, google and similar?!?

Running "dnscrypt-proxy -resolve opnsense.org" and "unbound-host opnsense.org" don't return anything unexpected.

Has anyone seen that before and/or any idea how to solve it?

I am new to the topic and any help and advise would be much appreciated.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: yeraycito on December 11, 2020, 02:39:34 pm
New DNS Security Protocol from Cloudflare

Info:    https://blog.cloudflare.com/oblivious-dns/
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: jcxhard on February 18, 2021, 01:54:03 am
Hello Guys, following this tutorial, I deployed DNSCrypt and it's working. Is it possible to use this service in conjunction with a Transparent Proxy?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: dcol on April 01, 2021, 06:20:36 pm
Hi All,
I followed the tutorial and DNSSEC works fine for ipv4 but I get no access on IPv6. All the tests fail on IPv6.
I made sure that IPv6 was enabled and added to the rules.
Is there something more basic I am missing? Gateway maybe? NIC properties?

[UPDATE]
I am now able to get IPv6 DNS. I set the WAN Interface IPv6 Configuration type to DHCPv6 with a PD of 60 and my two LAN interfaces to 'Track Interface', each with a different Prefix ID. I could not find info on how to get multiple LAN interfaces to work with IPv6 anywhere, so hopefully this info will help someone.

If this approach is incorrect, please post here.

[UPDATE2]
Seems all my proxys didn't work because they were using IPv6 addressing, so I changed Settings>General>Prefer IPv4 over IPv6 to checked, and now everything works again.
Again, if this wasn't the correct way to handle this, please advise.

Thanks
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: ingvarr on June 20, 2021, 06:42:46 pm
I have set the Unbound + DNSCrypt-proxy bundle as described, for it makes sense.
Unfortunately, some of the requests seems to fail from my computer.
Further investigation revealed the following:

1. The cache sometimes causes trouble
When DNSCrypt-proxy restarts for too long, Unbound panics and says that all is lost, and then my macOS caches that there is no IP for the name, and I get a blank page.
This behaviour can be eliminated with forward-first: yes, as someone mentioned, but this poses obvious disadvantages.
Another possibility is forward-no-cache: yes, but that might be even worse.
Now, a better option is to enable Unbound DNS :: Advanced :: Serve expired responses, because the most affected records are short-TTL ones.

2. DNSSEC hardening causes trouble
When Unbound DNS :: Advanced :: Harden DNSSEC data is enabled (a naive thing to do, it was), this often happens:
Code: [Select]
2021-06-20T03:33:04 unbound[76608] [76608:0] debug: validator[module 0] operate: extstate:module_wait_module event:module_event_moddone
2021-06-20T03:33:04 unbound[76608] [76608:0] info: validator operate: query wiki.mageia.org. A IN
2021-06-20T03:33:04 unbound[76608] [76608:3] debug: verify: signature mismatch
Disabling the option solves the problem.

Now, what I don't understand at all is that when I change forwarders from DNSCrypt to 9.9.9.9@53, it seems fine (with other settings unchanged):
Code: [Select]
2021-06-20T15:57:58 unbound[13980] [13980:1] debug: validator[module 0] operate: extstate:module_wait_subquery event:module_event_pass
2021-06-20T15:57:58 unbound[13980] [13980:1] info: validator operate: query wiki.mageia.org. A IN
2021-06-20T15:57:58 unbound[13980] [13980:1] info: Verified that unsigned response is INSECURE
Does it mean that DNSCrypt somehow tries to sign that's unsigned, causing frustration in Unbound?..

Some awkward behaviour is also visible around them new TYPE65 requests, but I did not reveal anything specific.

3. Even when all works, Unbound seems to treat forwarders inefficiently
Code: [Select]
2021-06-20T15:57:57 unbound[13980] [13980:1] info: resolving wiki.mageia.org. A IN
2021-06-20T15:57:57 unbound[13980] [13980:1] info: processQueryTargets: wiki.mageia.org. A IN
2021-06-20T15:57:57 unbound[13980] [13980:1] info: sending query: wiki.mageia.org. A IN
2021-06-20T15:57:57 unbound[13980] [13980:1] debug: sending to target: <.> 9.9.9.9#53
2021-06-20T15:57:57 unbound[13980] [13980:1] debug: cache memory msg=138269 rrset=146053 infra=10617 val=136881
2021-06-20T15:57:57 unbound[13980] [13980:1] debug: iterator[module 1] operate: extstate:module_wait_reply event:module_event_reply
2021-06-20T15:57:57 unbound[13980] [13980:1] info: iterator operate: query wiki.mageia.org. A IN
2021-06-20T15:57:57 unbound[13980] [13980:1] info: sanitize: removing extraneous answer RRset: sucuk.mageia.org. A IN
2021-06-20T15:57:57 unbound[13980] [13980:1] info: response for wiki.mageia.org. A IN
2021-06-20T15:57:57 unbound[13980] [13980:1] info: reply from <.> 9.9.9.9#53
2021-06-20T15:57:57 unbound[13980] [13980:1] info: query response was CNAME
2021-06-20T15:57:57 unbound[13980] [13980:1] info: resolving wiki.mageia.org. A IN
2021-06-20T15:57:57 unbound[13980] [13980:1] info: processQueryTargets: wiki.mageia.org. A IN
2021-06-20T15:57:57 unbound[13980] [13980:1] info: sending query: sucuk.mageia.org. A IN

So, what I read from this, when Unbound gets CNAME instead of A, it does query for that A, but first complains that it is from another domain. I am mildly concerned that this is not right.

Recommendations for the tutorial

Thank you for the attention.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: karlson2k on June 22, 2021, 05:53:04 pm
How to solve the wrong boot load order?

Unbound loads early, before DNSCrypt is loaded. Unbound fails to connect to DNSCrypt and reports error. The error persist until DNSCrypt is loaded AND Unbound is restarted.

More details here: https://forum.opnsense.org/index.php?topic=23606.0
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: scream on July 12, 2021, 04:50:19 pm
I configured my unbound & dnscrypt-proxy as described in the first post.

Unfortunatley it doesn't work right.
While some domains are working fine others can't be resolved at all.

query.log of dnscrypt-proxy shows like this:

Code: [Select]
[2021-07-12 16:46:13]   127.0.0.1       office365.com   DS      PASS    11ms    NextDNS-Primary
[2021-07-12 16:46:13]   127.0.0.1       office365.com   DS      PASS    0ms     -
[2021-07-12 16:46:13]   127.0.0.1       office365.com   DS      PASS    0ms     -
[2021-07-12 16:46:13]   127.0.0.1       office365.com   DS      PASS    0ms     -
[2021-07-12 16:46:13]   127.0.0.1       office365.com   DS      PASS    0ms     -
[2021-07-12 16:46:13]   127.0.0.1       office365.com   DS      PASS    0ms     -
[2021-07-12 16:46:22]   127.0.0.1       community.librenms.org  A       PASS    0ms     -
[2021-07-12 16:46:22]   127.0.0.1       librenms.org    DS      PASS    0ms     -
[2021-07-12 16:46:22]   127.0.0.1       librenms.org    DS      PASS    0ms     -
[2021-07-12 16:46:22]   127.0.0.1       librenms.org    DS      PASS    0ms     -
[2021-07-12 16:46:22]   127.0.0.1       librenms.org    DS      PASS    0ms     -
[2021-07-12 16:46:22]   127.0.0.1       librenms.org    DS      PASS    0ms     -
[2021-07-12 16:46:22]   127.0.0.1       librenms.org    DS      PASS    0ms     -
[2021-07-12 16:46:22]   127.0.0.1       beacons.gvt2.com        A       PASS    0ms     -

As you can see the first request was working while all the others end with "PASS" but with the "-" in the end of the line instead the selected DNS-Server profile.

Unbound custom options:
Code: [Select]
server:
tls-cert-bundle: "/etc/ssl/cert.pem"
local-zone: "use-application-dns.net" always_nxdomain
do-not-query-localhost: no
forward-zone:
name: "."
forward-addr: 127.0.0.1@5354

dnscrypt-proxy is listening on 127.0.0.1:5354 and does get the requests forwarded by unbound, so this shouldn't be the issue.

Any ideas why this does happen?

Edit:
I can solve the issue by uncheck "Enable DNSSEC Support" in unbound settings.
I do not like to disable DNSSEC support. So is there a other way to get it working?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: blblblb on July 27, 2021, 12:24:48 pm
I followed this tutorial (but I do have the DNS servers set in the general settings) and I have issues after a while, where Unbound fails (but DNScrypt remains working).

Code: [Select]
Unbound:

# dig @127.0.0.1 docs.ruckuswireless.com

; <<>> DiG 9.16.18 <<>> @127.0.0.1 docs.ruckuswireless.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 39747
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;docs.ruckuswireless.com.       IN      A

DNScrypt:
# dig @127.0.0.1 -p5300 docs.ruckuswireless.com

; <<>> DiG 9.16.18 <<>> @127.0.0.1 -p5300 docs.ruckuswireless.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19463
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;docs.ruckuswireless.com.       IN      A

;; ANSWER SECTION:
docs.ruckuswireless.com. 599    IN      CNAME   docs.ruckuswireless.com.cdn.cloudflare.net.
docs.ruckuswireless.com.cdn.cloudflare.net. 599 IN A 104.20.41.32
docs.ruckuswireless.com.cdn.cloudflare.net. 599 IN A 104.20.42.32

;; Query time: 35 msec
;; SERVER: 127.0.0.1#5300(127.0.0.1)
;; WHEN: Tue Jul 27 12:24:22 CEST 2021
;; MSG SIZE  rcvd: 140

Anyone knows what could be happening?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: RamSense on July 28, 2021, 04:05:44 pm
Dear @p1n0ck10 and others,

Does this DOH still work on opnsense 21.7 ?
Since unbound dns - custom options is removed (?)
I followed your guide and have this in the custom options added:
server:
do-not-query-localhost: no

forward-zone:
   name: "."
   forward-addr: 127.0.0.1@5353
   forward-addr: ::1@5353

Can I upgrade to opnsense 21.7 or what should we alter where in the opnsense gui to keep DoH running like it should???
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: chemlud on July 28, 2021, 04:13:51 pm
https://forum.opnsense.org/index.php?topic=23929.msg115176#msg115176

is the solution, but you need to mess around with console and these things don'T end in config.xml, so you need to restore this manually for any new install.

Or you install the plugin from the community repo (mimugmail) for the custom options field after updating to 21.7

https://forum.opnsense.org/index.php?topic=23929.msg114064#msg114064
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: RamSense on July 28, 2021, 04:18:41 pm
Thanks for the link, but Owh, messing around with the console doesn't sound very promising....
Should we better switch from DoH to DoT than? Since that is more straight forward?
As I just read here: https://homenetworkguy.com/how-to/configure-dns-over-tls-unbound-opnsense/

I thought that DoH was the " better" solution over DoT ?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: chemlud on July 28, 2021, 04:52:57 pm
Better as in what? ;-)

I use DoT and there is a page in 21.7 for that, together with CNAME minimisation under "Advanced" settings for unbound you are for most things on the not-so-unsafe side. Choose some servers you want to trust, I posted my choice in the thread linked above.

Or you install the plugin for the custom stuff in unbound from mimugmail. Choose your weapon...

Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: RamSense on July 28, 2021, 09:40:35 pm
Quote
Better as in what? ;-)
good question :-)
When learning about DoT and DoH I read this: "However, from a privacy perspective, DoH is arguably preferable. With DoH, DNS queries are hidden within the larger flow of HTTPS traffic. This gives network administrators less visibility but provides users with more privacy."

And that made me choose DoH back than...

But I'm also looking at opnsense and read about the native DoT usage in Unbound, added with the latest update of opnsense loosing the DoH custom option in Unbound, made we switch to DoT and keeps things over here easy to manage and update future proof without having to "mesh around in the console" :-)

Thanks for your help!
Running DoT works as a charm...
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: chemlud on July 28, 2021, 10:29:36 pm
When I leave my own network, I'm a user and would use DoH, as it is not easy to block for admins.

When I'm in my own network, I'm an admin and hate DoH. But for the provider or anybody upstream (if he can open TLS traffic), it hardly makes a difference, if he filters for port 853 or the DNS providers by a list of IPs contacted on port 443 via DoH...
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: JohnnyBeee on August 14, 2021, 10:05:17 am
Now that the "custom options" are gone for Unbound DNS since OPNsense 21.7, how do I configure Unbound DNS with DNSCRYPT-PROXY ?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: ingvarr on August 14, 2021, 03:12:03 pm
Now that the "custom options" are gone for Unbound DNS since OPNsense 21.7, how do I configure Unbound DNS with DNSCRYPT-PROXY ?
It appears that the only straight way is Enable Forwarding Mode with DNSCrypt-Proxy being listed in system DNS.
Ugly and will also create madness with multiple WANs.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: nikkon on August 14, 2021, 03:39:34 pm
On the 21.7.1 version the DoT doesn’t work easy. Required 3 service restarts. No idea why.
Once I define and enable the entries under Unbound -> DNS over TLS and enable 1 of them, dns is dead.

2021-08-14T15:37:31   unbound[96235]   [96235:0] info: mesh has 0 recursion states (0 with reply, 0 detached), 0 waiting replies, 21 recursion replies sent, 0 replies dropped, 0 states jostled out   
2021-08-14T15:37:31   unbound[96235]   [96235:0] info: server stats for thread 7: requestlist max 4 avg 0.545455 exceeded 0 jostled 0   
2021-08-14T15:37:31   unbound[96235]   [96235:0] info: server stats for thread 7: 146 queries, 125 answers from cache, 21 recursions, 1 prefetch, 0 rejected by ip ratelimiting

Finally it started working

https://1.1.1.1/help#eyJpc0NmIjoiTm8iLCJpc0RvdCI6IlllcyIsImlzRG9oIjoiTm8iLCJyZXNvbHZlcklwLTEuMS4xLjEiOiJZZXMiLCJyZXNvbHZlcklwLTEuMC4wLjEiOiJZZXMiLCJyZXNvbHZlcklwLTI2MDY6NDcwMDo0NzAwOjoxMTExIjoiTm8iLCJyZXNvbHZlcklwLTI2MDY6NDcwMDo0NzAwOjoxMDAxIjoiTm8iLCJkYXRhY2VudGVyTG9jYXRpb24iOiJBTVMiLCJpc1dhcnAiOiJObyIsImlzcE5hbWUiOiJDbG91ZGZsYXJlIiwiaXNwQXNuIjoiMTMzMzUifQ==
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: JohnnyBeee on August 17, 2021, 04:36:54 am
Now that the "custom options" are gone for Unbound DNS since OPNsense 21.7, how do I configure Unbound DNS with DNSCRYPT-PROXY ?
It appears that the only straight way is Enable Forwarding Mode with DNSCrypt-Proxy being listed in system DNS.
Ugly and will also create madness with multiple WANs.

The only problem with that is the port. You cannot specify a port in the system settings and you cannot have 2 services listening on the same port (53).

So am I right to assume that the custom options have only disappeared from the configuration GUI but are still taken into account when entered in unbound.conf?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: ingvarr on August 17, 2021, 10:52:59 am
Now that the "custom options" are gone for Unbound DNS since OPNsense 21.7, how do I configure Unbound DNS with DNSCRYPT-PROXY ?
It appears that the only straight way is Enable Forwarding Mode with DNSCrypt-Proxy being listed in system DNS.
Ugly and will also create madness with multiple WANs.

The only problem with that is the port. You cannot specify a port in the system settings and you cannot have 2 services listening on the same port (53).

So am I right to assume that the custom options have only disappeared from the configuration GUI but are still taken into account when entered in unbound.conf?
Virtual IPs?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: crissi on September 05, 2021, 12:54:46 pm
Regarding DNS Crypt Proxy with Unbound DNS – General Network Interfaces, should here be really selected All Interfaces or just specific, like LAN, VLAN and OpenVPN Connection?

What are further recommended Settings under Unbound DNS – Advanced?

Thx
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: janci on September 14, 2021, 07:07:31 am
Advanced Configurations in https://docs.opnsense.org/manual/unbound.html#advanced-configurations (https://docs.opnsense.org/manual/unbound.html#advanced-configurations)
is describing new way to add custom option into unbound.

So I did create file
/usr/local/etc/unbound.opnsense.d/dns-crypt-forward.conf

with this content
server:
do-not-query-localhost: no

forward-zone:
   name: "."
   forward-addr: 127.0.0.1@5353
   forward-addr: ::1@5353


command configctl unbound check is OK with that


now, question is how to check if unbound is forwarding queries to dns-cryopt?

so trying these webs:
- http://verteiltesysteme.net/ saying OK
- https://dnsleaktest.com/ running extetended test and result is list of different DNS resolvers from different countries
- https://cmdns.dev.dns-oarc.net/ looks OK
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: cmccallu on October 10, 2021, 02:47:57 am
Advanced Configurations in https://docs.opnsense.org/manual/unbound.html#advanced-configurations (https://docs.opnsense.org/manual/unbound.html#advanced-configurations)
is describing new way to add custom option into unbound.

So I did create file
/usr/local/etc/unbound.opnsense.d/dns-crypt-forward.conf

with this content
server:
do-not-query-localhost: no

forward-zone:
   name: "."
   forward-addr: 127.0.0.1@5353
   forward-addr: ::1@5353


command configctl unbound check is OK with that


now, question is how to check if unbound is forwarding queries to dns-cryopt?

so trying these webs:
- http://verteiltesysteme.net/ saying OK
- https://dnsleaktest.com/ running extetended test and result is list of different DNS resolvers from different countries
- https://cmdns.dev.dns-oarc.net/ looks OK

Thanks for all the setup details it worked great! The easiest way to see it was working was to look in Services: DNSCrypt-Proxy: Log / Queries and seeing entries appear!
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: PlanetDyna on March 07, 2023, 05:22:42 pm
Can I adopt this configuration 1:1? In this setup, the proxy and relay server have been connected. Or is that not intended?

https://codeberg.org/DecaTec/dnscrypt-proxy-config/commit/6dc93c83e3d7c2249075264bf7ca46ae54a83835
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: karlson2k on August 18, 2023, 02:33:52 pm
Version 23.7 needs some adoption as it has a small bug.

The configuration file must be:

server:
do-not-query-localhost: no

forward-zone:
   name: "."
   forward-addr: 127.0.0.1@5353
   forward-addr: ::1@5353

server:


Note duplicated server: at the end of the block
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: 0zzy on October 21, 2023, 03:02:38 pm
I added the custom config like this:
server:
do-not-query-localhost: no

forward-zone:
   name: "."
   forward-addr: 127.0.0.1@5353
   forward-addr: ::1@5353


But I get an error:
root@OPNsense:/usr/local/etc/unbound.opnsense.d # configctl unbound check
[1697893333] unbound-checkconf[21658:0] error: duplicate forward zone . ignored.
no errors in /var/unbound/unbound.conf

what I'm doing wrong?

ok find the misconfiguration:
got also forwarding configured under Services: Unbound DNS: DNS over TLS
disabled both entries solved my problem.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: senser on October 30, 2023, 07:37:16 am
I have a stupid question: if you want secure DNS queries, why not just use DNS over TCL?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: 0zzy on October 31, 2023, 07:42:33 am
@senser because it's not the only thing I want.
now it works, I don't have an idea what was wrong the last time.
I made any changes to the file after reading docs and tips.
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: pitt1717 on November 01, 2023, 01:00:41 am
just tried following this guide. i get the port in use error if i use 127.0.0.1:5353 and or ::1:5353. i currently have 0.0.0.0:5353 set and leak tests seems to wok, but i think this puts me in standalone mode. which would negate the need for unbound correct?
is there anyway to get the 127 and ::1 working?
Title: Re: HOWTO - DNS Security / Unbound DNS with DNSCrypt, DoH Plugin for IPv4 + IPv6
Post by: cookiemonster on November 01, 2023, 11:01:54 am
As a pointer for what you might need to tweak in your configuration of OPN: 0.0.0.0:5353 means listen on that port on all interfaces, and that will include 127.0.0.1 aka "loopback".