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.

Assistance on Exim Filtering in Advanced Exim Configuration

Discussion in 'E-mail Discussions' started by Elikster, Jul 25, 2012.

  1. Elikster

    Elikster Well-Known Member

    Joined:
    Feb 8, 2003
    Messages:
    119
    Likes Received:
    1
    Trophy Points:
    18
    I have been trying to setup the proper setting of the filtering in the exim.conf using the WHM's Advanced Exim Configuration, but it is little difficult to find where to place the following rules in to have it reject the email as it comes to the server. I have tried in three places, and it don't seems to work as intended. Basically, I am trying to have it filter by the $mime_charset and $h_content-type rules to block them. This is a snippet I have been using to try and filter them out accordly:

    deny
    message = Sorry, we do not read Chinese Spam.
    condition = ${if eq{$mime_charset}{gb2312}{1}{0}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Chinese Spam.
    condition = ${if match{$h_content-type:}{gb2312}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"


    The only issue is trying to have it placed in the proper area in the exim advanced configuration so it acts on it and rejects it accordly. I have 12 content-types rules to add but I need to get basic functionality working to add the rest in. The filter rules seems sound, but the spam still goes though, which indicate that it is not being acted on in the exim.conf ruleset areas.

    I could use some help and ideas on proper ACL to place them to get it set.
     
  2. Elikster

    Elikster Well-Known Member

    Joined:
    Feb 8, 2003
    Messages:
    119
    Likes Received:
    1
    Trophy Points:
    18
    Hello,

    I finally figured out the issue, and got it fixed properly. I got the $h_content-type part working properly, after adding the non-case senstitive part added to the regex, and moved it into proper section in the ACL to have it start filtering. This is what I have set up:

    In the custom_begin_pre_spam_scan section, I placed the rule set as follows:

    deny
    message = Sorry, we do not read Chinese Spam.
    condition = ${if match{lc:$h_content-type:}{gb2312}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Chinese Spam.
    condition = ${if match{lc:$h_content-type:}{big5}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Chinese Spam.
    condition = ${if match{lc:$h_content-type:}{gbk}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Chinese Spam.
    condition = ${if match{lc:$h_content-type:}{gb18030}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Chinese Spam.
    condition = ${if match{lc:$h_content-type:}{ecu-tw}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Chinese Spam.
    condition = ${if match{lc:$h_content-type:}{euc-cn}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Chinese Spam.
    condition = ${if match{lc:$h_content-type:}{hz-gb-2312}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Chinese Spam.
    condition = ${if match{lc:$h_content-type:}{iso-2022-cn}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Japanese.
    condition = ${if match{$h_content-type:}{iso-2022-jp}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Chinese Spam.
    condition = ${if match{lc:$h_content-type:}{big5-hkscs}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Cyrillic.
    condition = ${if match{lc:$h_content-type:}{koi8-r}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Cyrillic.
    condition = ${if match{lc:$h_content-type:}{koi8-u}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Japanese.
    condition = ${if match{lc:$h_content-type:}{shift-jis}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"
    deny
    message = Sorry, we do not read Vietnamese.
    condition = ${if match{lc:$h_content-type:}{cp1258}{1}}
    log_message = "Non-English Spam Rejected from $sender_fullhost"

    The fix I put in is the lc: part to make it all lower case, so it can match the regex expession it looks for to be true to reject the message. The only thing left is the mime stuff which I want to decode and reject if it is in other languages, since some mailers send emails in English but have the mime data in other charsets, and that is where I am currently stuck at the moment.
     
Loading...

Share This Page