Ever since I set up a Squid proxy server on my LAN, I’ve noticed a resurgence in adverts on my Android (for which Chrome doesn’t support plugins).
I was looking for a way to do this with Squid, and produced this script which you can run daily as a cronjob.
- Create a directory for your scripts and create the new file:
mkdir -p /opt/scripts cd /opt/scripts nano squid_adblock.sh
- Paste the following into it:
- Make it executable and test run it:
chmod +x squid_adblock.sh ./squid_adblock.sh
- Check the contents of the blocklist_savefile and if it looks OK, add it to the crontab:
- This, which should be inserted alongside your ACLs:
acl adblock dstdom_regex "/etc/squid/adblock.list"
- This, which should be inserted BEFORE any acl which specifies clients allowed to connect:
http_access deny adblock