@ -1265,6 +1265,25 @@ check_service_active() {
fi
}
# Systemd-resolved's DNSStubListener and dnsmasq can't share port 53.
# Resolved needs to remain in place for installer to download needed files
# so this change needs to be made after installation is complete, but before resarting dnsmasq/ftl
disable_resolved_stublistener( ) {
# Check if Systemd-resolved's DNSSTub listener is enabled and active on port 53
if check_service_active "systemd-resolved" ; then
# Check if DNSStubListener is enabled
if ( grep '#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 -e "Disabling systemd-resolved DNSStubListener"
# Make a backup of the original /etc/systemd/resolved.conf
# (This will need to be restored on uninstallation)
sed -i.orig 's/#DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf
systemctl restart systemd-resolved
fi
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)
@ -2304,24 +2323,8 @@ main() {
fi
fi
# resolved and dnsmasq can't share port 53.
# resolved needs to remain in place for installer to download needed files
# so this change needs to be made after installation is complete, but before resarting dnsmasq/ftl
# Check if running ubuntu 18.04 bionic beaver, which ships with resolved active on port 53
# (This check may need to be broadened for other systems running resolved?)
if ( lsb_release -a | grep 'Ubuntu 18.04' & > /dev/null ) ; then
# Running ubuntu 18.04, so check if resolved is running,
if ( systemctl is-enabled systemd-resolved | grep -c 'enabled' || true ) ; then
# if resolveconf is running unbind it from port 53
# Note that this breaks dns functionality on host until dnsmasq/ftl are up and running
echo -e "Disabling systemd-resolved DNSStubListener"
# Make a backup of the original /etc/systemd/resolveconf.d
# (This will need to be restored on uninstallation)
sed -i.orig 's/#DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf
systemctl restart systemd-resolved
fi
fi
# Check for and if necessary disable systemd-resolved-DNSStubListener
disable_resolved_stublistener
# Enable FTL
start_service pihole-FTL