Synopsis
The scenario for this postfix dedicated transport example is we need to reduce our MTA's SMTP client delivery concurrency to a specific host because said host, example.org, is rejecting delivery of concurrent messages possibly due to UCE countermeasures. We currently only need to throttle delivery concurrency for this particular host and possibly other hosts in the future while maintaining the default concurrency limit for other hosts that are relayed to.
To utilize per-transport postfix configuration parameters for specific hosts a "dedicated transport" needs to be implemented as outlined below.
- Define an additional smtp transport in master.cf.
- Create the transport map file.
- Configure main.cf to utilize trasport map.
- Configure per-transport parameters in main.cf.
- Reload postfix.
Implementation
1. Define additional smtp transport
The postfix master.cf file is where the new "slow" dedicated transport will be defined. Edit master.cf to use the same variables for "slow" as are currently working for the existing "smtp" transport, do not copy the example below verbatim as your existing "smtp" transport may very well use different paramaters. Please take note that "smtp" and "smtpd" in the command column are two totally different commands and you want to duplicate your existing "smtp" client entry *not* the "smtpd" server. One specific change for this new transport, the "maxproc" variable is set to 1 instead of the default:
/etc/postfix/master.cf#==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
#==========================================================================
slow unix - - N - 1 smtp
2. Create transport map file
The transport map file contains a list of hosts and the transport to use when delivering mail to those hosts. It's possible to do quite a bit more with the transports, see "man 5 transport" for more options. The following transport map will cause all mail destined for example.org to be relayed by the "slow" transport:
/etc/postfix/transport
example.org slow:
Build the transport map .db hash table with postmap.
# postmap /etc/postfix/transport
Addition hosts can be added to the transport map as required. Remember to postmap the transport file after every update.
3. Configure main.cf to utilize trasport map
Edit main.cf and add or edit the transport maps configuration parameter to have postfix utilize the new transport(5) map.
/etc/postfix/main.cf
transport_maps = hash:/etc/postfix/transport
4. Configure per-transport parameters
Configure per-transport parameters in main.cf for the slow transport by prepending the transport service name for any configuration parameters that are specific for the transport:
/etc/postfix/main.cfslow_destination_recipient_limit = 20
slow_destination_concurrency_limit = 2
Setting any transports destination_recipient_limit parameter to a value of 1 changes the meaning of the corresponding per-destination_concurrency_limit from concurrency per domain into concurrency per recipient, which may in fact be what you require. You'll have to adjust the parameter values until you find what is acceptable by the remote host.
5. Reload postfix
Reload postfix to apply the new transport
# postfix reload
Check the mail logs to ensure the transport is working as expected.
Last updated: 10/04/2008