It was only when my browser started stalling while attempting to load advertisements that I reconsidered it. In searching for various redirectors, I rediscovered AdZapper, which is extremely simple to install. Following is an update to PlayingWithSid's howto for configuring Squid and AdZapper to filter ads from your web surfing.
It should be noted that the below isn't limited to Linux systems. Windows can run Squid and AdZapper via the Cygwin software.
The main purpose of Squid is to proxy and cache web traffic. It is extremely flexible in what it can be configured to do. For the purposes of this article, we will configure it as a non-caching proxy. Note: Installation of the Squid cache/proxy is outside of the scope of this article (there's already enough of those).
AdZapper is a substitute redirector for Squid that provides filtering capabilities. Install AdZapper by grabbing the source code from SourceForge and following the instructions in the tarball, or by installing the appropriate package for your Linux distribution.
PlayingWithSid indicates that you have to configure AdZapper. Apparently this is no longer the case. You only have to add a line to Squid's configuration file to enable AdZapper. For our purposes, we'll also be telling Squid that we don't want it to cache anything.
Following is my /etc/squid/squid.conf file. The majority of it is the default settings (I ran "grep -v ^# squid.conf" to filter out the comments). Only the first and last lines need to be added to enable AdZapper.
redirect_program /usr/bin/adzapper.wrapper acl all src all acl manager proto cache_object acl localhost src 127.0.0.1/32 acl to_localhost dst 127.0.0.0/8 acl localnet src 10.0.0.0/8 # RFC1918 possible internal network acl localnet src 172.16.0.0/12 # RFC1918 possible internal network acl localnet src 192.168.0.0/16 # RFC1918 possible internal network acl SSL_ports port 443 # https acl SSL_ports port 563 # snews acl SSL_ports port 873 # rsync acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 # https acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl Safe_ports port 631 # cups acl Safe_ports port 873 # rsync acl Safe_ports port 901 # SWAT acl purge method PURGE acl CONNECT method CONNECT http_access allow manager localhost http_access deny manager http_access allow purge localhost http_access deny purge http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow localhost http_access deny all icp_access allow localnet icp_access deny all http_port 3128 hierarchy_stoplist cgi-bin ? access_log /var/log/squid/access.log squid refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 refresh_pattern . 0 20% 4320 acl apache rep_header Server ^Apache broken_vary_encoding allow apache extension_methods REPORT MERGE MKACTIVITY CHECKOUT hosts_file /etc/hosts coredump_dir /var/spool/squid cache deny all
The first line tells Squid to use AdZapper (via the AdZapper wrapper) as the redirect program. The last line tells Squid to not cache anything. Other than restarting Squid and pointing your browser at port 3128, that's all you have to do (there were additional steps at PlayingWithSid but they appear to be deprecated at this point).
For those that care to, the above config file can be pared down to a much shorter configuration (there's a lot of extra default "stuff" there).
If Squid complains about ACL "all" being undefined, it means that you added "cache deny all" to squid.conf before "acl all src all". For Squid, you must define your ACLs before you employ them. Move "cache deny all" towards the end of the file.
Please note that there is no security in the above configuration. The assumption is that the installation is for a home system which resides behind a firewall.