How to blacklist a domain like: *-abc.domain.com (starting with a dash)


#1

Hi,

I would like to add a wildcard domain to the blacklist, but it does not want to add the following (using example):
-abc.domain.com

Problem is that in the web-gui the blacklist does not seem to allow wildcards starting with a dash “-”.

Any suggestions?


#2

I was able to do this via the command line:

pihole -b -abc.domain.com -wild

we might need to look at the code to see why it doesn’t work via the dashboard…maybe @DL6ER or @Mcat12 has some insight.


#3

Tried it and works!
Thanks!!


#4

I don’t think that this will achieve what you want, right?

This solution will block:

  • -abc.domain.com (which is however an invalid domain name and hence rejected by the web frontend)
  • something.-abc.domain.com
  • what.ever.-abc.domain.com

but it won’t block:

  • whatever-abc.domain.com
  • something.else-abc.domain.com

#5

Impressive. You fully got the idea, and you are correct in what I need.

So now I am able to add “-abc.domain.com” to the blacklist, but it does not solve my problem :frowning:

Just to confirm:
I need it to block “whatever dynamic name” is added in front of “-abc.domain.com”, like “whatever-abc.domain.com” or “abc-abc.domain.com” or whatever text is put directly (!) in from of “-abc.domain.com” …

Any further suggestions?


#6

Unfortunately, this is technically impossible due to the way how DNS works. This feature request came up very often in the discussion of blocking YouTube ads and a lot of research has been put into this. It would be possible with a major re-write of the DNS server software, but we don’t have the manpower to support such an endeavor.


#7

Unfortunate, but I can understand…
It does not keep me from using Pi-hole though! :slight_smile:

Thanks.


#8

I think we really need such a feature, for example, if I could implement a pattern something like below to block all videos in facebook page.

This is my wish(wildcard filter) to track all video requests from facebook page
vidio.*fna.fbcdn.net

Below is my pi-hole log :

Apr 24 10:23:05 dnsmasq[12584]: 10686 192.168.1.106/53398 reply video.fdoh1-1.fna.fbcdn.net is 82.148.105.146
Apr 24 10:23:05 dnsmasq[12584]: 10687 192.168.1.106/59021 reply video.fdoh4-1.fna.fbcdn.net is 89.211.13.18

Hi @DL6ER if few of us ready to do the alteration voluntarily ? then any possibility ?


#9

Is this what you’re looking for?


#10

Well, some time has passed (almost an entire year) and in the meantime such a re-write actually happened (with the transition to FTLDNS)! I did some research on this over the last days and can now announce that I found the time to eventually implement GNU Extended Regular Expressions (as used by popular codes such as egrep (or grep -E ...), awk, and emacs). @Matt already posted the link.


@Bart A suitable regex for you should be

BLOCKINGREGEX=-abc.domain.com$

@arun A suitable regex for you should be

BLOCKINGREGEX=^video.*\.fna.fbcdn.net$

#11

@DL6ER Sounds good!

Sorry to ask, but where would i configure this
“BLOCKINGREGEX=-abc.domain.com$” ?
In a config file? (Using raspbian)

Btw: Assuming this now works, I think a lot of value is added to Pi-Hole. Good work!


#12

It has to be put into /etc/pihole/pihole-FTL.conf (create the file if it doesn’t exist). Don’t forget to restart pihole-FTL afterwards!

sudo service pihole-FTL restart

#13

Works like a charm!
Possibilities for this are endless now!
(Just sent a small donation :blush: )

Thanks!