2012-02-02 10:06:27 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
. /etc/sysconfig/network
|
|
|
|
|
2016-06-09 11:46:52 +00:00
|
|
|
# Source exim configureation.
|
|
|
|
if [ -f /etc/sysconfig/exim ] ; then
|
|
|
|
. /etc/sysconfig/exim
|
|
|
|
fi
|
|
|
|
|
|
|
|
USER=${USER:=exim}
|
|
|
|
GROUP=${GROUP:=exim}
|
|
|
|
|
2012-02-02 10:06:27 +00:00
|
|
|
gen_cert() {
|
|
|
|
if [ ! -f /etc/pki/tls/certs/exim.pem ] ; then
|
|
|
|
umask 077
|
|
|
|
FQDN=`hostname`
|
|
|
|
if [ "x${FQDN}" = "x" ]; then
|
|
|
|
FQDN=localhost.localdomain
|
|
|
|
fi
|
|
|
|
echo -n $"Generating exim certificate: "
|
|
|
|
cat << EOF | openssl req -new -x509 -days 365 -nodes \
|
|
|
|
-out /etc/pki/tls/certs/exim.pem \
|
|
|
|
-keyout /etc/pki/tls/private/exim.pem &>/dev/null
|
|
|
|
--
|
|
|
|
SomeState
|
|
|
|
SomeCity
|
|
|
|
SomeOrganization
|
|
|
|
SomeOrganizationalUnit
|
|
|
|
${FQDN}
|
|
|
|
root@${FQDN}
|
|
|
|
EOF
|
|
|
|
if [ $? -eq 0 ]; then
|
2015-11-02 17:09:41 +00:00
|
|
|
echo success
|
2016-06-09 11:46:52 +00:00
|
|
|
chown $USER:$GROUP /etc/pki/tls/{private,certs}/exim.pem
|
2012-02-02 10:06:27 +00:00
|
|
|
chmod 600 /etc/pki/tls/{private,certs}/exim.pem
|
|
|
|
else
|
2015-11-02 17:09:41 +00:00
|
|
|
echo failure
|
2012-02-02 10:06:27 +00:00
|
|
|
fi
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
gen_cert
|
|
|
|
|
|
|
|
exit 0
|