/usr/lib/courier/mkesmtpdcert is in courier-mta 0.66.1-1ubuntu4.
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 | #! /bin/bash
#
#
# Copyright 2000-2007 Double Precision, Inc. See COPYING for
# distribution information.
#
# This is a short script to q`uickly generate a self-signed X.509 key for
# ESMTP STARTTLS. 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
if test -f /usr/lib/courier/esmtpd.pem
then
echo "/usr/lib/courier/esmtpd.pem already exists."
exit 1
fi
cleanup() {
rm -f /usr/lib/courier/esmtpd.rand
rm -f /usr/lib/courier/esmtpd.pem
rm -f /usr/lib/courier/esmtpd.key
rm -f /usr/lib/courier/esmtpd.cert
exit 1
}
cd /usr/lib/courier
if test "openssl" = "openssl"
then
cp /dev/null /usr/lib/courier/esmtpd.pem
chmod 600 /usr/lib/courier/esmtpd.pem
chown daemon /usr/lib/courier/esmtpd.pem
dd if=/dev/urandom of=/usr/lib/courier/esmtpd.rand count=1 2>/dev/null
/usr/bin/openssl req -new -x509 -days 365 -nodes \
-config /etc/courier/esmtpd.cnf -out /usr/lib/courier/esmtpd.pem -keyout /usr/lib/courier/esmtpd.pem || cleanup
/usr/bin/openssl gendh -rand /usr/lib/courier/esmtpd.rand 512 >>/usr/lib/courier/esmtpd.pem || cleanup
/usr/bin/openssl x509 -subject -dates -fingerprint -noout -in /usr/lib/courier/esmtpd.pem || cleanup
rm -f /usr/lib/courier/esmtpd.rand
else
cp /dev/null /usr/lib/courier/esmtpd.key
chmod 600 /usr/lib/courier/esmtpd.key
cp /dev/null /usr/lib/courier/esmtpd.cert
chmod 600 /usr/lib/courier/esmtpd.cert
/usr/local/bin/certtool --generate-privkey --outfile esmtpd.key
/usr/local/bin/certtool --generate-self-signed --load-privkey esmtpd.key --outfile esmtpd.cert --template /etc/courier/esmtpd.cnf
/usr/local/bin/certtool --generate-dh-params >>esmtpd.cert
cp /dev/null /usr/lib/courier/esmtpd.pem
chmod 600 /usr/lib/courier/esmtpd.pem
cat esmtpd.key esmtpd.cert >esmtpd.pem
rm -f esmtpd.key esmtpd.cert
fi
|