summaryrefslogtreecommitdiffstats
path: root/imap/mkpop3dcert.in
diff options
context:
space:
mode:
Diffstat (limited to 'imap/mkpop3dcert.in')
-rw-r--r--imap/mkpop3dcert.in14
1 files changed, 11 insertions, 3 deletions
diff --git a/imap/mkpop3dcert.in b/imap/mkpop3dcert.in
index 9a4c530..5d48a1f 100644
--- a/imap/mkpop3dcert.in
+++ b/imap/mkpop3dcert.in
@@ -24,6 +24,7 @@ then
fi
umask 077
+set -e
cleanup() {
rm -f @certsdir@/pop3d.pem
@@ -34,6 +35,9 @@ cleanup() {
}
cd @certsdir@
+umask 077
+BITS="$BITS"
+set -e
if test "@ssllib@" = "openssl"
then
@@ -44,20 +48,24 @@ then
dd if=@RANDOMV@ of=@certsdir@/pop3d.rand count=1 2>/dev/null
@OPENSSL@ req -new -x509 -days 365 -nodes \
-config @sysconfdir@/pop3d.cnf -out @certsdir@/pop3d.pem -keyout @certsdir@/pop3d.pem || cleanup
- @OPENSSL@ gendh -rand @certsdir@/pop3d.rand 512 >>@certsdir@/pop3d.pem || cleanup
@OPENSSL@ x509 -subject -dates -fingerprint -noout -in @certsdir@/pop3d.pem || cleanup
rm -f @certsdir@/pop3d.rand
else
+ if test "$BITS" = ""
+ then
+ BITS="high"
+ fi
+
cp /dev/null @certsdir@/pop3d.key
chmod 600 @certsdir@/pop3d.key
cp /dev/null @certsdir@/pop3d.cert
chmod 600 @certsdir@/pop3d.cert
cp /dev/null @certsdir@/pop3d.pem
chmod 600 @certsdir@/pop3d.pem
+ chown @mailuser@ @certsdir@/pop3d.pem
- @CERTTOOL@ --generate-privkey --outfile pop3d.key
+ @CERTTOOL@ --generate-privkey --sec-param=$BITS --outfile pop3d.key
@CERTTOOL@ --generate-self-signed --load-privkey pop3d.key --outfile pop3d.cert --template @sysconfdir@/pop3d.cnf
- @CERTTOOL@ --generate-dh-params >>pop3d.cert
cat pop3d.key pop3d.cert >pop3d.pem
rm -f pop3d.key pop3d.cert
fi