Openvpn generate clinet config and keys

On my openvpn server i have built an small script so i can create new clients certs easy.
My server is and Ubuntu server and my openvpn server is set up from this guide.

https://help.ubuntu.com/community/OpenVPN

In the folder /etc/openvpn/easy-rsa i created he folder TEMP

Then i used this script to create the clients

#!/bin/bash
echo "Enter name of server"
read NAME
#Making Certs
source ./vars
KEY_CN=$NAME ./pkitool $NAME
#Copy keys and files
cp keys/$NAME.* temp/
cp keys/ca.crt temp/
cp keys/ta.key temp/
cp client.ovpn temp/
#Packing config
tar -czf $NAME.tar.gz temp/* --remove-files

 

I then get an tar file with the right keys and config file.
You must put you client.ovpn file in the right place.

and after you unpack the tar enter the client.ovpn file to match the keys. (Next relase fix this with sed )

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: