aboutsummaryrefslogblamecommitdiffstats
path: root/main/apache2/apache2-ssl.post-install
blob: 1e8478a8d4e1f5d20f38f68c7924221702e2e13b (plain) (tree)
1
2
3
4
5
6
7
8
9







                          
                                                           




















                                              
#!/bin/sh

ssldir=/etc/ssl/apache2
sslkey=$ssldir/server.key
sslcert=$ssldir/server.pem

umask 077

[ -f $sslkey ] || openssl genrsa 2048 > $sslkey 2>/dev/null

FQDN=`hostname -f`
if [ "x${FQDN}" = "x" ]; then
	FQDN=localhost.localdomain
fi

if [ ! -f ${sslcert} ] ; then
cat << EOF | openssl req -new -key ${sslkey} \
         -x509 -days 365 -set_serial $RANDOM \
         -out ${sslcert} 2>/dev/null
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
${FQDN}
root@${FQDN}
EOF
fi