Created
March 28, 2016 14:28
-
-
Save ikks/94f0d746c6ebb640d6e3 to your computer and use it in GitHub Desktop.
Unified OpenVPN certificate for clients
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Creates a file for clients, just put the name of the cert and answer y to every question | |
# Based on https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-debian-8 | |
if [ $# -ne 1 ]; then | |
echo $'Make sure you put a name for your new client i.e.:\n' | |
echo " $0 loginandroid" | |
echo $'' | |
exit 1 | |
fi | |
cd /etc/openvpn/easy-rsa | |
. ./vars | |
./build-key $1 | |
cp /etc/openvpn/easy-rsa/keys/client.ovpn /tmp/ | |
echo '<ca>' >> /tmp/client.ovpn | |
cat /etc/openvpn/ca.crt >> /tmp/client.ovpn | |
echo '</ca>' >> /tmp/client.ovpn | |
echo '<cert>' >> /tmp/client.ovpn | |
cat /etc/openvpn/easy-rsa/keys/$1.crt >> /tmp/client.ovpn | |
echo '</cert>' >> /tmp/client.ovpn | |
echo '<key>' >> /tmp/client.ovpn | |
cat /etc/openvpn/easy-rsa/keys/$1.key >> /tmp/client.ovpn | |
echo '</key>' >> /tmp/client.ovpn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment