Hacker News new | ask | show | jobs
by ulzeraj 2966 days ago
I run a similar setup that downloads the blacklist from some guy named Steven Black who wants to make the internet better and then I pipe it through sed to include them on my unbound resolver. The file is configured as an include on unbound.conf.

#!/bin/sh

PATH="/bin:/usr/bin:/sbin:/usr/sbin"

rm -f /tmp/badsites

wget https://raw.githubusercontent.com/StevenBlack/hosts/master/h... -O /tmp/badsites

if [ -f /tmp/badsites ]; then

    grep '^0\.0\.0\.0' /tmp/badsites | awk '{print "local-zone: \""$2"\" redirect\nlocal-data: \""$2" A 0.0.0.0\""}' > /etc/unbound/badsites.conf
  
    rm /tmp/badsites
  
fi

rc-service unbound reload