On Wed, Jul 15, 2015 at 5:09 PM, Erling Westenvik <
erling.westen...@gmail.com> wrote:

> On Wed, Jul 15, 2015 at 08:25:03PM +0200, Stefan Wollny wrote:
> > Hi misc@!
> >
> > [Running i386/current: OpenBSD 5.8-beta (GENERIC.MP) #1026]
> >
> > I have been using adsuck for some time now - at least I thought so.
> > Today I dared to read /usr/local/share/doc/pkg-readmes/adsuck-2.5.0p
> > only to find out that apparently I need to add the following line to my
> > /etc/dhclient.conf:
> >     script "/usr/local/sbin/dhclient-adsuck";
> > because "this script will prevent from using /etc/resolv.conf to resolve
> > non-blacklisted entries but use /var/adsuck/files/resolv.conf instead."
>
> I've given up on adsuck. In addition to being unusable in a DHCP
> environment, it proved useless anyway, making both firefox and chrome
> sessions crash all the time for no apparent reason.
>
> Instead I'm using unbound(1) to block ads on both my gateway and on my
> roadwarriors. Check out unbound.conf(5) and its include: directive.
> Point it to a file with a two line format for each host/domain to
> block, similar to this:
>
> local-zone: "adclick.com" redirect
> local-data: "adclick.com A 127.0.0.1"
>
>
I use adsuck without issues on my gateway; it hangs off a stable DHCP
uplink so I don't have to monkey with /var/adsuck/resolv.conf after initial
setup.  The following lets me blackhole DNS for internal devices without
exposing the service to external hosts.  Also, I figured out how to
regularly update the hosts file.


[/etc/rc.conf.local]
pkg_scripts="adsuck"
adsuck_flags="-c /var/adsuck -f /files/resolv.conf /files/hosts.small"

[/etc/pf.conf]
# redirect all DNS from internal networks to adsuck
# note: adsuck does not handle TCP DNS
# note: gateway lookups are unfiltered
match in on $internal_ifs proto udp to port domain rdr-to 127.0.0.1

[/etc/weekly.local]
# periodically update blackhole list, needs reformatting
if TMP=`mktemp`; then
        HFILE=/var/adsuck/files/hosts.small
        trap 'rm -f $TMP; exit 1' 0 1 15
        mv $HFILE $HFILE.out
        ftp -Vo $TMP http://winhelp2002.mvps.org/hosts.txt
        sed -e 's/^M$//' -e '/::1/d' -e 's/^0.0.0.0/127.0.0.1/' $TMP >
$HFILE
        /etc/rc.d/adsuck reload > /dev/null
else
        echo "Cannot install adsuck hosts file"
fi

--david

Reply via email to