POSTIN
/bin/sh
if [ "$1" = "1" ]; then
mkdir -p /etc/pki/tls/{private,certs} 2>/dev/null
umask 077
if [ ! -f /etc/pki/tls/private/localhost.key ]; then
/usr/bin/openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > /etc/pki/tls/private/localhost.key 2> /dev/null
fi
FQDN=`hostname`
if [ "x${FQDN}" = "x" ]; then
FQDN=localhost.localdomain
fi
if [ ! -f /etc/pki/tls/certs/localhost.crt ] ; then
cat << EOF | /usr/bin/openssl req -new -key /etc/pki/tls/private/localhost.key -x509 -days 365 -set_serial $RANDOM -out /etc/pki/tls/certs/localhost.crt 2>/dev/null
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
${FQDN}
root@${FQDN}
EOF
fi
fi
if [ "$1" -gt "1" ]; then
mkdir -p /etc/pki/tls/{private,certs} 2>/dev/null
if [ -d /etc/ssl/apache ];then
if [ -f /etc/ssl/apache/server.crt.rpmsave -a ! -f /etc/pki/tls/certs/localhost.crt ]; then
cp -p /etc/ssl/apache/server.crt.rpmsave /etc/pki/tls/certs/localhost.crt
fi
if [ -f /etc/ssl/apache/server.key.rpmsave -a ! -f /etc/pki/tls/private/localhost.key ]; then
cp -p /etc/ssl/apache/server.key.rpmsave /etc/pki/tls/private/localhost.key
fi
fi
fi
# create some ghost files
/usr/share/rpm-helper/create-file apache $1 /var/cache/httpd/mod_ssl/scache.dir apache root 0600
/usr/share/rpm-helper/create-file apache $1 /var/cache/httpd/mod_ssl/scache.pag apache root 0600
/usr/share/rpm-helper/create-file apache $1 /var/cache/httpd/mod_ssl/scache.sem apache root 0600
if [ -f /var/lock/subsys/httpd ]; then
/etc/rc.d/init.d/httpd restart 1>&2;
fi
POSTUN
/bin/sh
if [ "$1" = "0" ]; then
if [ -f /var/lock/subsys/httpd ]; then
/etc/rc.d/init.d/httpd restart 1>&2
fi
fi