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