From 854002ae4da9f9e1853240d050d2903f6ac86c96 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Fri, 29 Apr 2022 21:29:47 +0100 Subject: [PATCH] Verify input file is a valid certificate Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index fb7e746..f3e0535 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -2276,6 +2276,14 @@ Run easyrsa without commands for usage and command help." ca_crt="$in_dir/ca.crt" crt_in="$in_dir/issued/$file_name_base.crt" + # Cert file must exist + [ -f "$crt_in" ] || die "\ +No certificate found for the input: '$crt_in'" + + # Verify file is a valid cert + verify_file x509 "$crt_in" || die "\ +Input is not a valid certificate: $crt_in" + # Test and show SSL out if easyrsa_openssl verify -CAfile "$ca_crt" "$crt_in"; then [ "$EASYRSA_SILENT" ] || print # Separate Notice below