Protecting your privacy with adsuck

Floor Terra - 2011-05-05 22:43:00
Online privacy is a hot issue. In this short tutorial I will show how to use adsuck to block loads of online tracking sites.

First install adsuck
$ sudo pkg_add adsuck

Now it's time to configure adsuck. Adsuck needs to know about a dns server. I have put down two (one as backup):
$ cat /var/adsuck/files/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4


Of course you want to find some evil sites to block. The default file contains over 16000 domains, but you can add your own. Open /var/adsuck/files/hosts.small with your favorite text editor and add a few lines like this:
# Personal
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 nl-nl.facebook.com
127.0.0.1 fb.me


Now make sure adsuck start on boot. Edit /etc/rc.cof.local and add adsuck to rc_scripts. So it looks like this:
$ cat /etc/rc.conf.local
ntpd_flags= # enabled during install
multicast_host=YES
rc_scripts="gdm adsuck"

And start adsuck right now: sudo /etc/rc.d/adsuck start.

Finally configure your system to use adsuck as your dns resolver.
Change /etc/resolv.conf and set nameserver 127.0.0.1. If you want your setting to remain intact, even after using dhclient you alsoo need to edit /etc/dhclient.conf and add the line
prepend domain-name-servers 127.0.0.1;


And now try it out. Grab your favorite webbrowser and go to www.facebook.com. If all is right Facebook should be gone from your internet. Much more pleasant browsing if you ask me.