Plugin: SMTP Limiter

These errors indicate a bad exim.pl file or a perhaps typographical error in the exim.conf file.

Jeff
 
No, exim.pl original file && exim.pl patches (checked them already) are too old for the version of exim that I use (lastest) ...
 
Last edited:
Hi All,

I have this plugin running on several servers now and it looks fine.
However yesterday and today I received some tickets from customer complaining that the reached there limit which is not possible.

When I look into the exim logfile I see messages refused to send because of limit reached. The account name that is mentioned is NOT the account of that customer ?!

I raised the limit to skip this error for now, is there anyone that has this problem also ?

regards,
Michel.

I think it has to do that when an account with their own ip(not shared) than it fails and the mail is counted to antoher account ? Someone ?
 
In exim.pl in the check_limits function:

#find the curent user
# my $user = find_user()
my ($user) = @_;
# log_str("Checking user: '$user'\n");
if (!$user) { return 1; }

Is this correct ? Why is the find_user function disabled ? how can he find a user like this ?
 
Sorting

Hello everybody. I've succesfully installed this plugin but I've a problem.
It's possibile to sort by user, by number of sent message, etc?

How I can hack this plugin?

Thanks!


Carlo
 
Well it started counting. I was doing something wrong

Now another problem
I can't recieve mails from any one i.e. hotmail, gmail etc.
One thing to note is. The mails are recieved on catch all i.e [email protected]
but if I create an email account i.e. [email protected] no mail is recieved for that account. Below is the error copied from mainlog
2009-03-18 17:11:57 1LjzJ7-0000r3-5W <= [email protected] H=mail-gx0-f173.google.com [209.85.217.173] P=esmtp S=1672 [email protected] T="Test" from <[email protected]> for [email protected]
2009-03-18 17:12:11 1LjzJ7-0000rJ-Uv <= [email protected] U=mail P=spam-scanned S=2050 [email protected] T="Test" from <[email protected]> for [email protected]
2009-03-18 17:12:11 1LjzJ7-0000rJ-Uv failed to expand condition "${perl{save_virtual_user}}" for virtual_user router: Undefined subroutine &main::uid_exempt called at /etc/exim.pl line 307, <DOMAINOWNERS> line 32.

2009-03-18 17:12:11 1LjzJ7-0000rJ-Uv => pkhost <[email protected]> F=<[email protected]> R=localuser T=local_delivery S=2164
2009-03-18 17:12:11 1LjzJ7-0000rJ-Uv Completed
2009-03-18 17:12:11 1LjzJ7-0000r3-5W <[email protected]>: spamcheck transport output: 2009-03-18 17:12:11 1LjzJ7-0000rJ-Uv failed to expand condition "${perl{save_virtual_user}}" for virtual_user router: Undefined subroutine &main::uid_exempt called at /etc/exim.pl line 307, <DOMAINOWNERS> line 32.
2009-03-18 17:12:11 1LjzJ7-0000r3-5W => rizwan65 <[email protected]> F=<[email protected]> R=spamcheck_director T=spamcheck S=1934
2009-03-18 17:12:11 1LjzJ7-0000r3-5W Completed
 
I change check_limit() in /etc/exim.pl to the code below, the function still check /etc/virtual/limit for global limit and /etc/virtual/limit.$name for each user limit.

I tested on my system work without error, If you test with this function please kindly report the error(s).

Code:
sub check_limits
{
        my $count = 0;

        #find the current user
        $uid = find_uid();

        if (uid_exempt($uid)) { return "yes"; }

        my $name = "";
        my $email_limit = 0;
        if (($name = getpwuid($uid))) {

                if (-e "/etc/virtual/limit.$name") {
                        open (LIMIT, "/etc/virtual/limit.$name");
                        $email_limit = int(<LIMIT>);
                        close(LIMIT);
                } else {
                        open (LIMIT, "/etc/virtual/limit");
                        $email_limit = int(<LIMIT>);
                        close(LIMIT);
                }

                if ($email_limit > 0) {
                        $count = (stat("/etc/virtual/usage/$name"))[7];
                        if ($count > $email_limit) {
                                die("You ($name) have reach your daily email limit of $email_limit emails\n");
                        }

                        open (USAGE, ">>/etc/virtual/usage/$name");
                        print USAGE "1";
                        close (USAGE);
                        chmod (0660, "/etc/virtual/usage/$name");
                }
        }

        my $sender_address = Exim::expand_string('$sender_address');
        my $mid = Exim::expand_string('$message_id');

        log_bandwidth($uid,"type=email&email=$sender_address&method=outgoing&id=$mid");

        return "yes"
}
 
Last edited:
Is there a way to allow resellers to set limits on their own clients instead of an admin username having to make these changes? Or maybe a way to set all resellers default limits. Since we host free websites as well I set the default message count way low, 3 emails a day I think because we had some major spam issues and it would be impossible to log into the server all the time to track down all paid accounts and accounts owned by our resellers to raise their limits.
 
I followed the instructions and the exim log showed the following:

2009-04-28 14:46:38 login authenticator failed for dsl-247-20-71.telkomadsl.co.za (Andrade) [41.247.20.71]: 435 Unable to authenticate at present ([email protected]): Undefined subroutine &main::smtpauth called.

2009-04-28 14:46:43 login authenticator failed for dsl-247-20-71.telkomadsl.co.za (Andrade) [41.247.20.71]: 435 Unable to authenticate at present ([email protected]): Undefined subroutine &main::smtpauth called.

2009-04-28 14:46:54 login authenticator failed for dsl-247-20-71.telkomadsl.co.za (Andrade) [41.247.20.71]: 435 Unable to authenticate at present ([email protected]): Undefined subroutine &main::smtpauth called.
 
