From 87c9e2381ee3ab7f01444d40d3c9d30b3a8c4719 Mon Sep 17 00:00:00 2001 From: KiekerJan Date: Sun, 17 Apr 2022 23:08:12 +0200 Subject: [PATCH] check unbound is up before changing local dns server --- setup/system.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/setup/system.sh b/setup/system.sh index be605475..f50a353f 100755 --- a/setup/system.sh +++ b/setup/system.sh @@ -327,6 +327,17 @@ if [ -d /etc/unbound/lists.d ]; then mkdir /etc/unbound/lists.d fi +systemctl restart unbound + +unbound-control -q status + +# Only reset the local dns settings if unbound server is running, otherwise we'll +# up with a system with an unusable internet connection +if [ $? -ne 0 ]; then + echo "Recursive DNS server not active" + exit 1 +fi + # Modify systemd settings rm -f /etc/resolv.conf tools/editconf.py /etc/systemd/resolved.conf \ @@ -338,7 +349,6 @@ echo "nameserver 127.0.0.1" > /etc/resolv.conf # Restart the DNS services. systemctl restart systemd-resolved -systemctl restart unbound # ### Fail2Ban Service