--- courier-0.78.2.orig/courier/configure.ac 2010-01-09 22:13:40.000000000 +0100 +++ courier-0.78.2/courier/configure.ac 2010-05-08 23:31:10.355976183 +0200 @@ -480,6 +480,12 @@ eval "datarootdir=$datarootdir" eval "bindir=$bindir" eval "localstatedir=$localstatedir" +eval "datadir=$datadir" + +AC_ARG_WITH(certsdir, [ --with-certsdir Directory where certs are created ], +certsdir="$withval", certsdir=$datadir) + +AC_SUBST(certsdir) MAILDROP="$bindir/maildrop" AC_SUBST(MAILDROP) --- courier-0.78.2.orig/courier/imapd-ssl.rc.in 2010-05-08 23:30:54.599915374 +0200 +++ courier-0.78.2/courier/imapd-ssl.rc.in 2010-05-08 23:31:10.355976183 +0200 @@ -28,6 +28,11 @@ case $1 in start) + # If we do not have a certificate, make one up. + if [ ! -f @certsdir@/imapd.pem ]; then + @sbindir@/mkimapdcert + fi + umask $IMAP_UMASK @ULIMIT@ $IMAP_ULIMITD @SETENV@ -i @SHELL@ -c " set -a ; --- courier-0.78.2.orig/courier/module.esmtp/configure.ac 2008-07-12 22:17:24.000000000 +0200 +++ courier-0.78.2/courier/module.esmtp/configure.ac 2010-05-08 23:31:10.355976183 +0200 @@ -287,6 +287,11 @@ AC_SUBST(mydatadir) # Quell automake warning +AC_ARG_WITH(certsdir, [ --with-certsdir Directory where certs are created ], +certsdir="$withval", certsdir=$datadir) + +AC_SUBST(certsdir) + dnl dnl Check what libraries are available dnl --- courier-0.78.2.orig/courier/module.esmtp/esmtpd.dist.in 2010-02-02 23:30:00.000000000 +0100 +++ courier-0.78.2/courier/module.esmtp/esmtpd.dist.in 2010-05-08 23:31:10.355976183 +0200 @@ -242,7 +242,7 @@ # # This is an experimental feature. -TLS_CERTFILE=@mydatadir@/esmtpd.pem +TLS_CERTFILE=@certsdir@/esmtpd.pem ##NAME: TLS_TRUSTCERTS:0 # --- courier-0.78.2.orig/courier/module.esmtp/esmtpd-ssl.dist.in 2010-02-02 23:30:00.000000000 +0100 +++ courier-0.78.2/courier/module.esmtp/esmtpd-ssl.dist.in 2010-05-08 23:31:10.355976183 +0200 @@ -269,7 +269,7 @@ # # This is an experimental feature. -TLS_CERTFILE=@mydatadir@/esmtpd.pem +TLS_CERTFILE=@certsdir@/esmtpd.pem ##NAME: TLS_TRUSTCERTS:0 # --- courier-0.78.2.orig/courier/module.esmtp/esmtpd-ssl.in 2010-05-08 23:30:54.612778263 +0200 +++ courier-0.78.2/courier/module.esmtp/esmtpd-ssl.in 2010-05-08 23:31:10.355976183 +0200 @@ -25,6 +25,10 @@ case $1 in start) + # If we do not have a certificate, make one up. + if [ ! -f @certsdir@/esmtpd.pem ]; then + @sbindir@/mkesmtpdcert + fi ;; stop) ${sbindir}/couriertcpd -pid=$SSLPIDFILE -stop --- courier-0.78.2/courier/module.esmtp/mkesmtpdcert.in.orig 2018-03-25 10:15:59.986631408 +0200 +++ courier-0.78.2/courier/module.esmtp/mkesmtpdcert.in 2018-03-25 11:27:37.983248999 +0200 @@ -11,7 +11,7 @@ PEMFILE="$1" if [ -z "$PEMFILE" ]; then - PEMFILE=@mydatadir@/esmtpd.pem + PEMFILE=@certsdir@/esmtpd.pem fi if test "@ssllib@" = "openssl" @@ -35,7 +35,7 @@ exit 1 } -cd @mydatadir@ +cd @certsdir@ umask 077 BITS="$BITS" set -e @@ -50,7 +50,7 @@ -config @sysconfdir@/esmtpd.cnf -out "$PEMFILE" -keyout "$PEMFILE" || cleanup @OPENSSL@ dhparam -2 -rand "$PEMFILE".rand 512 >>"$PEMFILE" || cleanup @OPENSSL@ x509 -subject -dates -fingerprint -noout -in "$PEMFILE" || cleanup - rm -f @mydatadir@/esmtpd.rand + rm -f @certsdir@/esmtpd.rand else if test "$BITS" = "" then --- courier-0.78.2.orig/courier/pop3d-ssl.in 2010-05-08 23:30:54.612778263 +0200 +++ courier-0.78.2/courier/pop3d-ssl.in 2010-05-08 23:31:10.355976183 +0200 @@ -29,6 +29,11 @@ case $1 in start) + # If we do not have a certificate, make one up. + if [ ! -f @certsdir@/pop3d.pem ]; then + @sbindir@/mkpop3dcert + fi + exec @SETENV@ -i PATH="$PATH" SHELL="$SHELL" \ @SHELL@ -c " set -a ; \ prefix=@prefix@ ; \ --- courier-0.78.2.orig/courier.sysvinit.in 2010-05-08 23:30:54.612778263 +0200 +++ courier-0.78.2/courier.sysvinit.in 2010-05-08 23:31:10.355976183 +0200 @@ -18,7 +18,7 @@ sbindir="@sbindir@" bindir="@bindir@" libexecdir="@libexecdir@" -datadir="@datadir@" +certsdir="@certsdir@" if test ! -f ${sysconfdir}/esmtpd then @@ -85,7 +85,7 @@ then # If we do not have a certificate, make one up. - if test ! -f ${datadir}/esmtpd.pem + if test ! -f ${certsdir}/esmtpd.pem then if test -x $COURIERTLS then @@ -152,7 +152,7 @@ then # If we do not have a certificate, make one up. - if test ! -f ${datadir}/pop3d.pem + if test ! -f ${certsdir}/pop3d.pem then echo -n " generating-POP3-SSL-certificate..." @@ -182,7 +182,7 @@ then # If we do not have a certificate, make one up. - if test ! -f ${datadir}/imapd.pem + if test ! -f ${certsdir}/imapd.pem then echo -n " generating-IMAP-SSL-certificate..."