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/