850f5063cc1228fa19e91323b51e1f997577f3f8Timo Sirainen# Generates a self-signed certificate.
e7b2b71d91da7f07439247fe0df02921ab13f61eTimo Sirainen# Edit dovecot-openssl.cnf before running this.
850f5063cc1228fa19e91323b51e1f997577f3f8Timo SirainenOPENSSLCONFIG=${OPENSSLCONFIG-dovecot-openssl.cnf}
47229f40be81e07162694e2993ded30818a6708aTimo Sirainenif [ ! -d $CERTDIR ]; then
4827dd103cc836a57aae3ca1aa9409ce45f648c3Timo Sirainen echo "$SSLDIR/certs directory doesn't exist"
47229f40be81e07162694e2993ded30818a6708aTimo Sirainenif [ ! -d $KEYDIR ]; then
4827dd103cc836a57aae3ca1aa9409ce45f648c3Timo Sirainen echo "$SSLDIR/private directory doesn't exist"
850f5063cc1228fa19e91323b51e1f997577f3f8Timo Sirainenif [ -f $CERTFILE ]; then
850f5063cc1228fa19e91323b51e1f997577f3f8Timo Sirainen echo "$CERTFILE already exists, won't overwrite"
850f5063cc1228fa19e91323b51e1f997577f3f8Timo Sirainenif [ -f $KEYFILE ]; then
850f5063cc1228fa19e91323b51e1f997577f3f8Timo Sirainen echo "$KEYFILE already exists, won't overwrite"
46307f44857cc2a72f4b79538cb5fa0c6e8eb32bTimo Sirainen$OPENSSL req -new -x509 -nodes -config $OPENSSLCONFIG -out $CERTFILE -keyout $KEYFILE -days 365 || exit 2