Hi,
Is there any way to disable Dovecot LDA? I want to always send email via postfix and relay server even it will be a local delivery within the Dovecot server
Thanks, Adam
On 31/03/2020 19:35 Adam Raszkiewicz <araszkiewicz@medallies.com> wrote:
Hi,
Is there any way to disable Dovecot LDA? I want to always send email via postfix and relay server even it will be a local delivery within the Dovecot server
Dovecot LDA is fully optional. Just don't use it in postfix configuration
Aki
Thanks,
Adam
But then it loops again when get back to the postfix as an incoming message (doesn't know that abcd@localdomain.com is located on that Dovecot)
<https://img.newoldstamp.com/r/292975/p> Adam Raszkiewicz
p: 845.896.0191 e: araszkiewicz@medallies.com w: www.medallies.com <http://www.medallies.com/main.html>
<https://img.newoldstamp.com/r/292975/twitter> <https://img.newoldstamp.com/r/292975/linkedin> <https://img.newoldstamp.com/r/292975/instagram>
<https://img.newoldstamp.com/r/292975/b>
This communication and any files or attachments transmitted with it may contain information that is confidential, privileged and exempt from disclosure under applicable law. It is intended solely for the use of the individual or the entity to which it is addressed. If you are not the intended recipient, you are hereby notified that any use, dissemination, or copying of this communication is strictly prohibited by federal law. If you have received this communication in error, please destroy it and notify the sender.
On 3/31/20, 1:45 PM, "dovecot on behalf of Aki Tuomi" <dovecot-bounces@dovecot.org on behalf of aki.tuomi@open-xchange.com> wrote:
> On 31/03/2020 19:35 Adam Raszkiewicz <araszkiewicz@medallies.com> wrote:
>
>
>
> Hi,
>
>
> Is there any way to disable Dovecot LDA? I want to always send email via postfix and relay server even it will be a local delivery within the Dovecot server
>
Dovecot LDA is fully optional. Just don't use it in postfix configuration
Aki
>
> Thanks,
>
> Adam
But then it loops again when get back to the postfix as an incoming message (doesn't know that abcd@localdomain.com is located on that Dovecot)
On Dienstag, 31. März 2020 21:14:26 CEST Adam Raszkiewicz wrote: +
Is there any way to disable Dovecot LDA? I want to always send email via postfix and relay server even it will be a local delivery within the Dovecot server
Thanks, Adam
Why should a disabled LDA or a relayhost help in this matter? Honestly, who is sending what to where anyway?
I mean Dovecot is an IMAP-Server: It receives emails from Postfix and mailclients connect to Dovecot to get these mails. When a mailclient sends an email it connects to Postfix not to Dovecot, so a delivery "within Dovecot" isn't really happening. Dovecot's LDA has options to send (bounce) mails back to Postfix. I guess loops occur there?
WHO doesn't know that abcd@localdomain.com is located on Dovecot -- Dovecot itself (= unknown recipient or perhaps permission problems while saving the mail) or Postfix (= no transport to Dovecot)?
Martin
Desired flow looks like:
Dovecot ---------------------> Postfix --> Relay Server -┐ Dovecot <-- LMTP/LDA <-- Postfix <---------------------┘
Top part of that flow works fine - a message will get to the relay server and it will be send back to the postfix for a local delivery but then it will start to loop back to the relay server instead hand over to LMTP/LDA.
For some reason Postfix doesn't know that abcd@localdomain.com is located on Dovecot and it will try to send it back to the relay server. I have the same problem explained here: https://serverfault.com/questions/1010325/postfix-via-relay-server-and-lmtp-...
Thanks for any help! ~Adam
On 4/1/20, 6:45 PM, "dovecot on behalf of Dauser Martin Johannes" <dovecot-bounces@dovecot.org on behalf of mdauser@cs.sbg.ac.at> wrote:
On Dienstag, 31. März 2020 21:14:26 CEST Adam Raszkiewicz wrote:
> But then it loops again when get back to the postfix as an incoming message
> (doesn't know that abcd@localdomain.com is located on that Dovecot)
+
> Is there any way to disable Dovecot LDA? I want to always send email via
> postfix and relay server even it will be a local delivery within the Dovecot
> server
>
>Thanks,
>Adam
Why should a disabled LDA or a relayhost help in this matter? Honestly, who is
sending what to where anyway?
I mean Dovecot is an IMAP-Server: It receives emails from Postfix and
mailclients connect to Dovecot to get these mails. When a mailclient sends an
email it connects to Postfix not to Dovecot, so a delivery "within Dovecot"
isn't really happening. Dovecot's LDA has options to send (bounce) mails back
to Postfix. I guess loops occur there?
WHO doesn't know that abcd@localdomain.com is located on Dovecot -- Dovecot
itself (= unknown recipient or perhaps permission problems while saving the
mail) or Postfix (= no transport to Dovecot)?
Martin
On Thu, 2 Apr 2020 13:18:14 +0000, Adam Raszkiewicz stated:
Desired flow looks like:
Dovecot ---------------------> Postfix --> Relay Server -┐ Dovecot <-- LMTP/LDA <-- Postfix <---------------------┘
Top part of that flow works fine - a message will get to the relay server and it will be send back to the postfix for a local delivery but then it will start to loop back to the relay server instead hand over to LMTP/LDA.
For some reason Postfix doesn't know that abcd@localdomain.com is located on Dovecot and it will try to send it back to the relay server. I have the same problem explained here: https://serverfault.com/questions/1010325/postfix-via-relay-server-and-lmtp-...
Thanks for any help! ~Adam
On 4/1/20, 6:45 PM, "dovecot on behalf of Dauser Martin Johannes" <dovecot-bounces@dovecot.org on behalf of mdauser@cs.sbg.ac.at> wrote:
But then it loops again when get back to the postfix as an incoming message (doesn't know that abcd@localdomain.com is located on that Dovecot)
On Dienstag, 31. März 2020 21:14:26 CEST Adam Raszkiewicz wrote: +
Is there any way to disable Dovecot LDA? I want to always send email via postfix and relay server even it will be a local delivery within the Dovecot server
Thanks, Adam
Why should a disabled LDA or a relayhost help in this matter? Honestly, who is sending what to where anyway?
I mean Dovecot is an IMAP-Server: It receives emails from Postfix and mailclients connect to Dovecot to get these mails. When a mailclient sends an email it connects to Postfix not to Dovecot, so a delivery "within Dovecot" isn't really happening. Dovecot's LDA has options to send (bounce) mails back to Postfix. I guess loops occur there? WHO doesn't know that abcd@localdomain.com is located on Dovecot -- Dovecot itself (= unknown recipient or perhaps permission problems while saving the mail) or Postfix (= no transport to Dovecot)?
Martin
This question really belongs on the 'postfix' forum. Have you read <http://www.postfix.org/DEBUG_README.html> or better still, <http://www.postfix.org/DEBUG_README.html#mail>. The "postfinger" tool is the best way.
-- Jerry
On 02/04/2020 15:18, Adam Raszkiewicz wrote:
Desired flow looks like:
Dovecot ---------------------> Postfix --> Relay Server -┐ Dovecot <-- LMTP/LDA <-- Postfix <---------------------┘
This mail flow cannot work with one Postfix instance. Either Postfix knows that "localdomain.com" is local and should be delivered to the LDA, in which case it won't be forwarded to the relay server, or Postfix does not know that "localdomain.com" is a local address and therefor forwards it the relay server, but than it will do that anytime it sees "localdomain.com".
Only possibility is to run two instances of Postfix.
The real question is: Why do you want this mail flow? Where is the benefit in sending a local mail out to a relay server only to get it back and deliver it?
Cheers, Juri
So there is no way to skip Postfix for incoming messages and go directly to LMTP/LDA but I need two instances of Postfix in that case?
Regarding your second question - it is required to be complaint with Direct Trust.
Thanks, Adam
On 4/2/20, 3:07 PM, "dovecot on behalf of Juri Haberland" <dovecot-bounces@dovecot.org on behalf of juri@koschikode.com> wrote:
On 02/04/2020 15:18, Adam Raszkiewicz wrote:
> Desired flow looks like:
>
> Dovecot ---------------------> Postfix --> Relay Server -┐
> Dovecot <-- LMTP/LDA <-- Postfix <---------------------┘
This mail flow cannot work with one Postfix instance. Either Postfix
knows that "localdomain.com" is local and should be delivered to the
LDA, in which case it won't be forwarded to the relay server, or Postfix
does not know that "localdomain.com" is a local address and therefor
forwards it the relay server, but than it will do that anytime it sees
"localdomain.com".
Only possibility is to run two instances of Postfix.
The real question is:
Why do you want this mail flow? Where is the benefit in sending a local
mail out to a relay server only to get it back and deliver it?
Cheers,
Juri
If both postfix’ in your example are the same server, then that’s not possible indeed. Consider it has one brain, so it has to decide: Do I know this domain or do I need to send it upstream (either to the MX of the target domain, or to a configured relay).
In case it’s a domain postfix hosts, a delivery attempt will be made directly via LMTP/LDA. It does not go out (since it’s known local).
In case the domain is not hosted locally, it will be forwarded to a relay, and that has to decide where to send it next. If your machine is the best known option for the target domain, then it will be send there. But if that is the same postfix server, that’s an issue: because the domain is not known locally ,and thus it should be rejected. Message = lost.
In case you have 2 postfix instances, where A is on the top side of your image, then it can be configured to route all email to relay, and that has a configuration that send’s it to instance B (the bottom); that can have configuration that treats the target domain as local, and thus starts an delivery attempt to LMTP/LDA.
Does that help a bit?
Cheers Remko
On 2 Apr 2020, at 21:29, Adam Raszkiewicz <araszkiewicz@medallies.com> wrote:
So there is no way to skip Postfix for incoming messages and go directly to LMTP/LDA but I need two instances of Postfix in that case?
Regarding your second question - it is required to be complaint with Direct Trust.
Thanks, Adam
On 4/2/20, 3:07 PM, "dovecot on behalf of Juri Haberland" <dovecot-bounces@dovecot.org on behalf of juri@koschikode.com> wrote:
On 02/04/2020 15:18, Adam Raszkiewicz wrote:
Desired flow looks like:
Dovecot ---------------------> Postfix --> Relay Server -┐ Dovecot <-- LMTP/LDA <-- Postfix <---------------------┘
This mail flow cannot work with one Postfix instance. Either Postfix knows that "localdomain.com" is local and should be delivered to the LDA, in which case it won't be forwarded to the relay server, or Postfix does not know that "localdomain.com" is a local address and therefor forwards it the relay server, but than it will do that anytime it sees "localdomain.com".
Only possibility is to run two instances of Postfix.
The real question is: Why do you want this mail flow? Where is the benefit in sending a local mail out to a relay server only to get it back and deliver it?
Cheers, Juri
Well as you need LDA to deliver emails from postfix to dovecot, you can't just turn it off. What you need is a second smtp daemon within postfix, which is only responsible for local originating emails and is configured to send any email to your gateway. This way your second smtpd will send local generated mails to your gateway. The gateway will send those mails back to your default smtpd and this one will deliver those mails to dovecot -- or where ever you configured them to go to.
As email addresses like localpart@localhost aren't useful for your gateway, you need to (canonical) rewrite those addresses to an official address.
This means your default smtpd must not listen on localhost anymore. The default entry in master.cf like "smtp inet n - n - - smtpd" means that the smtpd listens on any interface on smtp port number 25. Now you need it to listen on the smtp port of your official IP address only. Therefore we will override inet_interfaces from main.cf .
Your second smtpd, newly defined in master.cf, inherits the default values from main.cf too, so you need to adjust only some. Well and this daemon will listen on localhost only.
Note1: This config runs without a chroot environment! If you do, some extra adjustments might be necessary. (I don't know for sure.)
Note2: Lines starting with dash (-) should be removed in your config and those beginning with plus (+) should be added. Angled brackets (<>) indicate a placeholder and they should not be present in your config.
/etc/postfix/master.cf # ========================================================== # service type private unpriv chroot wakeup maxproc command + args # ========================================================== -smtp inet n - n - - smtpd +smtp inet n - n - - smtpd
# Incomming mails only from real IP address -o inet_interfaces=<IP mailserver>
+127.0.0.1:25 inet n - n - - smtpd
# Incomming mails only from loopback device
# use only if appropriate in your case (postfix version >=2.2)
-o inet_interfaces=loopback-only
# Incomming mails only from localhost
# use only if appropriate in your case (postfix version < 2.2)
-o inet_interfaces=localhost,127.0.0.1
# Empty mydestination to disable local transport
-o mydestination=
# disable LDA delivery by emptying corresponding config entries
# you either use mailbox_command or virtual_mailbox_domains
-o mailbox_command=
-o virtual_mailbox_domains=
# Use this IP address as client to connect to gateway
-o smtp_bind_address=<IP mailserver>
# Canonical rewrite for sender and recipient addresses with @localhost
-o canonical_maps = pcre:/etc/postfix/canonical_localhost.pcre
New file /etc/postfix/canonical_localhost.pcre # This is a Perl Compatible Regular Expression table, # so no postmap command is needed.
# Address something@localhost becomes something@<yourmaildomain.tld> # or # address something@localhost becomes root@<yourmaildomain.tld> # CHOOSE ONLY ONE ! # #/^(.+)@localhost$/ $1@<yourmaildomain.tld> /^.+@localhost$/ root@<yourmaildomain.tld>
Local generated mails, that have no domain information should append the string $mydomain instead of default $myorigin (which normally is the FQDN of your mailserver).
/etc/postfix/main.cf
- append_at_myorigin = yes
- append_at_myorigin = no
- append_dot_mydomain = no
- append_dot_mydomain = yes
I guess you already set $relayhost but you can set fallbacks too.
/etc/postfix/main.cf relayhost = <gateway.domain.tld>
+# Optional list of relay hosts +smtp_fallback_relay = <IP of your gateway>, <secondary gateway if available>
Of course you need to restart postfix to apply these changes. AND if something breaks don't hold me responsible, use this config at your own risk!
Martin
On Dienstag, 31. März 2020 18:35:07 CEST Adam Raszkiewicz wrote:
Hi,
Is there any way to disable Dovecot LDA? I want to always send email via postfix and relay server even it will be a local delivery within the Dovecot server
Thanks, Adam
participants (6)
-
Adam Raszkiewicz
-
Aki Tuomi
-
Dauser Martin Johannes
-
Jerry
-
Juri Haberland
-
Remko Lodder