pihole config

This commit is contained in:
Bob Mottram 2016-10-31 23:00:22 +00:00
parent 01cb6306a2
commit bfa32451ba
1 changed files with 21 additions and 17 deletions

View File

@ -41,7 +41,7 @@ PIHOLE_DNS2='213.73.91.35'
piholeBasename=pihole
piholeDir=/etc/$piholeBasename
PIHOLE_ADLIST=$piholeDir/gravity.list
PIHOLE_ADLIST=$piholeDir/adlists.list
PIHOLE_BLACKLIST=$piholeDir/blacklist.txt
PIHOLE_WHITELIST=$piholeDir/whitelist.txt
@ -55,9 +55,13 @@ pihole_variables=(ONION_ONLY
function pihole_copy_files {
cp $INSTALL_DIR/pihole/adlists.default $piholeDir/adlists.default
cp $INSTALL_DIR/pihole/adlists.default $PIHOLE_ADLIST
cp $piholeDir/adlists.default $piholeDir/adlists.list
#cp $INSTALL_DIR/pihole/adlists.default $PIHOLE_ADLIST
cp $INSTALL_DIR/pihole/advanced/Scripts/* /opt/$piholeBasename
cp $INSTALL_DIR/pihole/advanced/01-pihole.conf /etc/dnsmasq.d/01-pihole.conf
if [ -f /etc/dnsmasq.d/01-pihole.conf ]; then
rm /etc/dnsmasq.d/01-pihole.conf
fi
#cp $INSTALL_DIR/pihole/advanced/01-pihole.conf /etc/dnsmasq.d/01-pihole.conf
cp $INSTALL_DIR/pihole/advanced/pihole.cron /etc/cron.d/pihole
cp $INSTALL_DIR/pihole/gravity.sh /opt/$piholeBasename
}
@ -94,7 +98,8 @@ function pihole_update {
echo "piholeDNS1=${PIHOLE_DNS1}" >> ${setupVars}
echo "piholeDNS2=${PIHOLE_DNS1}" >> ${setupVars}
echo 'domain-needed' > /etc/dnsmasq.conf
echo "addn-hosts=${PIHOLE_ADLIST}" > /etc/dnsmasq.conf
echo 'domain-needed' >> /etc/dnsmasq.conf
echo 'bogus-priv' >> /etc/dnsmasq.conf
echo 'no-resolv' >> /etc/dnsmasq.conf
echo "server=${PIHOLE_DNS1}" >> /etc/dnsmasq.conf
@ -103,21 +108,20 @@ function pihole_update {
echo 'listen-address=127.0.0.1' >> /etc/dnsmasq.conf
echo 'log-queries' >> /etc/dnsmasq.conf
sed -i "s|@DNS1@|${PIHOLE_DNS1}|g" /etc/dnsmasq.d/01-pihole.conf
sed -i "s|@DNS2@|${PIHOLE_DNS2}|g" /etc/dnsmasq.d/01-pihole.conf
sed -i "s|interface=.*|interface=${PIHOLE_IFACE}|g" /etc/dnsmasq.d/01-pihole.conf
sed -i "s|@IPv4@|${IPv4_address}|g" /etc/dnsmasq.d/01-pihole.conf
if [ ${#IPv6_address} -gt 0 ]; then
sed -i "s|@IPv6@|${IPv6_address}|g" /etc/dnsmasq.d/01-pihole.conf
else
sed -i '/@IPv6@/d' /etc/dnsmasq.d/01-pihole.conf
fi
sed -i "s|@HOSTNAME@|$HOSTNAME|g" /etc/dnsmasq.d/01-pihole.conf
sed -i "s|addn-hosts=.*|addn-hosts=${PIHOLE_ADLIST}|g" /etc/dnsmasq.d/01-pihole.conf
systemctl restart dnsmasq
#sed -i "s|@DNS1@|${PIHOLE_DNS1}|g" /etc/dnsmasq.d/01-pihole.conf
#sed -i "s|@DNS2@|${PIHOLE_DNS2}|g" /etc/dnsmasq.d/01-pihole.conf
#sed -i "s|interface=.*|interface=${PIHOLE_IFACE}|g" /etc/dnsmasq.d/01-pihole.conf
#sed -i "s|@IPv4@|${IPv4_address}|g" /etc/dnsmasq.d/01-pihole.conf
#if [ ${#IPv6_address} -gt 0 ]; then
# sed -i "s|@IPv6@|${IPv6_address}|g" /etc/dnsmasq.d/01-pihole.conf
#else
# sed -i '/@IPv6@/d' /etc/dnsmasq.d/01-pihole.conf
#fi
#sed -i "s|@HOSTNAME@|$HOSTNAME|g" /etc/dnsmasq.d/01-pihole.conf
#sed -i "s|addn-hosts=.*|addn-hosts=${PIHOLE_ADLIST}|g" /etc/dnsmasq.d/01-pihole.conf
pihole -g
systemctl restart dnsmasq
}
function pihole_change_upstream_dns {