OpenVPN - Latest One-Click

by linode
435 deployments · 408 still active · last rev. 3 months ago

Compatible with: Debian 9
Includes: One-Click Helpers
						#!/bin/bash

# <UDF name="pubkey" Label="SSH Key" default="" />
# <UDF Name="vpnuser_password" Label="VPN Password"/>

source <ssinclude StackScriptID="401712">


exec 1> >(tee -a "/var/log/stackscript.log") 2>&1

# Set hostname, apt configuration and update/upgrade

set_hostname
apt_setup_update
if [[ "$PUBKEY" != "" ]]; then
  add_pubkey
fi

## Download OpenVPN Access Server .deb
wget https://openvpn.net/downloads/openvpn-as-latest-debian9.amd_64.deb
## Install Net-Tools (Required for the OpenVPN Server to Start)
apt-get -o Acquire::ForceIPv4=true -y install net-tools
## Install OpenVPN Access Server
dpkg -i openvpn-as-latest-debian9.amd_64.deb
## Set openvpn user passwd
echo openvpn:"$VPNUSER_PASSWORD" |chpasswd

## Other things to Note
## Admin UI is at: https://<ip>:943/admin by default
## Client is at: https://<ip> by default
## Client Page can download the .ovpn file and also links to various clients

# Cleanup
stackscript_cleanup