Saturday, August 19, 2017

Blocking Ads with Squid and Unbound DNS Server

Read Up On The Following First To Understand What's Going On Blocking Ads With Squid Blocking Ads With Unbound DNS Server I added this section to my squid configuration
## disable ads ( )
acl ads dstdom_regex  "/yoursquiddirectoryhere/ad_block.txt"
http_access deny ads
#deny_info TCP_RESET ads
I ran the script provided on the With modifications for my squid proxy server and it restart squid. Ads blocked. While the proxy is good defense. Some of the ad networks are using https and dns to get around proxies and firewalls. So another way to block is using your dns server. I made a few modifications to my Unbound Config to add an include statement to now read the file from the python script
include: "/etc/unbound/local-blocking-data.conf"
I ran the python script and it restarts Unbound To periodically update new domains that get added to the lists on the Adserver Lists, I added the scripts to the crontab to run nightly Crontab Entries
#ad block section
%nightly,random * 23-6 /root/ >> /dev/null 2>&1
%nightly,random * 23-6 /usr/bin/python /root/

No comments: