postfix: generic & transport are driving me nuts

Installing, Configuring, Troubleshooting server daemons such as Web and Mail
Post Reply
Posts: 141
Joined: 2010/03/11 11:33:59

postfix: generic & transport are driving me nuts

Post by majun » 2014/02/11 14:47:04

Methings me too stupid for postfix...

I've run into a problem with postfix I can't wrap my head around. Well, I sort of can and it makes sense to me but it can't be the way it's been designed...
  • One central MTA for incoming and outgoing emails (Domain for incoming mails:; internal domain:
  • Several remote servers located far far away from said central MTA handling different subdomains for their respective sites:,,,,, etc. Important notice: the local domain is different from the official one and is only used internally.
  • The mapping between external email adress and the internal is done via aliases on the central MTA.
  • The internal destination hosts for,, etc. are defined via individual entries in transport, each site has its own local MTA. Thus, transport contains entries like "".
So far, so good. Everything works as expected. However, a new groupware solution we've decided to use (and, unfortunately, already bought and paid for) is as stupid as night as black and uncapable of handling multiple internal domains different from external addresses, hence users keep sending out emails with a worthless "" sender addresses. Needless to say these merely internal domains do not have official MX or A records outside our company network. Thus, our clients keep complaining that their mails to us keep bouncing. I've started looking into this and found out that this is precisely what generic is for. However, this is where I fail to see the logic. When adding a new generic entry "" or, more generally speaking "", masquerading works just as expected, meaning that mails initially sent out as get mapped to correctly. However, postfix fails to deliver incoming messages to its final recipient because it first remaps the address from to via aliases and then - instead of going straight to transport without touching it again - looks up the destination for via transport, and then remaps the address back to via generic before sending the message on its way to its final destination.

In short:
What I expect: 1) receive message; 2) remap external to internal address via aliases; 3) look up destination via transport; 4) deliver message
What it does: 1) receive message; 2) remap external to internal address via aliases; 3) look up destination via transport; 4) remap internal to external address via generic; 5) deliver message

The remote MTA receives these messages and immediately relays them because of an incorrect destination - the remote MTA's $mydestination is and not Thus, the message gets relayed back to the central MTA that serves as relayhost for all other MTAs and the entire game begins anew. After a few seconds I get a "too many hops" bounce and that's that. I absolutely do see the logic behind this in that step 4 in the latter case is, as far as postfix is concerened, a new message and not the original message anymore. The original message has been accepted by postfix and copied as new message destined for delivery. Thus, the process of remapping and delivery beings anew. However, this can't be the way it's designed so I'm fairly sure it's a layer 8 problem and I'm the stupid one here. How do I handle this problem, any ideas?

Post Reply

Return to “CentOS 5 - Server Support”