Check that certificates are created
This commit is contained in:
parent
369e2a5b2f
commit
667cfdd3f8
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue