To limit how often a particular IP address can connect to the MTA, see Chapter 19, Throttling Incoming Connections Using MeterMaid. Limiting connections by particular IP addresses can be useful for preventing excessive connections used in denial-of-service attacks. In the past, this function was performed using the shared library, conn_throttle.so in the Port Access mapping table. No new enhancements are planned for conn_throttle.so and MeterMaid is its more effective replacement.
conn_throttle.so is a shared library used in a PORT_ACCESS mapping table to limit MTA connections made too frequently from particular IP addresses. All configuration options are specified as parameters to the connection throttle shared library as follows:
IP-address is the dotted-decimal address of the remote system. max-rate is the connections per minute that shall be the enforced maximum rate for this IP-address.
The routine name throttle_p may be used instead of throttle for a penalizing version of the routine. throttle_p will deny connections in the future if they’ve connected too many times in the past. If the maximum rate is 100, and 250 connections have been attempted in the past minute, not only will the remote site be blocked after the first 100 connections in that minute, but they’ll also be blocked during the second minute. In other words, after each minute, max-rate is deducted from the total number of connections attempted and the remote system is blocked as long as the total number of connections is greater than the maximum rate.
If the IP-address specified has not exceeded the maximum connections per minute rate, the shared library callout will fail.
If the rate has been exceeded, the callout will succeed, but will return nothing. This is done in a $C/$E combination as in the example:
PORT_ACCESS TCP|*|25|*|* \ $C$[msg-svr-base/lib/conn_throttle.so,throttle,$1,10] \ $N421$ Connection$ not$ accepted$ at$ this$ time$E
$C continues the mapping process starting with the next table entry; uses the output string of this entry as the new input string for the mapping process.
$[msg-svr-base/lib/conn_throttle.so,throttle,$1,10] is the library call with throttle as the library routine, $1 as the server IP Address, and 10 the connections per minute threshold.
$N421$ Connection$ not$ accepted$ at$ this$ time rejects access and returns the 421 SMTP code (transient negative completion) along with the message “Connection not accepted at this time.”
$E ends the mapping process now. It uses the output string from this entry as the final result of the mapping process.