From 35b1f59e44b8bd339b33bcdf31035a039a413566 Mon Sep 17 00:00:00 2001 From: Richard Bonhomme <25598447+TinCanTech@users.noreply.github.com> Date: Tue, 1 Jan 2019 18:07:17 +0000 Subject: [PATCH] Use EASYRSA specific temp file for output to set_pass Signed-off-by: Richard Bonhomme <25598447+TinCanTech@users.noreply.github.com> --- easyrsa3/easyrsa | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 5421458..2783cc2 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -1038,10 +1038,15 @@ $file" If the key is currently encrypted you must supply the decryption passphrase. ${crypto:+You will then enter a new PEM passphrase for this key.$NL}" - "$EASYRSA_OPENSSL" "$key_type" -in "$file" -out "$file" $crypto || die "\ + EASYRSA_TEMP_FILE_2="$file.temp" + + "$EASYRSA_OPENSSL" "$key_type" -in "$file" -out "$EASYRSA_TEMP_FILE_2" $crypto || die "\ Failed to change the private key passphrase. See above for possible openssl error messages." + mv "$EASYRSA_TEMP_FILE_2" "$file" || die "\ +Failed to change the private key passphrase. See above for error messages." + notice "Key passphrase successfully changed" } # => set_pass()