Skip to content

Instantly share code, notes, and snippets.

@idvoretskyi
Created April 18, 2016 06:15
Show Gist options
  • Select an option

  • Save idvoretskyi/c94dc66e162797008ad2366f667bb85a to your computer and use it in GitHub Desktop.

Select an option

Save idvoretskyi/c94dc66e162797008ad2366f667bb85a to your computer and use it in GitHub Desktop.
#!/bin/sh -e
trap '' 2
# Stop shill and restart it with a nicer attitude towards tun0
sudo stop shill
sudo start shill BLACKLISTED_DEVICES=tun0
# Sleep 10 seconds to allow chromebook to reconnect to the network
sudo sleep 10
sudo openvpn --mktun --dev tun0
sudo sleep 3
# Add google DNS on top of current ones, since openvpn command does not do it
#sudo sed -i 's/nameserver/# nameserver/' /var/run/shill/resolv.conf
#sudo sed -i '1s/^/# new DNS\nnameserver 8.8.8.8\nnameserver 8.8.4.4\n# old DNS\n/' /var/run/shill/r\
esolv.conf
# Lauch openvpn, finally...
sudo openvpn --config $1 --dev tun0
# When ctrl-c is hit remove tun0 and cleanup the DNS
sudo openvpn --rmtun --dev tun0
#sudo sed -i '/# new DNS/,/# old DNS/d' /var/run/shill/resolv.conf
#sudo sed -i 's/# nameserver/nameserver/' /var/run/shill/resolv.conf
trap 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment