Tuesday, August 12, 2008

Network-wide Adblock on Ubuntu + OpenDNS adblocking

Based on the article found here: http://notes.ozmonet.com/index.php?title=Network-Wide_Adblock

This method will work for both Internet Explorer and Google Chrome.
You must have lighttpd or apache installed to serve up replacement images or pages.

Install squid: sudo apt-get install squid

Configure: /etc/squid/squid.conf

http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
access_log /var/log/squid/access.log squid
log_ip_on_direct off
url_rewrite_children 5
url_rewrite_concurrency 0
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl all src 0.0.0.0/0.0.0.0
acl our_networks src 192.168.219.0/24
cache deny all
http_access allow our_networks
http_reply_access allow all
icp_access allow all
visible_hostname SERVERNAME
coredump_dir /var/spool/squid
Install squidguard: sudo apt-get install squidguard

Download and configure adblock for use with squidguard

wget http://easylist.adblockplus.org/adblock_rick752.txt
create a sefile with this inside it:

/@@.*/d;
/^!.*/d;
/^\[.*\]$/d;
s#http://##g;
s,[.?=&/|],\\&,g;
s#*#.*#g;
s,\$.*$,, g;

Create the expression list: cat adblock_rick752.txt | sed -f sedfile > expressions

In your squidguard folder /var/lib/squidguard/db, create a folder for adblock and copy the expressions file inside it.

sudo chmod proxy.proxy -R adblock

Edit your /etc/squid/squid.conf, add this at the end
redirect_program /usr/bin/squidGuard -d -c /etc/squid/squidGuard.conf

Edit your /etc/squid/squidGuard.conf file
dbhome /var/lib/squidguard/db
logdir /var/log/squid

src my_network {
ip 192.168.219.0/24
}

dest adblock {
expressionlist adblock/expressions
redirect http://localhost/lol.jpg
}
acl {
my_network {
pass !adblock any
}
default {
pass none
redirect http://localhost/lol.jpg
}
}
Restart Squid and then configure your browsers to use the ip address of the server running squid, mine was http://192.168.219.111:3128, fire up your browser and surf ad riddled sites to test it.

Sign-up for OpenDNS, not only do they provide you with speedy DNS queries they also feature ad blocking. The good thing about OpenDNS is that you only have to configure your router and it enables all the features on every computer on your network.

Their DNS servers are down below:
208.67.222.222
208.67.220.220

If you need help configuring your computer or router please check their site.
https://www.opendns.com/homenetwork/start/

Once you are done setting up your router login to their dashboard and go to settings \ Content Filtering. I enabled filtering for adware, parked domains and phishing.

Well that about covers it, enjoy add free surfing!

6 comments:

Unknown said...

Thanks for posting a link to my research. :) It's not often you see netiquette anymore.

Unknown said...

This didnt work for me.
All layouts and many pictures i cant see with squidguard enabled.
can u help me?

Anonymous said...

Have the same problem. Css and pictures are whashed out.

Anonymous said...

It is probably the new developments in fitness market wherever [url=http://lfcream.com]lifecell[/url] to fracture chilly tip, an original pores and skin healthy moisturising result, appreciated with the customer's enjoy and salable. buy lifecell cream Shell out Added Attention to http://lfcream.com scores

Anonymous said...

sooner this calendar week, we well-educated that Kentucky Bowler chomp and everyone's though Pennsylvania track slots are much closer to his habitation. [url=http://www.tasty-onlinecasino.co.uk/]online casino uk[/url] online casino uk Two cents does not severe questions more or less the man leading the current probe. http://www.tasty-onlinecasino.co.uk/

Unknown said...

zhengjx20160603
true religion jeans
ralph lauren polo
oakley outlet
coach outlet
oakley sunglasses
ed hardy outlet
coach outlet
christian louboutin shoes
supra for sale
air jordan homme
coach factory outlet
louis vuitton outlet online
coach outlet clearance
christian louboutin sale
retro 11
ray ban wayfarer
michael kors outlet
michael kors outlet
burberry handbags
ghd hair straighteners
giuseppe zanotti outlet
hollister clothing store
hollister clothing
gucci belts
nike outlet store
oakley sunglasses wholesale
louis vuitton outlet online
michael kors outlet clearance
louis vuitton handbags
michael kors handbags
true religion sale
mont blanc pen
hollister clearance
michael kors outlet online sale
nike store outlet
louboutin femme
nike air force 1 white
michael kors bags
adidas originals
louboutin shoes