Mainly add external monitoring of mail server
[distro-setup] / trusted-network
index ea1d9f496d8dc30eeeb7d41f76bfcce252291032..220c963c41cbcfde7d7b44d57900b6256c2e969c 100755 (executable)
@@ -3,11 +3,14 @@
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
-[[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@"
+[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
 
 # Usage: run when switching from an untrusted network like public wifi
 # to a trusted one.
 
-rm -f /etc/dnsmasq.d/untrusted-network.conf
+if [[ -e /etc/dnsmasq.d/untrusted-network.conf ]]; then
+  rm -f /etc/dnsmasq.d/untrusted-network.conf
 
-systemctl reload dnsmasq
+  nscd -i hosts
+  systemctl reload dnsmasq
+fi