Notify admin and user if user exceeds the email limit

1) Per day, per DA account. (sum of all domains of the User and all pop accounts, within 1 limit)

John
 
Hello,

I've instead just added extra code to this feature:
http://www.directadmin.com/features.php?id=1121

where it also sends all Admins a message.
It can be shut off it anyone doesn't want to know of clients who exceed the limit.

John

Great feature, only recently discovered this, am I correct the message is only sent with the daily tally? If so, wouldn't this feature (sending an email message upon hitting the limit) be even better if it was done hourly or every minute?

Since the limit check is done realtime before sending an email it would be only fair to have the message to the admins as soon as possible as well I would imagine.
 
will is be possible to edit the /etc/virtual/limit per user from the DirectAdmin interface?
as part of the user package maybe ?
 
yonatanp is right, should be pointed as a feature request.

Have the possibility to limit the number of email per single client instead one limit for all.

Should be possible?

Regards
 
Hello,

Per DA client limit already exists (implemented a few weeks back):
http://help.directadmin.com/item.php?id=81

You'd create:
/etc/virtual/limit_username

where username is the name of the DA account you want to give the exception to. Anyone else who doesn't have a limit_username file will default to:
/etc/virtual/limit

Just grab the latest exim.pl

Note, I've just finished adding in the per-minute check:
http://www.directadmin.com/features.php?id=1173

The latest exim.pl code will see that the last email is being sent (of the limit, or limit_username) and will add an entry to:
/etc/virtual/mail_task.queue.

This mail_task.queue works with the same principle as the other task.queue file, except it's only for mail related things (the only thing it currently does is taddles to the dataskq about the limit being hit). The mail_task.queue is filled by the new exim.pl, which is why it needs to be installed.

The latest directadmin/dataskq binaries are being uploaded right now, and have the code to process this mail_task.queue and message the Admins and User (if enabled). This message also includes the email address that has the highest number of sends, and what that number is, based on /etc/virtual/usage/user.bytes. This should greatly help debug any compromised accounts. (should be done uploading in 15 minutes. Get the pre-release binaries from your clients section)

The /etc/virtual/limit should be easy enough to add to the Admin Settings. I'll also add a field at the User Level settings to allow an override, which would create the /etc/virtual/limit_user. I'm not sure if this should be a package option, or just a setting (would be a lot more work to add another package option into the skins)

John
 
The /etc/virtual/limit should be easy enough to add to the Admin Settings. I'll also add a field at the User Level settings to allow an override, which would create the /etc/virtual/limit_user. I'm not sure if this should be a package option, or just a setting (would be a lot more work to add another package option into the skins)

John

this does not matter actually if its in the package or in the settings , the idea is to have a control from the control panel :)
do you have an ETA on these? i would love to test them.
I got some clients who might push 40K mails / day , and i want to be able to have a single limit for all accounts on a specific limit for the clients.

currently its done from the /etc/virtual/limit_user file,
thing to note - check if file exists for a user and show the limit on the new settings option ( when added ).
 
Last edited:
From http://www.directadmin.com/features.php?id=1173:

In order for this new mail_task.queue to be filled, a new exim.pl is required:
wget -O /etc/exim.pl http://files.directadmin.com/services/exim.pl

Shouldn't that also include the chmod 755 /etc/exim.pl?

Can't wait for 1.371 with all these sweet features, is it worth getting the pre-release binaries now or will 1.371 go live next week anyway?

About the field at the User Level settings, this doesn't have to be part of the package options if I had to choose, since this setting only needs changing for a couple of specific customers anyway.
 
well, using a package line should be nice cause you can set a email-sent limit per package aswell (and that should be very very usefull).

Regarding exim.pl you must do chmod 755 /etc/exim.pl and restart exim for taking really effect :)

Regards
 
FYI, I've just completed some more work on the exim.pl and DA source. The exim.pl is now "VERSION=6", and includes the sender IP, sender address, authenticating username, and working path (if sent from a script). The check every minute will see if the limit is hit, and if it is, will count up all of these 4 items separately, and report the top values for each of the 4 items, to better assist in figuring out where the usage is coming from. If any item reports less than 20 of the total count of emails, the message isn't included (since it's not likely the culprit). There is a template txt file for the message, and this also include the |*if| statements for doing the 20% check, so the value, and message can be modified as desired. The pre-release binaries and exim.pl are now updated with these changes, so feel free to try it out.


When doing the wget, if the exim.pl already existed, then the new exim.pl will take the same permissions that were already there. Also, I do recommend an exim restart, but in testing, I noticed I didn't have to restart exim when I made changes... but restart exim anyway, for good measure.

John
 
Correct, that's the exim.pl you need with the pre-release binaries. The exim.pl doesn't need a "pre-release" status since:
1) The changes made are very minor, just some simple perl.
2) the exim packages have their own copies of the exim.pl
3) I don't want to manage yet another copy of something ;)

John
 
Thanks for clarification, i prefer dont use pre-release on production server, i will make a virtual machine for test purpose when i find some free time.

But, the limit-peruser was nice to have so i upadete just the exim.pl

Regards
 
Facing some problem with this feature.

First is making me crazy with exim verify = sender option dunno why but ive to disable this function for now.

Now im getting email about probable spammers:

Server limit: 250

Amount emails | Account name
401 | dndonline
387 | unknown
365 | mhorpheox
392 | giorgia
1040 | nonpresent

But, ive made for those user (except unknown that is not an user on my box) custom limit_username file with same perfmission and owner of the limit one with 5000 as limit

Code:
>ls -l limit*
-rwxr-xr-x 1 mail mail 4 25 feb 12:29 limit
-rwxr-xr-x 1 mail mail 5 24 feb 17:18 limit_dndonline
-rwxr-xr-x 1 mail mail 5 24 feb 16:06 limit_giorgia
-rwxr-xr-x 1 mail mail 6 24 feb 09:35 limit_mhorpheox
-rwxr-xr-x 1 mail mail 5 24 feb 16:06 limit_nonpresent

Code:
>cat limit*
250
5000
5000
50000
5000

Any suggestion?

Thanks
 
Hello,

To confirm, this is the new check-every-minute feature?
Or is this the nightly check that happens with the tally?
What is the message in DA saying is happening?

Check the /etc/virtual/usage/* files to see what the "username" and "username.bytes" files are showing.

Also check the /var/log/directadmin/system.log to see what this entry looks like:
Code:
Warning: %s emails have just sent by %s.  Sender %s sent %lld.  authenticated_id=%s sent %lld.  host=%s sent %lld.  %lld emails came from %s
John
 
The check seems to be per-hour and the message in the email was:

Amount emails | Account name
401 | dndonline
387 | unknown
365 | mhorpheox
392 | giorgia
1040 | nonpresent

Nothing in latest logs (ive disabled the per-user increasing the limit file 6 days ago).

Ive downloaded again the latest exim.pl and decreased main limit file to 250 keeping the limit_username configured for the user that i want able to send more email.

Ill reply here as soon ive again the error with logs attached.

Thanks
 
Well im supposing that tally is not working per-minute cause ive no the pre-release binary so is not programmed for do that each minute, am i right?

For now the only strange thing is in paniclog just after restarted exim with newer exim.pl file
Code:
2011-03-01 09:25:50 failed to expand condition "${perl{check_limits}}" for lookuphost router: Undefined subroutine &main::check_limits called.

2011-03-01 09:25:52 failed to expand condition "${perl{save_virtual_user}}" for virtual_user router: Undefined subroutine &main::save_virtual_user called.

Still no message about limit, and sender verify just working fine for now...
 
Back
Top