52592b
#!/usr/bin/bash
52592b
52592b
set -e
52592b
52592b
FQDN=`hostname`
52592b
ssldotconf=/etc/httpd/conf.d/ssl.conf
52592b
52592b
if test -f /etc/pki/tls/certs/localhost.crt -a \
52592b
        -f /etc/pki/tls/private/localhost.key; then
52592b
    exit 0
52592b
fi
52592b
52592b
if test -f /etc/pki/tls/certs/localhost.crt -a \
52592b
        ! -f /etc/pki/tls/private/localhost.key; then
52592b
    echo "Missing certificate key!"
52592b
    exit 1
52592b
fi
52592b
52592b
if test ! -f /etc/pki/tls/certs/localhost.crt -a \
52592b
         -f /etc/pki/tls/private/localhost.key; then
52592b
    echo "Missing certificate, but key is present!"
52592b
    exit 1
52592b
fi
52592b
52592b
if ! test -f ${ssldotconf} || \
52592b
   ! grep -q '^SSLCertificateFile /etc/pki/tls/certs/localhost.crt' ${ssldotconf} || \
52592b
   ! grep -q '^SSLCertificateKeyFile /etc/pki/tls/private/localhost.key' ${ssldotconf}; then
52592b
    # Non-default configuration, do nothing.
52592b
    exit 0
52592b
fi
52592b
52592b
sscg -q                                                             \
52592b
     --cert-file           /etc/pki/tls/certs/localhost.crt         \
52592b
     --cert-key-file       /etc/pki/tls/private/localhost.key       \
52592b
     --ca-file             /etc/pki/tls/certs/localhost.crt         \
53bb7e
     --dhparams-file       /tmp/dhparams.pem                        \
52592b
     --lifetime            365                                      \
52592b
     --hostname            $FQDN                                    \
52592b
     --email               root@$FQDN
52592b