Sure. I'm probably the only one who was having this up and running well. Chrisf is gone forever (his hosting company is gone too).
Sendmail is symlinked to our special send_mail version:
ls -l /usr/sbin | grep sendmail
lrwxrwxrwx 1 root root 35 Apr 20 15:34 sendmail -> /usr/sbin/sendmailwrapper/send_mail
-rwxr-xr-x 1 root root 209K Feb 20 2014 sendmail.postfix
drwxr-xr-x 2 root root 4.0K Apr 17 23:07 sendmailwrapper
sendmailwrapper is a directory with our special files:
ls -l /usr/sbin/sendmailwrapper/
total 20K
-rwxr-xr-x 1 root root 0 Apr 20 15:51 send_mail
-rwxr-xr-x 1 root root 719 Apr 17 23:07 smw_config.pl
-rwx------ 1 root root 1.5K Feb 19 2014 smw_cron_12hour
-rwx------ 1 root root 1.5K Feb 19 2014 smw_cron_24hour
-rwx------ 1 root root 1.5K Feb 19 2014 smw_cron_hourly
-rwxr-xr-x 1 root root 1.6K Feb 19 2014 smw_limiter
Qmail is having just normal sendmail binary file:
ls -l /var/qmail/bin | grep sendmail
-rwxr-xr-x 1 root root 14K Mar 10 2014 sendmail
Then you just need to add the database attached (remove my users out there) and set it properly in this file:
cat smw_config.pl
#!/usr/bin/perl
### --CONFIGURATION
# DB information
$db_name='DBI:mysql:sendmailwrapper:localhost:3306';
$db_uid='sendmailwrapper';
$db_pwd='password';
### deliver report from cron about usage violations
# 0 = no reports sent
# 1 = reporting on, be sure to set report_email
$send_reports = 1;
$report_email = 'your@e-mail.com';
### 1 = disable all logging of sendmail
$log_disabled = 0;
### production mode
# 0 = bypass limiting
# 1+ = limiting per uid on
$limiter=1;
$logfile="/var/log/sendmail-limits.log";
### per hour group limits
# please read sendmail-chrisf.txt for description
# all users default to group one (1)
@sm_max = (100, 0, 500, 1500, 4500, 8000 );
# chrisf sendmail-wrapper v1.1b
1;
I'm using two groups:
- first 100 e-mails per hour (default)
- second 0 e-mails per hour (hacked customers)
See the database for more details (just change 1 to 2 to ban user).
Also some cron jobs to reset counters:
0 * * * * /usr/sbin/sendmailwrapper/smw_cron_hourly
0 0,12 * * * /usr/sbin/sendmailwrapper/smw_cron_12hour
0 0 * * * /usr/sbin/sendmailwrapper/smw_cron_24hour