From 302f649f00b0001e2c5360a0ca2b88321123157f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Pialasse Date: Mon, 16 Dec 2024 23:21:59 -0500 Subject: [PATCH] * Mon Nov 25 2024 Jean-Philippe Pialasse 11.0.0-10.sme - make compatible for postfix [SME: 1279] use postfix queue, qmail queue removed copy templates of rcpthosts to (us)qpsmtpd for rcpt_ok copy templates of smtproutes to (us)qpsmtpd for check_smtp_forward --- createlinks | 18 ++++++++++++ .../config/plugins/90queue-postfix-queue | 1 + .../config/plugins/90queue-qmail-queue | 5 ---- .../qpsmtpd/config/rcpthosts/10standard | 14 ++++++++++ .../qpsmtpd/config/rcpthosts/12LiteralIP | 5 ++++ .../qpsmtpd/config/smtproutes/00README | 25 +++++++++++++++++ .../config/smtproutes/10delegateMailServer | 17 +++++++++++ .../qpsmtpd/config/smtproutes/20SMTPSmartHost | 28 +++++++++++++++++++ smeserver-qpsmtpd.spec | 9 ++++-- 9 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/90queue-postfix-queue delete mode 100644 root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/90queue-qmail-queue create mode 100644 root/etc/e-smith/templates/var/service/qpsmtpd/config/rcpthosts/10standard create mode 100644 root/etc/e-smith/templates/var/service/qpsmtpd/config/rcpthosts/12LiteralIP create mode 100644 root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/00README create mode 100644 root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/10delegateMailServer create mode 100644 root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/20SMTPSmartHost diff --git a/createlinks b/createlinks index 1f054cd..3833d2b 100644 --- a/createlinks +++ b/createlinks @@ -93,6 +93,24 @@ for $daemon ( qw(qpsmtpd sqpsmtpd uqpsmtpd) ) tls_protocols )); + templates2events("$config/$_", qw( + console-save + bootstrap-console-save + domain-create + domain-delete + ip-change + email-update + host-create + host-delete + host-modify + post-upgrade + smeserver-qpsmtpd-update + )) + for (qw( + rcpthosts + smtproutes + )); + templates2events("$config/badrcptto_ext", qw( domain-create domain-delete diff --git a/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/90queue-postfix-queue b/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/90queue-postfix-queue new file mode 100644 index 0000000..f2b0f52 --- /dev/null +++ b/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/90queue-postfix-queue @@ -0,0 +1 @@ +queue/postfix-queue FLAG_MASK_EXTERNAL diff --git a/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/90queue-qmail-queue b/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/90queue-qmail-queue deleted file mode 100644 index 86da349..0000000 --- a/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/90queue-qmail-queue +++ /dev/null @@ -1,5 +0,0 @@ -{ - #return "# DelegateMailServer set" if $DelegateMailServer; - - return "queue/qmail-queue"; -} diff --git a/root/etc/e-smith/templates/var/service/qpsmtpd/config/rcpthosts/10standard b/root/etc/e-smith/templates/var/service/qpsmtpd/config/rcpthosts/10standard new file mode 100644 index 0000000..4121442 --- /dev/null +++ b/root/etc/e-smith/templates/var/service/qpsmtpd/config/rcpthosts/10standard @@ -0,0 +1,14 @@ +{ + use esmith::DomainsDB; + + my $ddb = esmith::DomainsDB->open_ro or die "Couldn't open DomainsDB\n"; + + my @rcpt_hosts = ( "$SystemName.$DomainName" ); + + foreach my $domain ( $ddb->get_all_by_prop( type => "domain" ) ) + { + push @rcpt_hosts, $domain->key; + } + + $OUT = join "\n", @rcpt_hosts; +} diff --git a/root/etc/e-smith/templates/var/service/qpsmtpd/config/rcpthosts/12LiteralIP b/root/etc/e-smith/templates/var/service/qpsmtpd/config/rcpthosts/12LiteralIP new file mode 100644 index 0000000..e55b368 --- /dev/null +++ b/root/etc/e-smith/templates/var/service/qpsmtpd/config/rcpthosts/12LiteralIP @@ -0,0 +1,5 @@ +{ + return "" unless (defined $ExternalIP); + + return "[$ExternalIP]"; +} diff --git a/root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/00README b/root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/00README new file mode 100644 index 0000000..0df6333 --- /dev/null +++ b/root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/00README @@ -0,0 +1,25 @@ +{ + # + # qmail's smtproutes mechanism works such that the LAST BEST match + # found in /var/qmail/control/smtproutes will be used in preference + # to any other entry. + # + # Consider the following /var/qmail/control/smtproutes example: + # + # :smarthost.somewhere + # domain.place:some.host + # domain.place:other.host + # :some.other.smarthost.elsewhere + # + # Mail for user@domain.place will ALWAYS be delivered to + # other.host. The entry for some.host will NEVER be used. + # + # Mail for any other domain will ALWAYS be delivered to + # some.other.smarthost.elsewhere. The entry for smarthost.somewhere + # will NEVER be used. + # + # Therefore, if you wish to make any customisations to the + # /var/qmail/control/smtproutes templates, you must ensure that they + # appear AFTER the standard e-smith template entries. + # +} diff --git a/root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/10delegateMailServer b/root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/10delegateMailServer new file mode 100644 index 0000000..9db9c1f --- /dev/null +++ b/root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/10delegateMailServer @@ -0,0 +1,17 @@ +{ + $OUT = ""; + + use esmith::DomainsDB; + my $ddb = esmith::DomainsDB->open_ro(); + + for my $domain ( $ddb->domains ) + { + my $mail_server = $domain->prop('MailServer') + || $DelegateMailServer + || 'localhost'; + + next if ( $mail_server eq 'localhost' ); + + $OUT .= $domain->key . ":$mail_server\n"; + } +} diff --git a/root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/20SMTPSmartHost b/root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/20SMTPSmartHost new file mode 100644 index 0000000..cd7def9 --- /dev/null +++ b/root/etc/e-smith/templates/var/service/qpsmtpd/config/smtproutes/20SMTPSmartHost @@ -0,0 +1,28 @@ +{ + $OUT = ""; + + #-------------------------------------------------- + # Now check for SMTP smart host + #-------------------------------------------------- + + if ( + $SMTPSmartHost + && + ($SMTPSmartHost ne 'off') + && + ($SMTPSmartHost !~ /^\s*$/) + ) + { + # Is the smtp-auth-proxy enabled? + if (${'smtp-auth-proxy'}{'status'} eq 'enabled') + { + $OUT .= ":localhost:26"; + } + else + { + $OUT .= ":$SMTPSmartHost"; + } + } + + chomp ($OUT); +} diff --git a/smeserver-qpsmtpd.spec b/smeserver-qpsmtpd.spec index 3e5130f..64c6997 100644 --- a/smeserver-qpsmtpd.spec +++ b/smeserver-qpsmtpd.spec @@ -4,7 +4,7 @@ Summary: SME Server qpsmtpd module %define name smeserver-qpsmtpd Name: %{name} %define version 11.0.0 -%define release 9 +%define release 10 Version: %{version} Release: %{release}%{?dist} License: GPL @@ -21,7 +21,6 @@ Requires: perl(Net::IMAP::Simple) >= 1.2212 Requires: qpsmtpd-plugins >= 0.0.1-sme04 Requires: ipsvd Requires: smeserver-lib >= 1.16.0-08 -#Requires: smeserver-cvm-unix-local Requires: smeserver-clamav >= 2.7.0 Obsoletes: e-smith-obtuse-smtpd Obsoletes: e-smith-qmail-smtpd @@ -46,6 +45,12 @@ AutoReqProv: no SME Server qpsmtpd smtpd module %changelog +* Mon Nov 25 2024 Jean-Philippe Pialasse 11.0.0-10.sme +- make compatible for postfix [SME: 1279] + use postfix queue, qmail queue removed + copy templates of rcpthosts to (us)qpsmtpd for rcpt_ok + copy templates of smtproutes to (us)qpsmtpd for check_smtp_forward + * Mon Oct 21 2024 Jean-Philippe Pialasse 11.0.0-9.sme - fix configuration for auth per deamon [SME: 12451] - remove deamontools requirement [SME: 12615]