The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Rate-limiting outgoing e-mail

Discussion in 'E-mail Discussions' started by danf, Feb 6, 2009.

  1. danf

    danf Active Member

    Joined:
    Apr 10, 2006
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    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. kernow

    kernow Well-Known Member

    Joined:
    Jul 23, 2004
    Messages:
    865
    Likes Received:
    9
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
  3. ethical

    ethical Well-Known Member

    Joined:
    Apr 7, 2009
    Messages:
    79
    Likes Received:
    2
    Trophy Points:
    8
    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. !@#$*?!

    !@#$*?! Guest

    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).
     
Loading...

Share This Page