Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ubuntu 11.04 AWS EC2 PPTPD Installer
# This script will install and configure a PPTPD server on your Ubuntu box.
# I use this for a micro instance on Amazon EC2 as a quick, cheap (free!) VPN
# This script was tested with Natty Narwahl 11.04, ami-06ad526f
# Usage:
# wget
# sudo su
# /bin/bash
# If you are running this on EC2, also make sure you have a permissive security group.
# Based on
apt-get -y install pptpd
echo "localip" >> /etc/pptpd.conf
echo "remoteip" >> /etc/pptpd.conf
# Google DNS, change if you like.
echo "ms-dns" >> /etc/ppp/pptpd-options
echo "ms-dns" >> /etc/ppp/pptpd-options
PASSWORD=$(echo "$RANDOM.$(date +%s)" | shasum | awk '{print $1}')
echo "vpn pptpd $PASSWORD *" >> /etc/ppp/chap-secrets
/etc/init.d/pptpd restart
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
sysctl -p
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE" > /etc/rc.local
echo "exit 0" >> /etc/rc.local
echo "Installed! Your username is vpn and your password is $PASSWORD"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment