OPNsense Forum

Archive => 23.1 Legacy Series => Topic started by: spacecase-25 on August 05, 2023, 02:31:50 AM

Title: Domains cannot be whitelisted with Unbound
Post by: spacecase-25 on August 05, 2023, 02:31:50 AM
If a domain is contained within a configured blocklist, then it does not appear that there is anyway to whitelist it.  This is despite Unbound clearly being designed to have this functionality... there's a whitelist button right there in the Unbound reporting tab.  I have tried restarting Unbound and it is configured to flush DNS cache on restart.  This functionality appears to be broken.

(https://i.imgur.com/N3dFp03.png)
Title: Re: Domains cannot be whitelisted with Unbound
Post by: sorano on August 05, 2023, 03:15:05 PM
It works for me, what is the FQDN and how does your whitelist entry look?
Title: Re: Domains cannot be whitelisted with Unbound
Post by: spacecase-25 on August 05, 2023, 10:10:04 PM
Quote from: sorano on August 05, 2023, 03:15:05 PM
It works for me, what is the FQDN and how does your whitelist entry look?
I clicked the whitelist button next to the entry under the details panel.  One would think that would just work, no?
Title: Re: Domains cannot be whitelisted with Unbound
Post by: sorano on August 06, 2023, 02:22:31 PM
I've never added whitelisted entries from the reporting tab so I wouldn't know.

I add my whitelisted domain in:

Services --> Unbound DNS --> Blocklist
Whitelist Domains: Input FQDN or use regexp.
Title: Re: Domains cannot be whitelisted with Unbound
Post by: CJ on August 06, 2023, 03:18:59 PM
Quote from: spacecase-25 on August 05, 2023, 10:10:04 PM
Quote from: sorano on August 05, 2023, 03:15:05 PM
It works for me, what is the FQDN and how does your whitelist entry look?
I clicked the whitelist button next to the entry under the details panel.  One would think that would just work, no?

I've done this and it does just work.  Under your DNSBL settings, do you see the domain in the whitelist?
Title: Re: Domains cannot be whitelisted with Unbound
Post by: spacecase-25 on August 06, 2023, 05:36:03 PM
Quote from: CJ on August 06, 2023, 03:18:59 PM
Quote from: spacecase-25 on August 05, 2023, 10:10:04 PM
Quote from: sorano on August 05, 2023, 03:15:05 PM
It works for me, what is the FQDN and how does your whitelist entry look?
I clicked the whitelist button next to the entry under the details panel.  One would think that would just work, no?

I've done this and it does just work.  Under your DNSBL settings, do you see the domain in the whitelist?
It appears to be.  Is this what you're talking about?

(https://i.imgur.com/79oddsl.png)
Title: Re: Domains cannot be whitelisted with Unbound
Post by: CJ on August 07, 2023, 04:09:19 PM
This is interesting.  I did some testing on my server and it appears to be a possible bug with the reporting and/or whitelisting of the DNSBL.

The reason it's not working for you is because of the CNAME.  Once you allowed click.redditmail.com it started resolving.  You can see that in your original screenshot.  The problem is that click.redditmail.com resolves via CNAME to thirdparty.bnc.lt which is also on the blocklist.

Unbound Reporting shows the A and AAAA records being allowed but the CNAME being blocked.  However, it only shows the original click.redditmail.com request, not the resulting CNAME.  Additionally, because of that, there's no option to allow the resulting CNAME query.

As a workaround until this gets looked at, if you do a DNS query you'll get the CNAME for the domain.  You can then add that to your list along with click.redditmail.com and it will work.  However, if the CNAME changes to a different blocked domain, you'll have to go through the whole process again.

https://github.com/opnsense/core/issues/6722
Title: Re: Domains cannot be whitelisted with Unbound
Post by: spacecase-25 on August 11, 2023, 01:38:12 AM
Quote from: CJ on August 07, 2023, 04:09:19 PM
This is interesting.  I did some testing on my server and it appears to be a possible bug with the reporting and/or whitelisting of the DNSBL.

The reason it's not working for you is because of the CNAME.  Once you allowed click.redditmail.com it started resolving.  You can see that in your original screenshot.  The problem is that click.redditmail.com resolves via CNAME to thirdparty.bnc.lt which is also on the blocklist.

Unbound Reporting shows the A and AAAA records being allowed but the CNAME being blocked.  However, it only shows the original click.redditmail.com request, not the resulting CNAME.  Additionally, because of that, there's no option to allow the resulting CNAME query.

As a workaround until this gets looked at, if you do a DNS query you'll get the CNAME for the domain.  You can then add that to your list along with click.redditmail.com and it will work.  However, if the CNAME changes to a different blocked domain, you'll have to go through the whole process again.

https://github.com/opnsense/core/issues/6722
Awesome, thanks for your reply.  What tool do you recommend using to drill down into these DNS queries that are giving me trouble to find the additional domains to whitelist?  Ideally a command line tool for linux.
Title: Re: Domains cannot be whitelisted with Unbound
Post by: CJ on August 11, 2023, 08:09:05 PM
As I mentioned, anything that does a DNS query will tell you.  On linux you can use dig or nslookup.  You can even just use the DNS Lookup page in OPNSense and do it all in the browser.