6 Commits

Author SHA1 Message Date
fddc92eb16 * Sun Dec 15 2024 Jean-Philippe Pialasse <jpp@koozali.org> 1.0-6.sme
- add mini-qmail as Message delivery agent  [SME: 12737]
  few other fixes; +x on needed executable files
  migrate old qmail properties used in postfix
  catch all non existing recipient / check BCC working
2024-12-17 07:05:35 -05:00
77135e244f readme 2024-12-17 01:04:17 -05:00
df66a327cc * Sun Dec 15 2024 Jean-Philippe Pialasse <jpp@koozali.org> 1.0-5.sme
- add mini-qmail as Message delivery agent  [SME: 12737]
  few other fixes; +x on needed executable files
  migrate old qmail properties used in postfix
  catch all non existing recipient / check BCC working
2024-12-17 00:30:48 -05:00
0e6e82c9a1 * Sun Dec 15 2024 Jean-Philippe Pialasse <jpp@koozali.org> 1.0-5.sme
- add mini-qmail as Message delivery agent  [SME: 12737]
  few other fixes; +x on needed executable files
  migrate old qmail properties used in postfix
  catch all non existing recipient / check BCC working
2024-12-16 17:14:34 -05:00
0cec86dcb7 * Sun Dec 15 2024 Jean-Philippe Pialasse <jpp@koozali.org> 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
2024-12-15 16:10:49 -05:00
f2b33f4260 install procedure 2024-11-19 16:06:13 -05:00
19 changed files with 112 additions and 52 deletions

View File

@@ -20,51 +20,32 @@ Show list of outstanding bugs:
Koozali SME Server wrapper to configure postfix
## Development and testing
```
mkdir -p /etc/e-smith/templates-custom/var/service/{qpsmtpd,sqpsmtpd,uqpsmtpd}/config/peers/{0,local}/90queue-qmail-queue
echo 'queue/postfix-queue' > /etc/e-smith/templates-custom/var/service/{qpsmtpd,sqpsmtpd,uqpsmtpd}/config/peers/{0,local}/90queue-qmail-queue
config setprop qmail status disabled
systemctl stop qmail
signal-event email-update
dnf install smeserver-postfix
```
then test
```
echo "This email confirms that Postfix is working" | mail -s "Testing Posfix" emailuser@example.com
```
or using roundcube/ mail client
to remove
```
rm -rf /etc/e-smith/templates-custom/var/service/{qpsmtpd,sqpsmtpd,uqpsmtpd}/config/peers/{0,local}/
config setprop qmail status enabled
systemctl start qmail
signal-event email-update
dnf remove smeserver-postfix
```
DONE
* main domain
* listen only socket
* virtual alias for system, pseudonyms, groups, shared
* forward email support via .qmail
* spam filtering to .junk
* .qmail support using mini-qmail + wrapper and seakablepipe
* maildrop/procmail support directly via .qmail
* check /usr/sbin/sendmail -> /etc/alternatives/mta -> /usr/sbin/sendmail.postfix
* EmailUnknownUser support in virtual
* migrate and remove qmail properties to postfix
* make a copy of /var/qmail/control/smtproutes to (su)qpsmtpd/config/smtproutes
TODO
* regression: forward email support via .qmail or .forward
* regression: spam filtering to .junk
* regression: .qmail support or alternative via .forward
* regression: maildrop/procmail support directly or via .forward or via .qmail support
* regression: EmailUnknownUser support ( we can not use luser_relay as we use virtual_alias (this might need to add all unix accoutns in this virtual map and also all needed content of /etc/aliases when not returntosender)
* switch smeserver-qpsmtpd support to postfix
* check /usr/sbin/sendmail -> /etc/alternatives/mta -> /usr/sbin/sendmail.postfix upon removal/update of qmail
* .foward support
* remove from smeserver-mail /usr/local/sbin/smtp-auth-proxy.pl
* migrate and rewrite code for smtp-auth-proxy properties
* migrate and remove qmail properties to postfix
* make a copy of qmail/config/smtproutes to (su)qpsmtpd/config/smtproutes
FUTURE
* .foward support, when/if .qmail support is dropped
* ldap / AD user support
* throttle for some destination
TO CHECK
$prop->{Blacklist} = $smtp_proxy_rec->prop('Blacklist') || " ";
@@ -80,11 +61,11 @@ domain
config
* DelegateMailServer
* SMTPSmartHost
* qmail/postfix->MaxMessageSize defined as 15Mb
* qmail/postfix->FilterType (empty)
* qmail/postfix->ConcurrencyRemote default to 20
* qmail/postfix->ConcurrencyLocal default to 20
* qmail/postfix->DoubleBounceTo default to postmaster
* postfix->MaxMessageSize defined as 15Mb
* postfix->FilterType (empty)
* postfix->ConcurrencyRemote default to 20
* postfix->ConcurrencyLocal default to 20
* postfix->DoubleBounceTo default to postmaster
* postfix->tls_security_level default to may
* postfix->tls_enforce_peername default to yes
* $qpsmtpd{HeloHost} default to $myhostname
@@ -95,6 +76,7 @@ config
* EmailUnknownUser (default to returntosender)
REFERENCES
* https://unix.stackexchange.com/questions/93197/postfix-configuration-to-verify-all-recipients
* https://phoenixnap.com/kb/postfix-smtp
* https://www.gentei.org/~yuuji/software/dotqmail/
* https://www.gentei.org/~yuuji/software/dotqmail/dotqmail

View File

@@ -0,0 +1,14 @@
{
# migrate qmail -> postfix MaxMessageSize FilterType ConcurrencyRemote ConcurrencyLocal DoubleBounceTo
# we keep qmail as MDA so we can leave DeliveryType DeliveryInstruction
for ( qw( MaxMessageSize FilterType ConcurrencyRemote ConcurrencyLocal DoubleBounceTo) ) {
my $sa = $DB->get('qmail') or next;
my $value=$DB->get_prop_and_delete('qmail',$_) or next;
next if (exists $postfix{$_});
$DB->set_prop('postfix', $_ , $value);
}
# TODO we migrate smtp-auth-proxy ; SMTPSmartHost Userid Passwd PeerPort
}

View File

@@ -0,0 +1 @@
compatibility_level=2

View File

@@ -1 +1,2 @@
myorigin = $mydomain
append_at_myorigin = yes

View File

@@ -4,7 +4,7 @@
my $display = 0;
use esmith::DomainsDB;
my $domainsdb = esmith::DomainsDB->open_ro();
for my $domain ($domainsdb->domains)
for my $domain ($domainsdb->get_all)
{
my $mail_server = $domain->prop('MailServer')
|| $DelegateMailServer

View File

@@ -0,0 +1,7 @@
{
# we use the value of EmailUnknownUser (default to returntosender)
# this option night ignore all virtual_maps entries... like pseudonyms and groups in case of virtual domain
# see /etc/e-smith/templates//etc/postfix/virtual/95unknownusers
#return "# we bounce all unknown address $EmailUnknownUser not set or equal to returntosender " unless (defined $EmailUnknownUser and $EmailUnknownUser ne 'returntosender');
#$OUT ="luser_relay = $EmailUnknownUser";
}# if enabled, we catch all unknown users in virtual

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1 @@
628 inet n - n - - qmqpd

View File

@@ -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

View File

@@ -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}

View File

@@ -6,7 +6,7 @@
for my $domain ($domainsdb->domains)
for my $domain ($domainsdb->get_all)
{
my $mail_server = $domain->prop('MailServer')

View File

@@ -1,3 +1,2 @@
# SME users
# not needed postfix will map all system users directly

View File

@@ -0,0 +1,16 @@
{
# as we might have virtualdomains we prefer this over luser_relay
return "# we bounce all unknown address $EmailUnknownUser not set or equal to returntosender " unless (defined $EmailUnknownUser and $EmailUnknownUser ne 'returntosender');
$OUT = "";
my $i = 0;
use esmith::DomainsDB;
my $ddb = esmith::DomainsDB->open_ro;
my @domains = map { $_->key } $ddb->get_all_by_prop('type' => 'domain');
foreach my $domain ( @domains )
{
my $d = $ddb->get($domain);
next if (($d->prop('VirtualMail') || "disabled") eq "enabled");
next unless (($d->prop('MailServer') || '') eq '');
$OUT .= "\@$domain $EmailUnknownUser\n";
}
}

View File

@@ -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/}

View File

@@ -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

View File

@@ -1,6 +1,9 @@
[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
SyslogIdentifier=postfix
[Install]
WantedBy=sme-server.target

View File

@@ -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>&-

View File

@@ -1,6 +1,6 @@
%define name smeserver-postfix
%define version 1.0
%define release 3
%define release 6
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 <jpp@koozali.org> 1.0-6.sme
- add mini-qmail as Message delivery agent [SME: 12737]
few other fixes; +x on needed executable files
migrate old qmail properties used in postfix
catch all non existing recipient / check BCC working
* Tue Nov 19 2024 Jean-Philippe Pialasse <jpp@koozali.org> 1.0-3.sme
- add requirements [SME: 12737]
- add conf-postfix
@@ -57,10 +64,10 @@ rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--file /sbin/e-smith/systemd/postfix-reload 'attr(750,root,root)' \
--file /sbin/e-smith/systemd/postfix-pre 'attr(750,root,root)' \
--file /usr/bin/dotqmail 'attr(0555,root,root)' \
--file /usr/bin/postqmail-local 'attr(0555,root,root)' \
--file /usr/local/bin/seekablepipe 'attr(0555,root,root)' \
> %{name}-%{version}-filelist
#echo "%doc COPYING" >> %{name}-%{version}-filelist
#--dir <dir> 'attr(755,user,grp)' \
#--file <file> 'attr(755,root,root)' \
%clean
cd ..