Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Apr 2006
    Posts
    26

    Default Rate-limiting outgoing e-mail

    I would like to help prevent rogue scripts from sending out spam. I found this option in WHM:

    The maximum each domain can send out per hour (0 is unlimited)

    But, since this is implemented in /etc/exim.pl, it simply drops any messages over the rate limit. This is a bit drastic, especially since the messages are not recoverable, even if they are legitimate.

    Is there a way to tell Exim to freeze any messages over the rate limit instead? Then I could have a script that checks for frozen messages, and they could be investigated.

    Thanks.

  2. #2
    Member
    Join Date
    Jul 2004
    Posts
    495

  3. #3
    Member
    Join Date
    Apr 2009
    Posts
    10

    Default

    kernow, and exactly how does CSF do anything of the sort of what the OP asked? That is mostly a reporting and logging tool? If you know how why not just say it for the help of everyone?

    Further to this discussion, I think the answer lies in the below code in exim.pl

    Code:
    #logsmtpbw here
       my $now = time();
       $domain =~ s/[^\w\.\-]//g;
    #we just can't trust user input
       my $message_size = Exim::expand_string('$message_size');
     
       if ($domain ne "") {
          my $maxmails = 0;
     
          open(CF,"/var/cpanel/cpanel.config");
          while(<CF>) {
             next if (/^#/);
             s/\n//g;
             my($var,$value) = split(/=/, $_);
             if ($var eq "maxemailsperhour") {
                $maxmails = int($value);
             }
          }
          close(CF);
     
          open(CPM,"/var/cpanel/maxemails");
          while(<CPM>) {
             s/\n//g;
             my($mdomain,$mmax) = split(/=/);
             if ($mdomain eq $domain) {
                $maxmails = int($mmax);
             }
          }
          close(CPM);
     
          if ($maxmails > 0) {
             my $nummailsinhour = readbacktodate("/usr/local/apache/domlogs/$domain-smtpbytes_log");
             if ($nummailsinhour > $maxmails) {
                die "Domain $domain has exceeded the max emails per hour. Message discarded.\n";
             }
          }
    so the part i would assume that needs changing is the last if statement.

    can anyone advise as to how to change that IF so that mails are queue and not killed?

    Thanks

    John

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    1

    Default

    Anyone ever find a solution to this? I've read up on the online spec for exim but can't seem to make it work. (exim queue keeps crashing).

Similar Threads & Tags
Similar threads

  1. Customize Sub-domain of Outgoing/Incoming Mail Server for Mail Client Settings
    By URPad in forum Feature Requests for cPanel/WHM
    Replies: 6
    Last Post: 09-07-2010, 10:36 PM
  2. Rate limiting outgoing email for users
    By tywe in forum E-mail Discussions
    Replies: 3
    Last Post: 09-02-2009, 11:51 PM
  3. Auto-limiting outgoing email via localhost/PHP
    By brianoz in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 08-19-2006, 10:50 AM
  4. Filter outgoing mail
    By Surfer in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 01-24-2005, 05:19 AM
  5. Outgoing mail problem
    By motoenth in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 01-18-2005, 12:00 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube