aports/main/apache2/apache2-ssl.post-install
Kaarle Ritvanen 45fa9ece3e main/apache2: adjust genrsa options
increase key length to 2048 bits
remove 'rand' option (not supported by libressl)
2016-10-30 18:44:39 +02:00

30 lines
495 B
Bash

#!/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