From 0cec86dcb7c3198738912f1c1d9235da53d3f174 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Pialasse Date: Sun, 15 Dec 2024 16:10:49 -0500 Subject: [PATCH] * Sun Dec 15 2024 Jean-Philippe Pialasse 1.0-4.sme - add mini-qmail as Message delivery agent [SME: 12737] few other fixes TODO migrate old qmail properties and change in template TODO catch all non existing recipient / check BCC working --- .../templates/etc/postfix/main.cf/05compat | 1 + .../templates/etc/postfix/main.cf/80qmail | 22 +++++++++++++++++++ .../templates/etc/postfix/master.cf/20smtp | 2 -- .../templates/etc/postfix/master.cf/34qmqpd | 1 + .../templates/etc/postfix/master.cf/35content | 1 - .../templates/etc/postfix/master.cf/36qmail | 4 ++++ root/usr/bin/dotqmail | 2 +- root/usr/bin/postqmail-local | 5 ++--- .../system/postfix.service.d/50koozali.conf | 4 +++- root/usr/local/bin/seekablepipe | 7 ++++++ smeserver-postfix.spec | 9 +++++++- 11 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 root/etc/e-smith/templates/etc/postfix/main.cf/05compat create mode 100644 root/etc/e-smith/templates/etc/postfix/main.cf/80qmail create mode 100644 root/etc/e-smith/templates/etc/postfix/master.cf/34qmqpd create mode 100644 root/etc/e-smith/templates/etc/postfix/master.cf/36qmail create mode 100644 root/usr/local/bin/seekablepipe diff --git a/root/etc/e-smith/templates/etc/postfix/main.cf/05compat b/root/etc/e-smith/templates/etc/postfix/main.cf/05compat new file mode 100644 index 0000000..895791f --- /dev/null +++ b/root/etc/e-smith/templates/etc/postfix/main.cf/05compat @@ -0,0 +1 @@ +compatibility_level=2 diff --git a/root/etc/e-smith/templates/etc/postfix/main.cf/80qmail b/root/etc/e-smith/templates/etc/postfix/main.cf/80qmail new file mode 100644 index 0000000..69059b0 --- /dev/null +++ b/root/etc/e-smith/templates/etc/postfix/main.cf/80qmail @@ -0,0 +1,22 @@ +# qmail local delivery{ + +## alternatively we could set a db with per user delivery + +# mailbox_command_maps = hash:/etc/postfix/mailbox_commands + +## in /etc/postfix/mailbox_commands +# # These users need qmail-local delivery. +# johndoe /usr/local/libexec/postqmail-local +# janedoe /usr/local/libexec/postqmail-local + +########################################### +# alternatively we could ask dovecot to handle the delivery +#mailbox_command = /usr/libexec/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT" -d "$USER" +# then sieve rules are needed + +# maildrop or procmail could do to .... +} +prepend_delivered_header = file, forward +mailbox_command = /usr/bin/postqmail-local +# qmail needs to forward to qmqpd +qmqpd_authorized_clients = 127.0.0.1 diff --git a/root/etc/e-smith/templates/etc/postfix/master.cf/20smtp b/root/etc/e-smith/templates/etc/postfix/master.cf/20smtp index 9e23cb6..eb38cb2 100644 --- a/root/etc/e-smith/templates/etc/postfix/master.cf/20smtp +++ b/root/etc/e-smith/templates/etc/postfix/master.cf/20smtp @@ -1,5 +1,3 @@ -#2525 inet n - n - - smtpd -# :25 is in use by qpsmtpd #smtp inet n - n - - smtpd #smtp inet n - n - 1 postscreen #smtpd pass - - n - - smtpd diff --git a/root/etc/e-smith/templates/etc/postfix/master.cf/34qmqpd b/root/etc/e-smith/templates/etc/postfix/master.cf/34qmqpd new file mode 100644 index 0000000..077ad05 --- /dev/null +++ b/root/etc/e-smith/templates/etc/postfix/master.cf/34qmqpd @@ -0,0 +1 @@ +628 inet n - n - - qmqpd diff --git a/root/etc/e-smith/templates/etc/postfix/master.cf/35content b/root/etc/e-smith/templates/etc/postfix/master.cf/35content index 6c8ea3c..c1fa726 100644 --- a/root/etc/e-smith/templates/etc/postfix/master.cf/35content +++ b/root/etc/e-smith/templates/etc/postfix/master.cf/35content @@ -1,4 +1,3 @@ -#628 inet n - n - - qmqpd pickup unix n - n 60 1 pickup cleanup unix n - n - 0 cleanup qmgr unix n - n 300 1 qmgr diff --git a/root/etc/e-smith/templates/etc/postfix/master.cf/36qmail b/root/etc/e-smith/templates/etc/postfix/master.cf/36qmail new file mode 100644 index 0000000..7a721f5 --- /dev/null +++ b/root/etc/e-smith/templates/etc/postfix/master.cf/36qmail @@ -0,0 +1,4 @@ +# qmail need to test for virtual boxes +qmail-local unix - n n - - pipe + user=$USER argv=/usr/bin/sudo -u $user -H /usr/bin/postqmail-local ${mailbox} ${extension} ${nexthop} ${sender} + diff --git a/root/usr/bin/dotqmail b/root/usr/bin/dotqmail index d7202f8..1758437 100644 --- a/root/usr/bin/dotqmail +++ b/root/usr/bin/dotqmail @@ -7,7 +7,7 @@ dotqm=${DOTQMAIL:-.qmail} DQHOME=${DQHOME:-$HOME} cd $DQHOME DEFAULTSPOOL=./Maildir/ -PATH=${PATH}:/usr/sbin:/usr/lib; export PATH +PATH=${PATH}:/usr/sbin:/usr/lib:/var/qmail/bin; export PATH if [ -s $DQHOME/.dotqmailexts ]; then while IFS=: read ext home; do home=${home/\~\//$HOME/} diff --git a/root/usr/bin/postqmail-local b/root/usr/bin/postqmail-local index e5ece0a..b3a6146 100644 --- a/root/usr/bin/postqmail-local +++ b/root/usr/bin/postqmail-local @@ -5,9 +5,8 @@ # $3 = $DOMAIN # $4 = $SENDER export PATH=$PATH:/usr/local/bin:/var/qmail/bin -tail +2 | seekablepipe qmail-local -- \ - "$USER" "$HOME" "$LOCAL" "${EXTENSION:+-}" "$EXTENSION" - "$DOMAIN""$SENDER" ./Maildir/ +tail -n +2 | /usr/local/bin/seekablepipe qmail-local -- \ + "$USER" "$HOME" "$LOCAL" "${EXTENSION:+-}" "$EXTENSION" "$DOMAIN" "$SENDER" ./Maildir/ e=$? (($e == 111)) && exit 75 (($e == 100)) && exit 77 diff --git a/root/usr/lib/systemd/system/postfix.service.d/50koozali.conf b/root/usr/lib/systemd/system/postfix.service.d/50koozali.conf index 3b2b7bf..4aea51b 100644 --- a/root/usr/lib/systemd/system/postfix.service.d/50koozali.conf +++ b/root/usr/lib/systemd/system/postfix.service.d/50koozali.conf @@ -1,6 +1,8 @@ [Service] -ExecStartPre=-/usr/sbin/postmap /etc/postfix/virtual ExecStartPre=/sbin/e-smith/service-status postfix +ExecStartPre=/sbin/e-smith/systemd/postfix-pre +ExecReload= +ExecReload=/sbin/e-smith/systemd/postfix-reload [Install] WantedBy=sme-server.target diff --git a/root/usr/local/bin/seekablepipe b/root/usr/local/bin/seekablepipe new file mode 100644 index 0000000..de98393 --- /dev/null +++ b/root/usr/local/bin/seekablepipe @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +tmp=/var/tmp/seekable.$$ +exec 3<&0 4<&1 >$tmp <$tmp +rm $tmp +cat <&3 +exec ${1+"$@"} 1<&4 3>&- 4>&- diff --git a/smeserver-postfix.spec b/smeserver-postfix.spec index 40eff37..818032b 100644 --- a/smeserver-postfix.spec +++ b/smeserver-postfix.spec @@ -1,6 +1,6 @@ %define name smeserver-postfix %define version 1.0 -%define release 3 +%define release 4 Summary: This is what smeserver-postfix does. Name: %{name} Version: %{version} @@ -17,12 +17,19 @@ Requires: postfix Requires: postfix-perl-scripts Requires: postfix-pcre Requires: zsh +Requires: smeserver-mini-qmail AutoReqProv: no %description Koozali SME Server wrapper to configure postfix %changelog +* Sun Dec 15 2024 Jean-Philippe Pialasse 1.0-4.sme +- add mini-qmail as Message delivery agent [SME: 12737] + few other fixes + TODO migrate old qmail properties and change in template + TODO catch all non existing recipient / check BCC working + * Tue Nov 19 2024 Jean-Philippe Pialasse 1.0-3.sme - add requirements [SME: 12737] - add conf-postfix