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.

Simple mail filtering/blocking/safe deleting

Discussion in 'E-mail Discussions' started by ayik, Oct 16, 2004.

  1. ayik

    ayik Member
    PartnerNOC

    Joined:
    Oct 7, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Hi.. i just want to block some simple BADWORD for incoming/outgoing email. I searched the whole forum but i got complicated answers.

    I have 2 goals:

    1. Block some word like "pen1s vag1na togel" etc (some in my local languange, not in english). This email is directly goes to :fail: or :blackhole:. But this should be sitewide.

    2. How to safely remove Message that contain such BADWORD with external application (i am a php coder, not fluently speaking perl,bash,etc) in /var/spool/exim/input ? I just want to do the same thing when we clicked "Delete Message" Frim WHM -> MAnage Mail Queue

    Thank you all. I hope this question is not too difficult. I am new in Cpanel Environment :D
     
  2. ayik

    ayik Member
    PartnerNOC

    Joined:
    Oct 7, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Hmm.. after search all night long, i found it. It's too simple actually :D

    After reading many FAQ and HOWTOS and DOCS, i found it by. I just would like to share it.

    First define main filter file in WHM -> Exim Configuration Editor
    ---> by default is: /etc/antivirus.exim

    Edit that file:

    add these lines on the bottom:

    Code:
    # set a log file for this filter, you can remove it if don't want to log
    logfile /var/log/exim_filterlog
    
    # body of message matches *angka*.net|com|org|biz|info|us|name 
    # add other REGEX style matching with or
    # then Discard it (:blackhole:) --> seen finish
    if  $message_body matches "angka[^\s]+[net|com|org|biz|info|us|name]+?" or
        $message_body matches "togel|judi|sex|v(i|1)agra|vag(i|1)n(a|4)|cock|pen(i|1)s|asu|seks|l(o|0)l(i|1)ta|dewacolok"
    then
        logwrite "$tod_full MESSAGE-ID: $message_id\n\
        $message_headers\n\n\
        $message_body\n\n\
        "
        seen finish
    endif
    exit editor then touch the file:

    Code:
    touch /var/log/exim_filterlog
    chown mailnull.mail /var/log/exim_filterlog
    chmod 640 /var/log/exim_filterlog
    Dont forge to periodically rotate the logfile

    it's so simple :p i don't know why i posted it yesterday :D
     
Loading...

Share This Page