pihole config
This commit is contained in:
parent
01cb6306a2
commit
bfa32451ba
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue