[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2878
  • Last Modified:

Postfix sender_dependent_default_transport_maps Default Behavior

We are trying to impliment the ability to filter based on who is sending and use a smarthost for some of these people.

I found several articles, and ended up using this one to configure this:
http://www.kutukupret.com/2010/01/02/postfix-bind-sender-domain-to-dedicated-outgoing-ip-address/

What I am looking for is a way to make any domains/users who are not set up in the file to send out using the local server and DNS.  I tried a few things, but so far no luck.  Any ideas?

Running Ubuntu 10.04 with Postfix 2.7
0
TacoFlavoredKisses
Asked:
TacoFlavoredKisses
  • 5
  • 5
  • 3
3 Solutions
 
Barry GillChief of StaffCommented:
create a listener in master.cf that bypasses the sender dependant transport maps
0
 
Barry GillChief of StaffCommented:
sorry, create a sender dependant map that points to the localhost on port 10025 (or whatever) and then create a listener in master.cf to listen on that port and use the -o tag to overwrite the sender dependant maps parameter
0
 
TacoFlavoredKissesAuthor Commented:
I saw another article with similar info but I don't follow completely.  
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Barry GillChief of StaffCommented:
postfix listens on port 25
processes rules and forwards to new smtp service as per the sender maps.
one of those rules forwards to localhost port 10025 (or something you specify) and postfix has a listening daemon on that port that changes some of the normal rules.
these new rules DO NOT INCLUDE the sender_dependant_recipient maps and as such postfix will deliver to final destination.

this is the same type of configuration/process with postfix that you would use for spamassassin and clam through...
0
 
bevhostCommented:
See
http://www.postfix.org/postconf.5.html#sender_dependent_default_transport_maps



sender_dependent_default_transport_maps (default: empty)

    A sender-dependent override for the global default_transport parameter setting. The tables are searched by the envelope sender address and @domain. A lookup result of DUNNO terminates the search without overriding the global default_transport parameter setting. This information is overruled with the transport(5) table.

    Note: this overrides default_transport, not transport_maps, and therefore the expected syntax is that of default_transport, not the syntax of transport_maps. Specifically, this does not support the transport_maps syntax for null transport, null nexthop, or null email addresses.

    For safety reasons, this feature does not allow $number substitutions in regular expression maps.

    This feature is available in Postfix 2.7 and later.



sender_dependent_relayhost_maps (default: empty)

    A sender-dependent override for the global relayhost parameter setting. The tables are searched by the envelope sender address and @domain. A lookup result of DUNNO terminates the search without overriding the global relayhost parameter setting (Postfix 2.6 and later). This information is overruled with relay_transport, sender_dependent_default_transport_maps, default_transport and with the transport(5) table.

    For safety reasons, this feature does not allow $number substitutions in regular expression maps.

    This feature is available in Postfix 2.3 and later.
0
 
Barry GillChief of StaffCommented:
thanks Bev, I learned something :) I didn't realise that the fail would result in normal transport.
0
 
TacoFlavoredKissesAuthor Commented:
I am going to work on implementing this.  I will update here once done.
0
 
TacoFlavoredKissesAuthor Commented:
When it is failing to find the domain it is just hanging on the server.
0
 
TacoFlavoredKissesAuthor Commented:
Here is what I have:

Error I am getting is:
Aug 22 21:26:53 postfix03 default/smtp[30064]: connect to gmail-smtp-in.l.google.com[74.125.93.27]:25: Invalid argument

In master.cf:

domaina  unix -       -       n       -       -       smtp
   -o smtp_bind_address=192.168.6.89
   -o smtp_helo_name=domaina.com
   -o syslog_name=domaina


default  unix -       -       n       -       -       smtp
   -o smtp_bind_address=127.0.0.1
   -o smtp_helo_name=postfix03.domainx.com
   -o syslog_name=default

In main.cf:
sender_dependent_default_transport_maps = regexp:/etc/postfix/sdd_transport_maps.regexp

In sdd_transport_maps.regexp
/@domaina\.com$/      domaina:
/@domainb\.net$/       default:
0
 
bevhostCommented:
This transport can only talk to localhost as it does not have a public IP address.
default  unix -       -       n       -       -       smtp
   -o smtp_bind_address=127.0.0.1
   -o smtp_helo_name=postfix03.domainx.com
   -o syslog_name=default

Open in new window

0
 
bevhostCommented:
I'm not sure why you don't setup the sender_dependent_default_transport_maps like this

/@domaina\.com$/      smtp:[smarthost]


Then again, perhaps I don't understand what you are trying to achieve here.
0
 
Barry GillChief of StaffCommented:
gmail-smtp-in.l.google.com[74.125.93.27]:25: Invalid argument

your failure above is because the syntax in your sdd_transport_maps.regexp is wrong.

My apologies for making this complex, bevhost is correct.
undo the changes to master.cf and revert back to just using the sender_dependant_default_transport_maps as per bevhosts post above.
you will have then...

/@domaina\.com$/      smtp:[192.168.6.89]
/@domainc\.com$/      smtp:[192.168.6.90]
/@domaind\.com$/      smtp:smtp.google.com

etc

note there is no domainb listed here as that will fall back to default delivery mechanism.
0
 
TacoFlavoredKissesAuthor Commented:
Wow.  That is much easier than I was making it.  Thanks bevhost and barrulus

I took out the crazyness in master.cf and just used the smtp: in the sdd file.  Works exactly as expected now.  

I would think it would still work linking it to something in the master.cf .  At first I just had the top one and tried to let the others go out when they don't meet the rule, but there was a transport error then.  Either way, this is a much simpler configuration.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now