Sophie

Sophie

distrib > Mageia > 2 > i586 > by-pkgid > faefab252939338fd62c9536150c4fb4 > scriptlet

apache-mod_ssl-2.2.24-1.mga2.i586.rpm

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 

# http://qa.mandriva.com/show_bug.cgi?id=33429
if [ -f /etc/pki/tls/certs/localhost.crt ]; then
    chmod 644 /etc/pki/tls/certs/localhost.crt
fi