courier-imap/imap-generate-certificate.sh

10 lines
452 B
Bash

#!/bin/bash
# generate a key
openssl genrsa -out /etc/imap/imap.key
# create a server certificate signing request
openssl req -new -key /etc/imap/imap.key -config /etc/imap/imapd.cnf -out /etc/imap/imap.csr -days 999
# sign the server certificate request
openssl ca -policy policy_anything -out /etc/imap/imap.crt -infiles /etc/imap/imap.csr
# merge private keys with signed certificate
cat /etc/imap/imap.key /etc/imap/imap.crt > /etc/imap/imap.pem