-
-
Save caingougou/3891728 to your computer and use it in GitHub Desktop.
Ubuntu VPN for poor Chinese (on AWS EC2)
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 -x | |
## original author: Oliver Nassar <[email protected]> | |
## credit: harmy <[email protected]> | |
## Ubuntu VPN for poor Chinese (you know de) | |
## Sample Usage: | |
## | |
## wget https://gist.github.com/raw/3891178/ff1702fac175eb21c513b93f51f39948be693aba/vpn-setup.sh | |
## chmod +x vpn-setup.sh | |
## sudo ./vpn-setup.sh <username> <password> | |
## 0.1 Username/Password Check | |
## Checks to make sure *2* parameters were specified | |
## | |
if [ $# -ne 2 ] | |
then | |
echo "Usage: sudo ./`basename $0` <username> <password>" | |
exit 0 | |
fi | |
USERNAME=$1 | |
PASSWORD=$2 | |
## 1.0 VPN Setup | |
## | |
## | |
sudo apt-get -y install pptpd | |
echo "ms-dns 8.8.8.8" | sudo tee -a /etc/ppp/options | |
echo "ms-dns 8.8.4.4" | sudo tee -a /etc/ppp/options | |
echo "$USERNAME pptpd $PASSWORD *" | sudo tee -a /etc/ppp/chap-secrets | |
sudo perl -0 -p -i -e 's/\n#net.ipv4.ip_forward=1/\nnet.ipv4.ip_forward=1/' /etc/sysctl.conf | |
sudo sysctl -p | |
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | |
sudo perl -0 -p -i -e 's/\nexit 0/\n\n# <build script modifications>\n \sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE\n# <\/build script modifications>\n\nexit 0/' /etc/rc.local | |
sudo /etc/init.d/pptpd restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment