Whitelist doesn't override blacklist? click.redditmail.com

pihole is blocking access to click.redditmail.com. That is the URL provided in emails I get from reddit for topic notifications.

click.redditmail.com does appear in the StevenBlack blacklist, so I tried whitelisting click.redditmail.com. After whitelisting, I reloaded gravity.

This is what pihole reports when I query click.redditmail.com:


Match found in exact whitelist click.redditmail.com

Match found in regex whitelist (.|^)redditmail.com$

Match found in https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts: click.redditmail.com


But pihole still blocks click.redditmail.com despite the whitelist entry. I thought that whitelists override blacklists. I have no groups or clients configured except the defaults. All of the DNS requests to pihole come from a single location - a Linux bind that forwards to the pihole. pihole is running in a VirtualBox VM. Except for click.redditmail.com, pihole is working as expected.

What am I missing?

From a computer where it shouldn't be blocked, what does the command below give?

dig +short click.redditmail.com

And after you've ran it, how does it look in the Query Log?

What happens when you try clicking the link in the email – how does that look in the Query Log?

Output of dig:

E:\users\howard>dig +short click.redditmail.com
thirdparty.bnc.lt.
0.0.0.0

Log from pihole after above query:

Apr 26 22:43:38: query[A] thirdparty.bnc.lt from 192.1.1.9 
Apr 26 22:43:38: gravity blocked thirdparty.bnc.lt is 0.0.0.0

pihole log immediately after trying to browse to click.redditmail.com shows the same thing as after dig:

Apr 26 22:54:58: query[A] thirdparty.bnc.lt from 192.1.1.9 
Apr 26 22:54:58: gravity blocked thirdparty.bnc.lt is 0.0.0.0

By the way, 192.1.1.9 in the above pihole log is the IP of the bind DNS that forwards to pihole (as expected). The output of the dig command was generated on a different computer (Windows 10) that uses 192.1.1.9 as its DNS server.

If I disable pihole blocking for 30 seconds and try dig again I get:

E:\users\howard>dig +short click.redditmail.com
thirdparty.bnc.lt.
18.144.127.61
13.57.168.50
52.9.171.26
52.9.114.249

Thank you for looking at this.

Please upload a debug log and post just the token URL that is generated after the log is uploaded by running the following command from the Pi-hole host terminal:

pihole -d

or do it through the Web interface:

Tools > Generate Debug Log

Have not done this before, so hope I did it correctly.

Here is the token URL:
https://tricorder.pi-hole.net/AVbNXQya/

Yes, that is a valid token, thank you.

Your debug log shows your Pi-hole host machine to live at 192.1.1.10:

*** [ DIAGNOSING ]: Networking
[✓] IPv4 address(es) bound to the eth0 interface:
    192.1.1.10/24

Your network's DHCP server is distributing two different DNS servers, however:

*** [ DIAGNOSING ]: Discovering active DHCP servers (takes 10 seconds)
   Scanning all your interfaces for DHCP servers
   
   * Received 306 bytes from eth0:192.1.1.253
     Offered IP address: 192.1.1.10
     Server IP address: 192.1.1.253
     DHCP options:
      Message type: DHCPOFFER (2)
      dns-server: 192.1.1.9
      dns-server: 9.9.9.9
      router: 192.1.1.250
      --- end of options ---

Note that Pi-hole has to be the sole DNS server for your network - clients will by-pass Pi-hole via alternative DNS servers.

What is the machine at 192.1.1.9?

EDIT:
In addition, (how) is that above dig registering in Pi-hole's Query Log?
The following command may help answering that:

sudo grep -n -m12 click.redditmail.com /var/log/pihole.log*

All of the local clients are configured (via DHCP) to use 192.1.1.9 as their DNS server. 192.1.1.9 is a Rocky Linux server running bind. It resolves all of the localnet names.

The bind server forwards to 192.1.1.10 (pihole). So the clients cannot bypass pihole because they don't know anything about 192.1.1.10.

I do see a small configuration error on my part in that I need to disable my DHCP server from providing 9.9.9.9 as an alternate DNS address so conceivably clients could bypass pihole by using 9.9.9.9. However, that has no bearing on the current problem as I can see pihole resolving names. Furthermore, if one of the local clients was to use 9.9.9.9 as a DNS server, the worst thing that would happen is that 9.9.9.9 (Quad9) would correctly resolve click.redditmail.com and I wouldn't get blocked.

In case you want to see it, here is named.conf from 192.1.1.9. You can see the forwarders section is configured to use 192.1.1.10 (the pihole).

-----------------------------
// Config file for caching only name server

logging
{
	channel default_debug
	{
		file "data/named.run";
		severity dynamic;
	};
	category lame-servers { null; };
};

options {
	directory "/var/named";

	dump-file "/var/named/data/cache_dump.db";

	// Uncommenting this might help if you have to go through a
	// firewall and things are not working out:

	//query-source port 53;

	// added by HS to fix "insecurity proof failed"
	// advised that's not a good idea
	//dnssec-enable no;
	//dnssec-validation no;

	//forward first;	
	forwarders {
		192.1.1.10; //pihole
		//9.9.9.9; //Quad9
		//149.112.112.112; //Quad9 
		// OpenDNS doesn't support DNSSEC?
		//208.67.222.222; // OpenDNS
		//208.67.220.220; // OpenDNS
		//8.8.8.8; // Google
		//8.8.4.4; // Google
		//64.255.237.240; // ns1.iinet.com	
		//64.255.237.241; // ns2.iinet.com	
	};
};

zone "." {
	type hint;
	file "root.hints";

};

#zone "0.0.127.in-addr.arpa" {
#	type master;
#	file "pz/127.0.0";
#};

zone "sci1.com" {
	notify no;
	type master;
	file "pz/sci1.com";
};

zone "1.1.192.in-addr.arpa" {
	notify no;
	type master;
	file "pz/192.1.1";
};

-------------------------------

This configuration is working fine with the sole exception that click.redditmail.com is blocked by pihole even though whitelisted. Localnet name resolution works fine. Internet name resolution works fine, and I can see pihole correctly resolving internet names in the pihole log.

I can see in the logs very clearly that all name resolution is working as expected except that pihole blocks click.redditmail.com (as you can see in the dig output posted above). Simply disabling pihole blocking for 30 seconds allows click.redditmail.com to resolve correctly for 30 seconds, so this is clearly pihole blocking that name resolution.

Run from a client in your network, please share the output of:

nslookup click.redditmail.com
nslookup click.redditmail.com 192.1.1.10

How do those requests register in Pi-hole's logs?
The following command may help answering that:

sudo grep -n -m12 click.redditmail.com /var/log/pihole.log*

Your edit asked how the dig registered in pihole's query log. I posted that above. Here it is again:

Apr 27 00:36:53: query[A] thirdparty.bnc.lt from 192.1.1.9
Apr 27 00:36:53: gravity blocked thirdparty.bnc.lt is 0.0.0.0

True - but that output is for thirdparty.bnc.lt, which doesn't seem fit for testing your case. :wink:

Your debug log shows that you've created exemptions just for click.redditmail.com:

*** [ DIAGNOSING ]: Domainlist (0/1 = exact white-/blacklist, 2/3 = regex white-/blacklist)
   id     type  enabled  group_ids     domain                                                                                                date_added           date_modified        comment                                           
   -----  ----  -------  ------------  ----------------------------------------------------------------------------------------------------  -------------------  -------------------  --------------------------------------------------
   2      0           1  0             click.redditmail.com                                                                                  2023-04-24 00:29:35  2023-04-24 00:29:35                                                    
   4        2         1  0             (\.|^)redditmail\.com$                                                                                2023-04-25 00:12:39  2023-04-25 00:12:39

Please share the results when using click.redditmail.com.

C:\WINDOWS\system32>nslookup click.redditmail.com
Server:  server2.sci1.com
Address:  192.1.1.9

Non-authoritative answer:
Name:    thirdparty.bnc.lt
Addresses:  ::
          0.0.0.0
Aliases:  click.redditmail.com
C:\WINDOWS\system32>nslookup click.redditmail.com 192.1.1.10
Server:  pi.hole
Address:  192.1.1.10

Non-authoritative answer:
Name:    thirdparty.bnc.lt
Addresses:  52.9.171.26
          13.57.168.50
          18.144.127.61
          52.9.114.249
Aliases:  click.redditmail.com

Your second output above shows that Pi-hole is correctly allowing click.redditmail.com when queried directly, as expected.

However, your bind at 192.1.1.9 is pre-processing the request:
It seems to forward a DNS request for the CNAME domain thirdparty.bnc.lt instead of the actual request.

You could address this by adjusting your bind configuration.
But I'd probably recommend to consider rearranging your network's DNS resolution chain:
Have your router distribute your Pi-hole as DNS resolver, and use your bind as Pi-hole's only upstream. You also want to untick Never forward non-FQDN A and AAAA queries as well as Never forward reverse lookups for private IP ranges via Settings|DNS in that configuration.

1 Like

Rearranging my bind config would probably work, but it was a much easier to fix to just try whitelisting thirdparty.bnc.lt in pihole.

That seems to work!

Thank you for the the observation that pushed me in the right direction.

That certainly is enough to address your current issue.

Still, in order to properly address the root cause, you may want to consider rearranging your DNS resolution chain, to also avoid similar future unexpected behaviour for other domains.

Yes, I agree. For the present, there are other reasons I prefer to keep the current DNS chain.

Thank you again for your help.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.