30 lines
608 B
Bash
30 lines
608 B
Bash
#!/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"
|
|
|
|
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
|