/usr/lib/courier/mkimapdcert is in courier-imap-ssl 4.15-1.6.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #! /bin/bash
#
#
# Copyright 2000-2007 Double Precision, Inc. See COPYING for
# distribution information.
#
# This is a short script to quickly generate a self-signed X.509 key for
# IMAP over SSL. Normally this script would get called by an automatic
# package installation routine.
if test "openssl" = "openssl"
then
test -x /usr/bin/openssl || exit 0
else
test -x /usr/local/bin/certtool || exit 0
fi
prefix="/usr"
if test -f /etc/courier/imapd.pem
then
echo "/etc/courier/imapd.pem already exists."
exit 1
fi
umask 077
set -e
BITS="$BITS"
cleanup() {
rm -f /etc/courier/imapd.pem
rm -f /etc/courier/imapd.rand
rm -f /etc/courier/imapd.key
rm -f /etc/courier/imapd.cert
exit 1
}
cd /etc/courier
if test "openssl" = "openssl"
then
cp /dev/null /etc/courier/imapd.pem
chmod 600 /etc/courier/imapd.pem
chown daemon /etc/courier/imapd.pem
dd if=/dev/urandom of=/etc/courier/imapd.rand count=1 2>/dev/null
/usr/bin/openssl req -new -x509 -days 365 -nodes \
-config /etc/courier/imapd.cnf -out /etc/courier/imapd.pem -keyout /etc/courier/imapd.pem || cleanup
/usr/bin/openssl x509 -subject -dates -fingerprint -noout -in /etc/courier/imapd.pem || cleanup
rm -f /etc/courier/imapd.rand
else
if test "$BITS" = ""
then
BITS="high"
fi
cp /dev/null /etc/courier/imapd.key
chmod 600 /etc/courier/imapd.key
cp /dev/null /etc/courier/imapd.cert
chmod 600 /etc/courier/imapd.cert
cp /dev/null /etc/courier/imapd.pem
chmod 600 /etc/courier/imapd.pem
chown daemon /etc/courier/imapd.pem
cp /dev/null /etc/courier/imapd.pem
cp /dev/null /etc/courier/imapd.cert
cp /dev/null /etc/courier/imapd.key
/usr/local/bin/certtool --generate-privkey --sec-param=$BITS --outfile imapd.key
/usr/local/bin/certtool --generate-self-signed --load-privkey imapd.key --outfile imapd.cert --template /etc/courier/imapd.cnf
cat imapd.key imapd.cert >imapd.pem
rm -f imapd.key imapd.cert
fi
|