summaryrefslogtreecommitdiffstats
path: root/main/apache2/apache2-ssl.post-install
blob: d73b5fc6225775999108d90a8b0b8db746860ae3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

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

umask 077

if [ ! -f ${sslkey} ] ; then
	openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > ${sslkey} 2> /dev/null
fi

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