mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-03 20:03:25 +01:00
pihole/unbound: create unbound config before apt install to prevent port conflicts (#10839)
* fix(pihole): create unbound config before apt install to prevent port conflict * fix(unbound): create config before apt install to prevent port conflict
This commit is contained in:
committed by
GitHub
parent
e309d871d7
commit
109d6ab6e9
@@ -69,7 +69,7 @@ read -r -p "${TAB3}Would you like to add Unbound? <y/N> " prompt
|
|||||||
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||||
read -r -p "${TAB3}Unbound is configured as a recursive DNS server by default, would you like it to be configured as a forwarding DNS server (using DNS-over-TLS (DoT)) instead? <y/N> " prompt
|
read -r -p "${TAB3}Unbound is configured as a recursive DNS server by default, would you like it to be configured as a forwarding DNS server (using DNS-over-TLS (DoT)) instead? <y/N> " prompt
|
||||||
msg_info "Installing Unbound"
|
msg_info "Installing Unbound"
|
||||||
$STD apt install -y unbound
|
mkdir -p /etc/unbound/unbound.conf.d
|
||||||
cat <<EOF >/etc/unbound/unbound.conf.d/pi-hole.conf
|
cat <<EOF >/etc/unbound/unbound.conf.d/pi-hole.conf
|
||||||
server:
|
server:
|
||||||
verbosity: 0
|
verbosity: 0
|
||||||
@@ -142,6 +142,7 @@ forward-zone:
|
|||||||
#forward-addr: 2620:fe::9@853#dns.quad9.net
|
#forward-addr: 2620:fe::9@853#dns.quad9.net
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
$STD apt install -y unbound
|
||||||
cat <<EOF >/etc/dnsmasq.d/01-pihole.conf
|
cat <<EOF >/etc/dnsmasq.d/01-pihole.conf
|
||||||
server=127.0.0.1#5335
|
server=127.0.0.1#5335
|
||||||
server=8.8.8.8
|
server=8.8.8.8
|
||||||
@@ -149,7 +150,7 @@ server=8.8.4.4
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
sed -i -E '/^\s*upstreams\s*=\s*\[/,/^\s*\]/c\ upstreams = [\n "127.0.0.1#5335",\n "8.8.4.4"\n ]' /etc/pihole/pihole.toml
|
sed -i -E '/^\s*upstreams\s*=\s*\[/,/^\s*\]/c\ upstreams = [\n "127.0.0.1#5335",\n "8.8.4.4"\n ]' /etc/pihole/pihole.toml
|
||||||
systemctl enable -q --now unbound
|
systemctl restart unbound
|
||||||
systemctl restart pihole-FTL.service
|
systemctl restart pihole-FTL.service
|
||||||
msg_ok "Installed Unbound"
|
msg_ok "Installed Unbound"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -14,11 +14,7 @@ network_check
|
|||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Unbound"
|
msg_info "Installing Unbound"
|
||||||
$STD apt install -y \
|
mkdir -p /etc/unbound/unbound.conf.d
|
||||||
unbound \
|
|
||||||
unbound-host
|
|
||||||
msg_info "Installed Unbound"
|
|
||||||
|
|
||||||
cat <<EOF >/etc/unbound/unbound.conf.d/unbound.conf
|
cat <<EOF >/etc/unbound/unbound.conf.d/unbound.conf
|
||||||
server:
|
server:
|
||||||
interface: 0.0.0.0
|
interface: 0.0.0.0
|
||||||
@@ -52,13 +48,17 @@ server:
|
|||||||
logfile: /var/log/unbound.log
|
logfile: /var/log/unbound.log
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
$STD apt install -y \
|
||||||
|
unbound \
|
||||||
|
unbound-host
|
||||||
|
|
||||||
touch /var/log/unbound.log
|
touch /var/log/unbound.log
|
||||||
chown unbound:unbound /var/log/unbound.log
|
chown unbound:unbound /var/log/unbound.log
|
||||||
sleep 5
|
sleep 5
|
||||||
systemctl restart unbound
|
systemctl restart unbound
|
||||||
msg_ok "Installed Unbound"
|
msg_ok "Installed Unbound"
|
||||||
|
|
||||||
msg_ok "Configuring Logrotate"
|
msg_info "Configuring Logrotate"
|
||||||
cat <<EOF >/etc/logrotate.d/unbound
|
cat <<EOF >/etc/logrotate.d/unbound
|
||||||
/var/log/unbound.log {
|
/var/log/unbound.log {
|
||||||
daily
|
daily
|
||||||
@@ -74,7 +74,6 @@ cat <<EOF >/etc/logrotate.d/unbound
|
|||||||
endscript
|
endscript
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
systemctl restart logrotate
|
systemctl restart logrotate
|
||||||
msg_ok "Configured Logrotate"
|
msg_ok "Configured Logrotate"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user