Skip to content

Commit

Permalink
update rsa check
Browse files Browse the repository at this point in the history
  • Loading branch information
soutenniza committed Oct 23, 2023
1 parent dbe1701 commit 827a6dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ci/provision-certificate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ cp ${out_path}/*.pem acme
# Before provision exit - check that certificate and key are RSA based and 2048 bit length - if not error out task

CERT_CHECK=$(cat acme/cert.pem | openssl x509 -text -noout | grep "Public-Key")
KEY_CHECK=$(cat acme/privkey.pem | openssl rsa -text -noout | grep "Private-Key")
KEY_CHECK=$(openssl rsa -in acme/privkey.pem -check -noout | grep "RSA key")

if [[ "$CERT_CHECK" == *"2048 bit"* ]]; then
echo "Certificate is 2048 bit and good"
Expand All @@ -53,7 +53,7 @@ if [[ "$CERT_CHECK" == *"2048 bit"* ]]; then
exit 1
fi

if [[ "$KEY_CHECK" == *"RSA Private"* ]]; then
if [[ "$KEY_CHECK" == *"RSA key ok"* ]]; then
echo "Key is RSA based and good"
else
echo "Key is NOT RSA based and is bad/corrupt"
Expand Down

0 comments on commit 827a6dc

Please sign in to comment.