From c55bec7b7d5f318817f088c59e6f15a702628e27 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Fri, 12 Dec 2014 20:57:35 -0800 Subject: [PATCH] --- vpnsetup.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/vpnsetup.sh b/vpnsetup.sh index 8778e8d..6054639 100644 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -22,7 +22,7 @@ # Attribution required: please include my name in any derivative and let me # know how you have improved it! -if [[ "`uname`" == "Darwin" ]]; then +if [[ "$(uname)" == "Darwin" ]]; then echo "DO NOT run this script on your Mac! It should only be run on a newly-created EC2 instance" echo "or other dedicated server / VPS, after you have modified it to set the three variables below." echo "Please see detailed instructions at the URLs in the comments." @@ -37,6 +37,12 @@ VPN_PASSWORD=your_very_secure_password # Note: If you need multiple VPN users with different credentials, # please see: https://gist.github.com/hwdsl2/123b886f29f4c689f531 +# In Amazon EC2, those two variables will be found automatically. +# For all other servers, you MUST replace them with the actual IPs! +# If your server only has a public IP, use that IP on both lines. +PRIVATE_IP=$(wget -q -O - 'http://169.254.169.254/latest/meta-data/local-ipv4') +PUBLIC_IP=$(wget -q -O - 'http://169.254.169.254/latest/meta-data/public-ipv4') + # Install necessary packages apt-get update apt-get install libnss3-dev libnspr4-dev pkg-config libpam0g-dev \ @@ -51,15 +57,11 @@ apt-get install xl2tpd -y # "service ipsec restart" and "service xl2tpd restart". mkdir -p /opt/src cd /opt/src -wget -qO- https://download.libreswan.org/libreswan-3.11.tar.gz | tar xvz -cd libreswan-3.11 +wget -qO- https://download.libreswan.org/libreswan-3.12.tar.gz | tar xvz +cd libreswan-3.12 make programs make install -# Those two variables will be found automatically -PRIVATE_IP=`wget -q -O - 'http://169.254.169.254/latest/meta-data/local-ipv4'` -PUBLIC_IP=`wget -q -O - 'http://169.254.169.254/latest/meta-data/public-ipv4'` - # Prepare various config files cat > /etc/ipsec.conf < /etc/ppp/chap-secrets < /etc/sysctl.conf < /etc/iptables.rules < /etc/iptables.rules < /etc/network/if-pre-up.d/iptablesload < /etc/rc.local <