[imp] child permissions

Andrew Morgan morgan at orst.edu
Wed Nov 5 21:04:52 UTC 2008


On Wed, 5 Nov 2008, Kevin Konowalec wrote:

> We've got imp set up with permissions to restrict the max recipients per 
> message and max recipients per time period.  But I'm not seeing a way to 
> change what the consequence of that is... is there someplace we can change 
> the banning period, for example, from 24 hours to 1 hour or 48 hours or 
> something like that?

It doesn't work like a password lockout mechanism does.  When IMP goes to 
send a message, it does a SELECT on the imp_sentmail table in your 
database to find out how many messages/recipients there were in the last X 
hours for your user.  If there are more than the max recipients limit, 
sending is denied.  So think of it like a sliding window.

>  Also, is there a mechanism in place where the admin can 
> be emailed when someone gets into this trap?

Not that I've seen, but it is pretty trivial to script that.  Here is a 
perl script I use to show "heavy" users:

----------------------------------------------------------------
#!/usr/bin/perl -w

use DBI;

# Setup some variables
require "/private/admin/acct/requires/prefs.pl";

# Connect to db
$dbh = DBI->connect($prefs{'webmail_connect_string'},
                         $prefs{'migrate_sql_user'},
                         $prefs{'migrate_sql_pass'},
                         { RaiseError => 1, AutoCommit => 1 })
                 or die("$DBI::errstr\n");


# Get total session count
$sth = $dbh->prepare("SELECT sentmail_who, COUNT(sentmail_who) cc
                 FROM imp_sentmail
                 WHERE (sentmail_ts > UNIX_TIMESTAMP() - 86400)
                 GROUP BY sentmail_who
                 HAVING cc > 100
                 ORDER BY cc DESC");

$sth->execute();

print "Users with more than 100 messages sent in the last 24 hours:\n\n";

printf("%-30s %s\n", "Username", "Messages");
while (($user, $count) = $sth->fetchrow_array) {
         printf("%-30s %d\n", $user, $count);
}

# Cleanup
$sth->finish;
$dbh->disconnect;
----------------------------------------------------------------

Our limit is actually 500 per 24 hours, but anyone over 100 is usually 
interesting enough to check out.  :)

 	Andy


More information about the imp mailing list