Tuesday, March 27, 2012

How to limit amount of messages per time unit in Postfix

Open postfix config file
#nano /etc/postfix/main.cf

And add next rows

smtpd_client_event_limit_exceptions = #Clients that are excluded from connection count (default: $mynetworks)
anvil_rate_time_unit = 60s #The time unit over which client connection rates and other rates are calculated. (default: 60s)
anvil_status_update_time = 120s #How frequently the server logs peak usage information. (default: 600s)
smtpd_client_message_rate_limit=500 #The maximal number of message delivery requests that any client is allowed to make to this service per time unit. (default: 0) To disable this feature, specify a limit of 0.

This configuration means that client may send 500 messages per minute, message 501 will be rejected.

No comments:

Post a Comment