Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,6 @@ openssl verify -verbose -CAfile ca.crt client.crt
echo ""
echo " == Validate Client with passphrase"
openssl verify -verbose -CAfile ca.crt client.encrypted.crt

echo ""
echo " == Transform Client from PEM to RSA format"
openssl rsa -in client.key -out client_new.key -traditional && mv client_new.key client.key

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using a hardcoded temporary filename client_new.key can be problematic. If the script is interrupted or if multiple instances are run concurrently in the same directory, it could lead to race conditions or leave behind stale temporary files. It is safer to use a unique name for the temporary file, for example by incorporating the process ID ($$), to make the script more robust.

Suggested change
openssl rsa -in client.key -out client_new.key -traditional && mv client_new.key client.key
tmp_file="client.key.$$" && openssl rsa -in client.key -out "$tmp_file" -traditional && mv "$tmp_file" client.key

Loading