Skip to content
Snippets Groups Projects
Commit 667cfdd3 authored by Bob Mottram's avatar Bob Mottram
Browse files

Check that certificates are created

parent 369e2a5b
No related branches found
No related tags found
No related merge requests found
......@@ -100,12 +100,31 @@ chmod 600 /etc/dovecot/passwd-file
# create a user cert
freedombone-addcert -h $USERNAME --nodh
if [ ! -f /etc/ssl/private/$USERNAME.key ]; then
echo 'User certificates were not created'
rm -rf /home/$USERNAME/emailcert
exit 74835
fi
# create a certificate request
openssl req -new -sha256 -subj "/O=$ORGANISATION/OU=$UNIT/C=$COUNTRY_CODE/ST=$AREA/L=$LOCATION/CN=$USERNAME" -key /etc/ssl/private/$USERNAME.key -out /etc/ssl/requests/$USERNAME.csr
if [ ! -f /etc/ssl/requests/$USERNAME.csr ]; then
echo 'Certificate request was not created'
rm -rf /home/$USERNAME/emailcert
exit 83520
fi
# sign the certificate request
cd /etc/ssl
openssl ca -config /etc/ssl/dovecot-ca.cnf -in /etc/ssl/requests/$USERNAME.csr -out /etc/ssl/certs/$USERNAME.cer
if [ ! -f /etc/ssl/certs/$USERNAME.cer ]; then
echo 'Authentication certificate was not created'
rm -rf /home/$USERNAME/emailcert
exit 343569
fi
# move the cert to the user's home
mkdir /home/$USERNAME/emailcert
mv /etc/ssl/certs/$USERNAME.cer /home/$USERNAME/emailcert
......
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