Commit 4c245f7d authored by Janek Bevendorff's avatar Janek Bevendorff

Don't add private key to .ovpn file if external CSR is provided

parent 146ce750
......@@ -178,16 +178,18 @@ resolve_ca_chain() {
# Usage: OUT_FILE KEY CERT CA_CERT
generate_ovpn_file() {
echo "Password to encrypt private key in .ovpn config file: " >&2
local pem="$(openssl rsa -aes256 -in $2)"
while [ "$pem" == "" ]; do
logError "Invalid passphrase, please try again."
if [ "$2" == "" ]; then
echo "Password to encrypt private key in .ovpn config file: " >&2
local pem="$(openssl rsa -aes256 -in $2)"
done
local out_file="$1"
if ! $(echo "$out_file" | grep -q '\.ovpn$'); then
out_file="${out_file}.ovpn"
while [ "$pem" == "" ]; do
logError "Invalid passphrase, please try again."
local pem="$(openssl rsa -aes256 -in $2)"
done
local out_file="$1"
if ! $(echo "$out_file" | grep -q '\.ovpn$'); then
out_file="${out_file}.ovpn"
fi
fi
cat <<EOL > "$out_file"
client
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment