aboutsummaryrefslogtreecommitdiffstats
path: root/main/dovecot/dovecot.post-install
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-06-11 07:55:52 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-06-11 09:50:38 +0000
commit21efade36950aecb8d5e3a63e4050db86913dbe5 (patch)
tree3d44c335a2a612889da7e8402099283bb40e97d7 /main/dovecot/dovecot.post-install
parent7483fd04e48431f13a0fedf3f980bb0cd7634b38 (diff)
downloadaports-21efade36950aecb8d5e3a63e4050db86913dbe5.tar.gz
aports-21efade36950aecb8d5e3a63e4050db86913dbe5.tar.bz2
aports-21efade36950aecb8d5e3a63e4050db86913dbe5.tar.xz
main/dovecot: set localstatedir
ref #359 ref #360 also create a default config that works out of the box.
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 0000000000..a7cccddfd8
--- /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