altarch-user / rpms / httpd

Forked from rpms/httpd 2 years ago
Clone

Blame SOURCES/httpd-ssl-gencerts

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