aboutsummaryrefslogtreecommitdiffstats
path: root/main/apache2/apache2-ssl.post-install
diff options
context:
space:
mode:
authorAndrew Manison <amanison@anselsystems.com>2011-02-16 19:14:26 +0000
committerAndrew Manison <amanison@anselsystems.com>2011-02-16 19:14:26 +0000
commit71e39ce025e46b17e9634cb8fdeec7af04f2f0fa (patch)
treeab6569d59ab7f79ae8cb7c677658f9ba12854069 /main/apache2/apache2-ssl.post-install
parent01fd4f6611dd2b61cd8ceee01b4a454d74bbbc51 (diff)
parent692f71db5a7621fe29b255de3ef9ae973b74eacb (diff)
downloadaports-71e39ce025e46b17e9634cb8fdeec7af04f2f0fa.tar.bz2
aports-71e39ce025e46b17e9634cb8fdeec7af04f2f0fa.tar.xz
Merge branch 'master' of ssh://git.alpinelinux.org/gitroot/aports-amanison
Conflicts: main/iaxmodem/APKBUILD
Diffstat (limited to 'main/apache2/apache2-ssl.post-install')
-rw-r--r--main/apache2/apache2-ssl.post-install32
1 files changed, 32 insertions, 0 deletions
diff --git a/main/apache2/apache2-ssl.post-install b/main/apache2/apache2-ssl.post-install
new file mode 100644
index 0000000000..d73b5fc622
--- /dev/null
+++ b/main/apache2/apache2-ssl.post-install
@@ -0,0 +1,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
+
+