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.

filtering simply not working

Discussion in 'General Discussion' started by matt621, Jun 8, 2004.

  1. matt621

    matt621 Well-Known Member

    Joined:
    Jun 25, 2003
    Messages:
    175
    Likes Received:
    0
    Trophy Points:
    16
    This seems like a simple problem, I can't figure out why it's not working.

    I have setup the filter:

    Filter Destination
    $message_body contains "A message that you sent contained no recipient addresses, and therefore no" Discard


    This is due to the forum sending updates to now no longer existing email accounts. For some reason the forum script sends the first email to the user, which bounces or something, and then this second email is created and sent to the admin for the site.

    So I create the filter above, but it's like it doesn't work at all. If I try to cut and paste the mail into the test box, and hit test, again, nothing seeems to happen. It shows:

    Filter Trace Results:

    and then empty, blank white space.
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    If I'm reading this correctly, then what's happening is the SMTP server making a last ditch attempt to tell someone about the email failure. This someone is the user account on the server, i.e. username@server.serverdomain.com which will not be picked up by the filters - I came across something similar to this recently.

    The reason is: the SMTP server tries to deliver an email to an account on the server. This email is bounced back to the sender, so the SMTP server tries to deliver the bounce to the sender, but that also gets bounced. The SMTP server now has no-one to send the bounce to, so it tries a last ditch attempt to email the <return-path> which is username@server.serverdomain.com, i.e. it will go directly to the username for the cPanel account and since the original domain is now lost, it comes in with the server hostname which is not filtered.
     
  3. matt621

    matt621 Well-Known Member

    Joined:
    Jun 25, 2003
    Messages:
    175
    Likes Received:
    0
    Trophy Points:
    16
    Yes this is exactly what I'm talking about and that is exactly what is happening.

    In the most recent versions of Cpanel, I have noticed an option:

    Default catch-all/default address behavior for new accounts.
    under "tweak settings"

    What i'd like to do is retroactively set ALL accounts on the box to :blackhole:

    I know I can set it that way now, but my understanding is that it only affects new accounts on the box. I want to make it update every account on the box. There are gigs and gigs of bounced emails in those accounts..... all spam bounces that the original account no longer exits.

    Thank you.
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Unfortunately, this hits another snag. The blackhole doesn't work in this case because the mail is being deliver to the account at an "incorrect" domain, and so the entries in /etc/valiases/domain don't work, so the blackhole will be ignored.

    The way around this that I used, was to set their inbox to the null device, like this:

    cd /home/username/mail
    rm inbox # empties out their inbox
    ln -s /dev/null inbox
    chown username:mail inbox

    Replace username with the account name of the user in the above commands.

    Any mails now sent directly to the user account are lost for good. If this is what you want, it does work.
     
  5. matt621

    matt621 Well-Known Member

    Joined:
    Jun 25, 2003
    Messages:
    175
    Likes Received:
    0
    Trophy Points:
    16
    I don't understand "incorrect domain."
     
  6. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Well,

    The email normally is delivered to username@userdomain.com and so is picked up by the filters and aliases in /etc/valiases/userdomain.

    However, under these conditions the email is coming in with the hostname as the email domain, so with a hostname of, e.g. server1.hostdomain.com, the email comes in with username@server1.hostdomain.com instead of username@userdomain.com and so none of the filters or aliases will match. This is why it will always end up in /home/username/mail/inbox
     
  7. matt621

    matt621 Well-Known Member

    Joined:
    Jun 25, 2003
    Messages:
    175
    Likes Received:
    0
    Trophy Points:
    16
    Okay. Now I understand that part. But what is the solution here? When I moved the sites from the ensim box to the cpanel box my spam jumped 10 fold and I was already at massive loads to begin with. The ensim box just ignored them I guess.

    Will this solution:
    cd /home/username/mail
    rm inbox # empties out their inbox
    ln -s /dev/null inbox
    chown username:mail inbox

    work for username@server1.hostdomain.com emails?
     
  8. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Doing what I suggested will dispose of all and any email sent to the username account whether it is username@userdomain.com or username@server1.hostdomain.com. If this is OK with you, then that is one solution.

    If you want email that is sent to the username account, then you're going to have to look at adding the server1.hostdomain.com account to the /etc/valiases/ files.
     
Loading...
Similar Threads - filtering simply working
  1. hominid4
    Replies:
    3
    Views:
    271

Share This Page