Files
scripts/Linux TinyCA/div.sh
2024-10-14 00:08:40 +02:00

37 lines
1.0 KiB
Bash

cd /home/conetadm/.TinyCA/CONET_Frankfurt2
ls req/ | sort > _req.txt
ls certs/ | sort > _certs.txt
ls keys/ | sort > _keys.txt
diff _certs.txt _keys.txt
function base64decode {
perl -e 'use MIME::Base64 qw (encode_base64); use Encode qw (is_utf8 encode decode); print MIME::Base64::encode("$ARGV[0]", ""); print "\n";' "$1"
}
while read LINE
do
L=$(echo $LINE | egrep "^V" | sed -e "s/^.*\/C=\(.*\)/\/C=\1/" | sed "s/\/C=\(.*\)\/ST=\(.*\)\/L=\(.*\)\/O=\(.*\)\/OU=\(.*\)\/CN=\(.*\)\/emailAddress=\(.*\)/\6:\7:\5:\4:\3:\2:\1/")
if [[ "$L" =~ "MQSRFSCACIS" ]]
then
echo SKIP; echo ""
else
if [ "$L" != "" ]
then
echo "### L: "$L
CSR=$(base64decode "$L")
echo "### R: "$CSR
if [ ! -f req/$CSR.pem ]
then
echo "CSR existiert nicht"
sleep 30
fi
ls -l req/$CSR.pem
openssl x509 -in certs/$CSR.pem -text -noout | grep "Subject Alternative Name" -A1 | grep -v "Subject Alternative Name"
echo ""; echo ""
fi
fi
done < index.txt