Created
February 27, 2016 13:32
-
-
Save kdiogenes/14410b7a37bcbbcaaa54 to your computer and use it in GitHub Desktop.
bash: update named and cntlm configurations
This file contains hidden or 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/sh | |
| case "$2" in | |
| up|vpn-up) | |
| IP=`/sbin/ifconfig | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2}'` | |
| case $IP in | |
| 10.*) | |
| logger "configNetwork.sh - setting configurations for enterprise net" | |
| forwarders=" forwarders { corporate_dns_1; corporate_dns_2; };" | |
| NoProxy="NoProxy localhost, 127.0.0.*, 10.*, 192.168.*, *.mydomain.dev.br, *.myenterprise.br" | |
| ;; | |
| *) | |
| logger "configNetwork.sh - setting configurations for direct net" | |
| forwarders=" forwarders { 8.8.4.4; 8.8.8.8; };" | |
| NoProxy="NoProxy *" | |
| ;; | |
| esac | |
| sudo sed "s/^ forwarders.*$/$forwarders/g" -i /etc/named.conf | |
| sudo systemctl stop named | |
| sudo systemctl start named | |
| sudo sed "s/^NoProxy.*$/$NoProxy/g" -i /etc/cntlm.conf | |
| sudo systemctl stop cntlm | |
| sudo systemctl start cntlm | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment