From 3351f381550da57e45d85213b12dd62d7013d467 Mon Sep 17 00:00:00 2001 From: lawtancool <26829131+lawtancool@users.noreply.github.com> Date: Sat, 22 Jun 2019 21:38:15 -0700 Subject: [PATCH] Create ovpn_genclientcert --- bin/ovpn_genclientcert | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 bin/ovpn_genclientcert diff --git a/bin/ovpn_genclientcert b/bin/ovpn_genclientcert new file mode 100644 index 0000000..3f9a6c0 --- /dev/null +++ b/bin/ovpn_genclientcert @@ -0,0 +1,31 @@ +#!/bin/bash + +# +# Generate a client certificate with EasyRSA +# + +if [ "$DEBUG" == "1" ]; then + set -x +fi + +CLIENTNAME=$1 +PASSWORD=$2 + +set -e + +source "$OPENVPN/ovpn_env.sh" + +# Download EasyRSA because Ubuntu doesn't have it as a CLI command +wget https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.6/EasyRSA-unix-v3.0.6.tgz +tar xvf EasyRSA-unix-v3.0.6.tgz + +export EASYRSA="EasyRSA-v3.0.6/" +export EASYRSA_SSL_CONF="EasyRSA-v3.0.6/openssl-easyrsa.cnf" +#cp -r EasyRSA-v3.0.6/x509-types/ x509-types/ + +EasyRSA-v3.0.6/easyrsa build-client-full $CLIENTNAME $PASSWORD + +# Remove EasyRSA files when we're done +rm -r EasyRSA-v3.0.6/ +rm EasyRSA-unix-v3.0.6.tgz +rm -r x509-types/