add CLIENT_FILEPATH environment variable support

This environment variable can be set to customize destination of
.ovpn file to generate.

If defined, it should contain the full path of the file to generate.
This commit is contained in:
Rémi Alvergnat 2022-01-19 15:57:19 +01:00
parent 610d42e6b2
commit 1182e98aed

View File

@ -1093,6 +1093,7 @@ function newClient() {
echo "Client $CLIENT added."
fi
if [[ -z "$CLIENT_FILEPATH" ]]; then
# Home directory of the user, where the client configuration will be written
if [ -e "/home/${CLIENT}" ]; then
# if $1 is a user name
@ -1113,6 +1114,7 @@ function newClient() {
fi
CLIENT_FILEPATH="$homeDir/$CLIENT.ovpn"
fi
# Determine if we use tls-auth or tls-crypt
if grep -qs "^tls-crypt" /etc/openvpn/server.conf; then