What is it?
Mailscore is a postfix policy daemon handling host and sender scores to avoid bots and abusing customers through your SMTP relays.What is needed?
- A Postfix server
- A MySQL database server (it is easy to use another one)
- Perl interpretor with following libraries:
- DBD
- Sys::Syslog
How does it work?
Scores are incremented of 1 point at each relay try (even denied ones) When score is greater than the default or custom quota, the policy daemon returns a deny.
People that never stop sending emails will stay in over quota as their scores keep on increasing. To regain the right to relay, an external utility lowers theses overquota scores slowly. Additionaly the script does the database cleanups (old records).
Custom scores
Exemples to override default scores:
mysql> insert into mailscore_customscore (_from,_score) values ('john@doe.com',400);
mysql> insert into mailscore_customscore (_from,_score) values ('10.1.2.3',600);
Parameters and score tunings
Default parameters are:
my $time_base = 3600; # Time base = 1h my $max_time = 2 * 86400; # Max time for non overquota entries my $host_score = 200; # 200 msg per time unit per source ip my $user_score = 150; # 150 msg per time unit per sender/sasl user
This means, the unit will be 1 hour, and the quotas will be:
* 200 mails per hour that can be sent from unique IP addresses, * 150 mails per hour that can be sent from unique sender.With theses scores, the maintenance script removes every 10 minutes records under quotas older than 2 days.
If you want to change the time base, change $time_base in mailscore.conf. Reload postfix to get new settings read.
If you want to change default quotas, change $host_score and $user_score in mailscore.conf. Reload postfix to get new settings read.
Authors
Cyril Bellot (Dev)Vincent Pagès (Dev)