mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-24 13:50:17 +00:00
Merge pull request #2180 from rrobgill/resolved/ubuntu-bionic
Disable SystemD's DNS Stub Resolver On Install
This commit is contained in:
commit
8523c0da32
2 changed files with 38 additions and 2 deletions
|
@ -1265,6 +1265,30 @@ check_service_active() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Systemd-resolved's DNSStubListener and dnsmasq can't share port 53.
|
||||
disable_resolved_stublistener() {
|
||||
echo -en " ${INFO} Testing if systemd-resolved is enabled"
|
||||
# Check if Systemd-resolved's DNSStubListener is enabled and active on port 53
|
||||
if check_service_active "systemd-resolved"; then
|
||||
# Check if DNSStubListener is enabled
|
||||
echo -en " ${OVER} ${INFO} Testing if systemd-resolved DNSStub-Listener is active"
|
||||
if ( grep -E '#?DNSStubListener=yes' /etc/systemd/resolved.conf &> /dev/null ); then
|
||||
# Disable the DNSStubListener to unbind it from port 53
|
||||
# Note that this breaks dns functionality on host until dnsmasq/ftl are up and running
|
||||
echo -en "${OVER} ${TICK} Disabling systemd-resolved DNSStubListener"
|
||||
# Make a backup of the original /etc/systemd/resolved.conf
|
||||
# (This will need to be restored on uninstallation)
|
||||
sed -r -i.orig 's/#?DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf
|
||||
echo -e " and restarting systemd-resolved"
|
||||
systemctl reload-or-restart systemd-resolved
|
||||
else
|
||||
echo -e "${OVER} ${INFO} Systemd-resolved does not need to be restarted"
|
||||
fi
|
||||
else
|
||||
echo -e "${OVER} ${INFO} Systemd-resolved is not enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
update_package_cache() {
|
||||
# Running apt-get update/upgrade with minimal output can cause some issues with
|
||||
# requiring user input (e.g password for phpmyadmin see #218)
|
||||
|
@ -2290,8 +2314,11 @@ main() {
|
|||
fi
|
||||
fi
|
||||
|
||||
echo -e " ${INFO} Restarting services..."
|
||||
# Start services
|
||||
# Check for and disable systemd-resolved-DNSStubListener before reloading resolved
|
||||
# DNSStubListener needs to remain in place for installer to download needed files,
|
||||
# so this change needs to be made after installation is complete,
|
||||
# but before starting or resarting the dnsmasq or ftl services
|
||||
disable_resolved_stublistener
|
||||
|
||||
# If the Web server was installed,
|
||||
if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
|
||||
|
@ -2304,6 +2331,9 @@ main() {
|
|||
fi
|
||||
fi
|
||||
|
||||
echo -e " ${INFO} Restarting services..."
|
||||
# Start services
|
||||
|
||||
# Enable FTL
|
||||
start_service pihole-FTL
|
||||
enable_service pihole-FTL
|
||||
|
|
|
@ -153,6 +153,12 @@ removeNoPurge() {
|
|||
${SUDO} rm -f /etc/sudoers.d/pihole &> /dev/null
|
||||
echo -e " ${TICK} Removed config files"
|
||||
|
||||
# Restore resolved
|
||||
if [[ -e /etc/systemd/resolved.conf.orig ]]; then
|
||||
${SUDO} cp /etc/systemd/resolved.conf.orig /etc/systemd/resolved.conf
|
||||
systemctl reload-or-restart systemd-resolved
|
||||
fi
|
||||
|
||||
# Remove FTL
|
||||
if command -v pihole-FTL &> /dev/null; then
|
||||
echo -ne " ${INFO} Removing pihole-FTL..."
|
||||
|
|
Loading…
Reference in a new issue