Skip to content
Snippets Groups Projects
Commit 3c2980ee authored by Rodrigo Goncalves's avatar Rodrigo Goncalves
Browse files

Fix for correct certificate serial size creation

parent c2b3d382
No related branches found
No related tags found
1 merge request!15Resolve "Include scripts to create client certificates in docker image"
#!/bin/bash #!/bin/bash
# Caciano Machado/Juliano Zatta - 16/10/2017
cd /certmanager cd /certmanager
. config . config
openssl genpkey -algorithm RSA -out certificates/rootCA.key -pkeyopt rsa_keygen_bits:2048
openssl req -x509 -new -nodes -key certificates/rootCA.key -sha256 -days 3650 -out certificates/rootCA.pem -subj "/C=BR/ST=$STATE/L=$CITY/O=$ORG/OU=$UNIT/CN=$HOST" -set_serial "0x$(openssl rand -hex 8)" cd certificates
\ No newline at end of file
if [ -a ${CERTNAME}.pem ]; then
echo "WARNING: Certificate with name $CERTNAME already exists."
echo "WARNING: If you really want to delete it then do it manually."
else
ROOTCA_SERIAL=`openssl rand -hex 8`
openssl genrsa -out ${CERTNAME}.key $KEYSIZE
openssl req -subj "/C=BR/ST=$STATE/L=$CITY/O=$ORG/OU=$UNIT/CN=Root\ Certificate" -x509 -new -nodes -key ${CERTNAME}.key -sha256 -days $ROOTEXP -out ${CERTNAME}.pem -set_serial "0x$ROOTCA_SERIAL"
echo $ROOTCA_SERIAL > rootCA.srl
fi
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment