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