User send rate limit for postfix

Image you need to limit the number of emails sent by users through your Postfix server,
with mqdaemon you can setup a per-user send rate on daily/weekly/monthly basis with MySQL storage.

To work with mqdaemon you only need a mysql table like this:

CREATE TABLE  `emails` (
`email` VARCHAR(65) NOT NULL,
`messagequota` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`messagetally` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`timestamp` INT(10) UNSIGNED DEFAULT NULL,
)

and setting up configuration parameters (db_table, db_wherecol, db_messagequota, etc) inside the Perl script, then modify the postfix data restriction class “smtpd_data_restrictions” like the following:

smtpd_data_restrictions = reject_unauth_pipelining, reject_multi_recipient_bounce, check_policy_service inet:127.0.0.1:279

To print the cache content with update statistics for username into log file just send a SIGHUP to the process PID using “kill -HUP $pid”.

Download

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*