diff options
author | Gianni Ceccarelli <dakkar@thenautilus.net> | 2009-05-10 12:04:57 +0000 |
---|---|---|
committer | Gianni Ceccarelli <dakkar@thenautilus.net> | 2009-05-10 12:04:57 +0000 |
commit | 2ba22903f8b3219d9e0bd0abdf2e42db9a1ef834 (patch) | |
tree | 5541c574fb22e2a8b559d45de68498309247b3d0 /mail-mta/netqmail/files/mkservercert | |
parent | initial import (diff) | |
download | gentoo-overlay-2ba22903f8b3219d9e0bd0abdf2e42db9a1ef834.tar.gz gentoo-overlay-2ba22903f8b3219d9e0bd0abdf2e42db9a1ef834.tar.bz2 gentoo-overlay-2ba22903f8b3219d9e0bd0abdf2e42db9a1ef834.zip |
netqmail with outgoingip patch
Diffstat (limited to 'mail-mta/netqmail/files/mkservercert')
-rw-r--r-- | mail-mta/netqmail/files/mkservercert | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/mail-mta/netqmail/files/mkservercert b/mail-mta/netqmail/files/mkservercert new file mode 100644 index 0000000..4d74791 --- /dev/null +++ b/mail-mta/netqmail/files/mkservercert @@ -0,0 +1,55 @@ +#!/bin/bash +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/mkservercert,v 1.2 2007/05/05 05:16:58 vapier Exp $ +# Self-signed certificate generator for Qmail under Gentoo +# Robin H. Johnson <robbat2@gentoo.org> - October 17, 2003 +# Based on mkimapdcert from courier-imap. + +test -x /usr/bin/openssl || exit 0 +source /etc/init.d/functions.sh || exit 1 + +filedir="/var/qmail/control" +pemfile="${filedir}/servercert.pem" +randfile="${filedir}/servercert.rand" +conffile="${filedir}/servercert.cnf" + +# file details for pemfile +mode="0640" +uid="qmaild" +gid="qmail" + +# expire on certifcate +days="365" + +if test -f $pemfile +then + eerror "$pemfile already exists." + exit 1 +fi + +ewarn "Please customize ${conffile} before continuing!" +einfo "Press ENTER to continue, or CTRL-C to stop now." +read + +# setup the temp file +cp /dev/null $pemfile +chmod 600 $pemfile +chown root $pemfile + +cleanup() { + rm -f $pemfile + rm -f $randfile + exit 1 +} + +dd if=/dev/urandom of=${randfile} bs=64 count=1 2>/dev/null +chmod 600 ${randfile} +einfo "Creating self-signed certificate" +/usr/bin/openssl req -new -x509 -days ${days} -nodes \ + -config ${conffile} -out $pemfile -keyout $pemfile -rand ${randfile} || cleanup +einfo "Certificate details" +/usr/bin/openssl x509 -subject -dates -fingerprint -noout -in $pemfile || cleanup +chown ${uid}:${gid} ${pemfile} +chmod ${mode} ${pemfile} +#qmail needs an extra item +ln -s ${pemfile} ${filedir}/clientcert.pem +rm -f $randfile |