I work in a secondary school with 3 IT labs. Every lab has their own PiHole and I would like to import regex filters from a txt file on a shared drive on a regular basis. Updating the file regex.list works well using crontab and grep but still the students can reach all and every one of the restricted domains. The filters appear on a gui alright, but they have no effect at all.
After importing the content of blocklist.txt regex.list contains about 100 expressions, like: ((^)|(\.))youtube\. The expressions appear on the web interface as well, but they don't work unless I add them manually. For example ((^)|(\.))youtube\. is in regex.list already but it doesn't have any effect until I add it through the web interface. If I do that pihole adds it as the last entry of the list and it starts to work immediately.
I logged in as root, so that is why there is no sudo before the commands.
Try the first, and check /var/log/pihole-FTL.log for lines indicating how many regex lines were read and reloaded. Also read through regex debugging to get some more information logged for regex ingestion.
[2019-02-25 19:38:32.977 9220] Received API request to recompile regex
[2019-02-25 19:38:32.993 9220] Compiled 91 Regex filters and 0 whitelisted domains in 11.9 msec (0 errors)
It seems to be alright (I have 91 lines in regex.list), but still the computers can reach the websites.
Enable debug mode and this will log if regex lines are being hit or not. If there are no logged entries for the domains in either the log file or in the web query log then you might not have your clients using the Pi-hole devices as their sole DNS server.
And probably not applicable, but are you using Windows or anything to edit the files? If there are extra line endings or whitespace characters in that file line endings then the regex wouldn't match on those non-linux line endings.
I am checking, but I am absolutely sure that the PCs use this PiHole as their sole DNS server because the system works if I add the filters manually. It also worked last week when I used this txt as a regular blocklist. The reason why I want to move to regex is to block all subdomains and variations with one line only.
I am attaching the original file (blocklist.txt (2.3 KB)). The txt is usually edited under Windows by the teachers. Grap copy its content into regex.list without "#".