Created
June 27, 2017 07:27
-
-
Save m0n5t3r/59c9a1c3012df933c5788597c56165ed to your computer and use it in GitHub Desktop.
(Ubuntu specific-ish) Openvpn up script to configure local dnsmasq so only internal domains are resolved via the pushed DNS; needs root, unfortunately
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export PATH=/bin:/sbin:/usr/bin:/usr/local/bin | |
case $script_type in | |
up) | |
(for optionname in ${!foreign_option_*}; do | |
echo ${!optionname} | |
done) | awk '$2 == "DNS" { dns_server = $3 }; $2 == "DOMAIN" { domains = domains "/" $3 }; END { print "server=" domains "/" dns_server }' > /etc/NetworkManager/dnsmasq.d/$remote_1 | |
;; | |
down) | |
rm /etc/NetworkManager/dnsmasq.d/$remote_1 | |
;; | |
esac | |
/etc/init.d/network-manager reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment