summaryrefslogtreecommitdiffstats
path: root/main/dovecot/dovecot.post-install
diff options
context:
space:
mode:
authorAndrew Manison <amanison@anselsystems.com>2010-06-19 09:02:05 +0000
committerAndrew Manison <amanison@anselsystems.com>2010-06-19 09:02:05 +0000
commit85fd77589be2f6c970ca6895afa1520e0a2fda04 (patch)
tree6b9d172b005b2657e541424da71009dcd2a1f3c4 /main/dovecot/dovecot.post-install
parent8fdcdf953f865c691b01d546a0baea1a1143deeb (diff)
parent253afa4a86bcb0959ca8b7fb269f482058847a9b (diff)
downloadaports-85fd77589be2f6c970ca6895afa1520e0a2fda04.tar.bz2
aports-85fd77589be2f6c970ca6895afa1520e0a2fda04.tar.xz
Merge remote branch 'alpine/master'
Conflicts: main/openssl/APKBUILD
Diffstat (limited to 'main/dovecot/dovecot.post-install')
-rw-r--r--main/dovecot/dovecot.post-install31
1 files changed, 31 insertions, 0 deletions
diff --git a/main/dovecot/dovecot.post-install b/main/dovecot/dovecot.post-install
new file mode 100644
index 000000000..a7cccddfd
--- /dev/null
+++ b/main/dovecot/dovecot.post-install
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# based on doc/mkcert.sh
+
+# Generates a self-signed certificate.
+# Edit dovecot-openssl.cnf before running this.
+
+OPENSSL=${OPENSSL-openssl}
+SSLDIR=${SSLDIR-/etc/ssl/dovecot}
+OPENSSLCONFIG=${OPENSSLCONFIG-/etc/dovecot/dovecot-openssl.cnf}
+
+CERTDIR=$SSLDIR
+KEYDIR=$SSLDIR
+
+CERTFILE=$CERTDIR/server.pem
+KEYFILE=$KEYDIR/server.key
+
+if [ -e "$CERTFILE" ]; then
+ echo "Keeiping existing $CERTFILE"
+ exit 0
+fi
+
+if [ -e "$KEYFILE" ]; then
+ echo "Keeiping existing $KEYFILE"
+ exit 0
+fi
+
+$OPENSSL req -new -x509 -nodes -config $OPENSSLCONFIG -out $CERTFILE -keyout $KEYFILE -days 365 || exit 2
+chmod 0600 $KEYFILE
+echo
+$OPENSSL x509 -subject -fingerprint -noout -in $CERTFILE || exit 2