setup-ipsec-vpn

by hwdsl2
47 deployments · 18 still active · last rev. 1 day ago

Scripts to build your own IPsec VPN server, with IPsec/L2TP and Cisco IPsec on Ubuntu, Debian and CentOS.

How to use: https://www.linode.com/docs/platform/stackscripts

After deployment, boot your Linode and wait 10 minutes to allow VPN setup to complete.
And your fully configured IPsec VPN server is ready for use!

GitHub repository: https://github.com/hwdsl2/setup-ipsec-vpn
Important notes: https://git.io/vpnnotes
Setup VPN clients: https://git.io/vpnclients

IMPORTANT: DO NOT use these characters in VPN credentials: \ " '

Compatible with: CentOS 7, Debian 8, Ubuntu 14.04 LTS, Ubuntu 16.04 LTS, CentOS 6.5, Ubuntu 12.04 LTS
						#!/bin/bash

# <UDF name="VPN_IPSEC_PSK" Label="IPsec Pre-Shared Key" />
# <UDF name="VPN_USER" Label="VPN Username" />
# <UDF name="VPN_PASSWORD" Label="VPN Password" />

if [ -f /etc/apt/sources.list ]; then
  url=vpnsetup
  apt-get -y update
  apt-get -y install wget
elif [ -f /etc/yum.conf ]; then
  url=vpnsetup-centos
  yum -y install wget
else
  echo "Your distribution is not supported by this StackScript"
  exit 1
fi

wget "https://git.io/$url" -O /tmp/vpn.sh && sh /tmp/vpn.sh && rm -f /tmp/vpn.sh

# Fix xl2tpd on CentOS 7 for Linode VMs, because kernel module
# l2tp_ppp is not available in the default Linode kernel
if grep -qs "release 7" /etc/redhat-release; then
  if [ -f /usr/lib/systemd/system/xl2tpd.service ]; then
    sed -i '/ExecStartPre/s/^/#/' /usr/lib/systemd/system/xl2tpd.service
    systemctl daemon-reload
    systemctl restart xl2tpd
  fi
fi