Shouldn't:
...
Worse than that - it should have been hard coded as 'multi.surbl.org'.
However, I think I have a new version of the script that works for multi.surbl.org without breaking it out. I found that using "dig +trace ..." instead of "host -t ns ..." worked with my pihole configured to use OpenDNS for upstream.
I've posted the latest version to github here:
https://github.com/mmccarn/pihole/blob/master/bin/pihole-dnsbl.shand here is the code:
#!/bin/bash
# list of lists for conditional forwarding. Surround with quotes, separate with spaces
lists="zen.spamhaus.org"
lists="$lists bl.spamcop.net"
# truncate.gbudb.net does not have its own NS so we use gbudb.net
lists="$lists gbudb.net"
lists="$lists ix.dnsbl.manitu.net"
lists="$lists b.barracudacentral.org"
lists="$lists dbl.spamhaus.org"
lists="$lists rhsbl.sorbs.net"
lists="$lists multi.surbl.org"
lists="$lists black.uribl.com"
lists="$lists multi.uribl.com"
# path to custom config file to be updated
customcfg=/etc/dnsmasq.d/15-pihole.conf
# create customcfg file if it does not exist to avoid errors with 'sed -i'
if [ ! -f $customcfg ]
then
touch $customcfg
fi
for list in $lists
do
echo Processing $list
# delete the old entries for this list
sed -i "/$list/d" $customcfg
# insert a divider in the config file
printf "# $list\n" >> $customcfg
# get the name servers for this list, then get their IPs
# host -t ns $list |grep "name server " |sed 's/.*name server //' | \
dig +trace $list |grep $list.*NS |sed 's/.*NS\s*//' | \
while read ns
do
printf " $list\t$ns\n"
host -i $ns |\
grep 'has address' |\
sed "s/.*has\ address\ /server=\/$list\//" >> $customcfg
done
done
# restart the dns service to activate the changes
pihole restartdns
Changes:
* I tried to make "lists" easier to read
* I switched from "host -t ns ..." to "dig +trace ..."
==> this change makes the separate script for multi.surbl.org unnecessary
* I am inserting a commented separator into the dnscache custom config file
* I have changed the custom config filename from 05-pihole.conf to 15-pihole.conf to avoid conflicting with other instructions I've seen online using 05-pihole.conf
* The program now lists each name server on the screen as it is processed
If you switch to this script you should remove the original custom conf at
/etc/dnsmasq.d/05-pihole.conf