Author Topic: Force use of smarthost  (Read 2249 times)

grappa

  • Zen Apprentice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Force use of smarthost
« on: September 24, 2020, 08:52:58 am »
I have Zentyal/postfix configured to send mail through a smarthost at a larger provider, and grab it through the same using fetchmail since many spam heuristics are suspicious towards smaller, independent mail servers.

Problem is as follows: I want to force use of the smarthost independent of which destination outgoing mail has. Even if it is a destination domain name that the mail server is set to handle, I still want it to go through the smarthost.

Is there any good way to do this? I tried commenting out virtual_mailbox_domains in main.cf.mas and rebuilding and restarting the server. This makes one able to send mail to "nonexistent" users on the Zentyal server (which do not exist there but only at the bigger mail provider), but since Fetchmail passes mail to Postfix, there is no longer any destination for the incoming mail Fetchmail grabs for a user so it just disappears. (Off-topic but this also makes me a bit worried, does that mean mail will start flushing out into thin air if the Postfix module stops working?)

Also tried setting transport_maps in main.cf.mas to point to a file containing * smarthost:port and then running sudo postmap that_file. Rebuild and restart. No change stuff addressed to the domain still bypasses smarthost.

Any tips much appreciated

Thanks in advance

doncamilo

  • Zen Samurai
  • ****
  • Posts: 478
  • Karma: +165/-1
    • View Profile
Re: Force use of smarthost
« Reply #1 on: September 25, 2020, 06:08:03 pm »
 :o

Surely I haven't understood your comment correctly. Why would you need to send "all" the mail traffic through the relay host? 

Zentyal mail module will process directly the configured virtual domains and the local accounts and it will route them to the corresponding mailboxes. The external mail will be forwarded to the "smarthost" which will serve it to the rest of the domains.

Actually, you use fetchmail through user accounts on someone of these virtual domains, isn't it? How could your users to receive his mail into his mailboxes if the received mail would be eternally forwarded to the relay host?

I believe you would build a "strange loop".

Cheers!
- Do my pigeons bother you passing over your land?
- They block the sun!

G. Guareschi., Don Camillo.,

grappa

  • Zen Apprentice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Force use of smarthost
« Reply #2 on: September 26, 2020, 03:12:25 pm »
Thanks for your reply and let me clarify some things.

There is no strange loop.

-Zentyal pulls mail via IMAP from an external provider and deletes it from there. This provider is the actual handler for incoming mail (MX) for my domain.

-Which email addresses Zentyal/postfix thinks exist internally (those that are registrered in the Zentyal server) is not relevant. Firsthand mail reception is always done through the external provider, so the scope of which accounts exist from the external provider's side is the important thing.

I.e. some addresses on the external provider might have accounts on the zentyal server, some not.

If smarthost is not used and an address does not exist in the zentyal server, transmission will fail because zentyal looks at its internal scope only, not the scope of the "real email Internet" (i.e. which addresses are accepted by the real MX of the domain).

Hence the need to force smarthost for any and all addresses. Otherwise much internal mail (mail addressed from my domain to my domain) will fail.

I solved it for now by hardcoding the smarthost as smtp transmitter on the clients instead. I however think this might pose a problem if I want to use the sogo webmail/calendar thing in Zentyal so it's not the most elegant solution.