CentOS 5.2, clear DA install, SMTP Limiter install.

Can you help me with this error?

2009-06-11 02:19:02 exim 4.67 daemon started: pid=7049, -q15m, listening for SMTP on port 25 (IPv4) port 587 (IPv4)
2009-06-11 02:19:18 failed to expand condition "${perl{save_virtual_user}}" for virtual_user router: Undefined subroutine &main:
:save_virtual_user called.

2009-06-11 02:19:18 H=hosted.****.net [19.**.**.41] F=<test@****.net> rejected RCPT <[email protected]>:
2009-06-11 02:19:18 H=hosted.****.net [19.**.**.41] incomplete transaction (QUIT) from <test@****.net>
 
Doesn't really work. I'm still ending up with the following:

exim (pid 6019 6020 6105 7814 7846 9466 9907 9959 11310 11515 11646 11695 11711 11752 11768 11875 11887 12126 12152 12154 12220 13364 13406 13429 13471 13472 13474 13489 13503 13537 13544 13572 13573 13595 13600 13614 13620 13643 13660 13712 13810 13857 13874 13894 13951 13993 14046 14048 14062 14123 14203 14222 14273 15406 15409 15430 15432 15600 15643 15671 15734 15736 15757 15779 15803 15839 15992 16085 16086 16092 16097 16173 16174 16223 16236 16263 16299 16306 16354 16355 16365 16367 17447 17461 17499 17507 17517 17546 17547 17561 17608 17756 17762 17778 17789 17815 17821 17827 17828 17840 17875 17878 17881 17889 17890 17911 17913 17923 17939 17941 17944 17950 17953 17956 17960 17971 17972 17977 17978 17983 17992 17998 18002 18006 18007 18009 18010 18015 18018 18019 18021 18024 18025 18026 18027 18033 18035 18039 18040 18041 18043 18047 )

And it just keeps growing, even when I disable smtp access for all users.
 
hello,
i had to do updates and newly build all new.


then smtp-limiter were giving these errors ...

Warning: file_get_contents(): SAFE MODE Restriction in effect. The script whose uid is 100 is not allowed to access /etc/virtual/limit owned by uid 501 in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 133 Warning: file_get_contents(/etc/virtual/limit): failed to open stream: Inappropriate ioctl for device in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 133


Warning: file(): SAFE MODE Restriction in effect. The script whose uid is 100 is not allowed to access /etc/passwd owned by uid 0 in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 145 Warning: file(/etc/passwd): failed to open stream: Inappropriate ioctl for device in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 145 Warning: Invalid argument supplied for foreach() in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 148 Warning: opendir(): SAFE MODE Restriction in effect. The script whose uid is 100 is not allowed to access /etc/virtual/.smtp_usage owned by uid 501 in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 157 Warning: opendir(/etc/virtual/.smtp_usage): failed to open dir: Inappropriate ioctl for device in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 157 Warning: opendir(): SAFE MODE Restriction in effect. The script whose uid is 100 is not allowed to access /etc/virtual/.smtp_deny owned by uid 8 in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 158 Warning: opendir(/etc/virtual/.smtp_deny): failed to open dir: Inappropriate ioctl for device in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 158 Warning: opendir(): SAFE MODE Restriction in effect. The script whose uid is 100 is not allowed to access /etc/virtual/.smtp_limit owned by uid 501 in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 159 Warning: opendir(/etc/virtual/.smtp_limit): failed to open dir: Inappropriate ioctl for device in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 159


can somebody help me to solve this?

regards,
mark
 
yesterday i installed smtp limiter and it is working now but only for main email account (for example when i create one user 'deja' smtp limiter woring only for '[email protected]' no another mail accounts for deja's user ) important problem for another mails when somebody sent from other mail servers they takes 550 unknown user error but this local account can sent email to out and smtp limiter calculating.sametime when i check my mainlog i see this lines..


2009-06-19 16:17:41 failed to expand condition "${perl{save_virtual_user}}" for virtual_user router: Undefined subroutine &main::uid_exempt called at /etc/exim.pl line 307, <DOMAINOWNERS> line 127.

or

2009-06-19 16:15:45 failed to expand condition "${perl{save_virtual_user}}" for virtual_user router: Undefined subroutine &main::uid_exempt called at /etc/exim.pl line 307, <DOMAINOWNERS> line 141.


or

2009-06-19 16:13:01 failed to expand condition "${perl{save_virtual_user}}" for virtual_user router: Undefined subroutine &main::uid_exempt called at /etc/exim.pl line 307, <DOMAINOWNERS> line 118.


and other error lines

2009-06-19 16:22:28 H=(XDRAEOZ) [117.200.***.***] F=<[email protected]> rejected RCPT <[email protected]>: Unrouteable address

smtp limiter calculating and working but only for main user's mail accounts no more.for sub mail accounts when somebody sent mail to this sub email account they take 550 unknown user error and i see unrouteable address.also this is valid local domain to local domain mails.i deactived smtp limiter but my problem is continue.i can not receive any mail from sub mail accounts if i change exim.conf and exim.pl everything normal i can use all mails.on my server installed clamav and spamassasin.i dont have more problem now.

i am waiting your ugent helps.Thank you.
 
Last edited:
hello,
i had to do updates and newly build all new.


then smtp-limiter were giving these errors ...

Warning: file_get_contents(): SAFE MODE Restriction in effect. The script whose uid is 100 is not allowed to access /etc/virtual/limit owned by uid 501 in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 133 Warning: file_get_contents(/etc/virtual/limit): failed to open stream: Inappropriate ioctl for device in /usr/local/directadmin/plugins/SMTP_Limiter/admin/index.html on line 133

still not resolved, hope somebody knows what this is about ? :/
 
Back
Top