Skip to content

Instantly share code, notes, and snippets.

@mortymacs
Forked from narbehaj/create-client.sh
Last active November 21, 2017 11:47
Show Gist options
  • Save mortymacs/a3ccbcb8b53dce9a32c0d980c7608b12 to your computer and use it in GitHub Desktop.
Save mortymacs/a3ccbcb8b53dce9a32c0d980c7608b12 to your computer and use it in GitHub Desktop.
OpenVPN Server Configuration for GNU/Linux Servers

OpenVPN Config

apt-get install openvpn easy-rsa
mkdir /etc/openvpn/easy-rsa
cp -rf /usr/share/easy-rsa/* /etc/openvpn/easy-rsa
cp /etc/openvpn/easy-rsa/openssl-1.0.0.cnf /etc/openvpn/easy-rsa/openssl.cnf

Edit the vars file in order to create certificates information:

nano /etc/openvpn/easy-rsa/vars
cd /etc/openvpn/easy-rsa
source vars
./clean-all # Cleans everything in keys
./build-ca
./build-key-server MYSERVER-VPN

Client add and configuration:

source ./vars
./build-key CLIENT-NAME

./build-dh

Copy server related files in order to run the server:

cd keys/
cp dh2048.pem ca.crt MYSERVER-VPN.crt MYSERVER-VPN.key /etc/openvpn

Configuring Server:

cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/
gzip -d /etc/openvpn/server.conf.gz
cd /etc/openvpn/
nano server.conf # Edit carefully

Client Config File:

cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf /etc/openvpn/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment