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 mail messages in exim.conf

Discussion in 'E-mail Discussions' started by NetX, Jun 9, 2004.

  1. NetX

    NetX Well-Known Member

    Joined:
    Jun 18, 2003
    Messages:
    177
    Likes Received:
    0
    Trophy Points:
    16
    Hello,

    I have created a filter rules for a domain in /etc/vfilters/domain.com and works fine, this is the file:


    # Exim filter

    if error_message then finish endif

    if $header_subject: begins "!"
    or $header_subject: begins "#"
    or $header_subject: begins "%"
    or $header_subject: begins "&"
    or $header_subject: begins "'"
    or $header_subject: begins "("
    or $header_subject: begins ")"
    or $header_subject: begins "*"
    or $header_subject: begins "+"
    or $header_subject: begins ","
    or $header_subject: begins "-"
    or $header_subject: begins "."
    or $header_subject: begins ":"
    or $header_subject: begins ";"
    or $header_subject: begins "<"
    or $header_subject: begins "="
    or $header_subject: begins ">"
    or $header_subject: begins "?"
    or $header_subject: begins "@"
    or $header_subject: begins "\""
    or $header_subject: begins "]"
    or $header_subject: begins "_"
    or $header_subject: begins "{"
    or $header_subject: begins "}"
    or $header_subject: begins "-"
    or $header_subject: begins "+"
    or $header_subject: is "Document"
    or $header_subject: is "Details"
    or $header_subject: is "Important"
    or $header_subject: is "Re:"
    or $header_subject: is " "
    or $message_headers contains ".pif"
    or $message_headers contains ".lnk"
    or $message_headers contains ".vbs"
    or $message_headers contains ".js"
    or $message_headers contains ".exe"
    or $message_headers contains ".bat"
    or $message_headers contains ".cmd"
    or $message_headers contains ".scr"
    or $message_headers contains ".ocx"
    or $message_headers contains ".dll"
    or $message_headers contains ".vxd"
    or $message_headers contains ".vbe"
    or $message_headers contains ".reg"
    or $message_headers contains ".shm"
    or $message_headers contains ".chm"
    or $message_headers contains ".cpl"
    or $message_headers contains ".crt"
    or $message_headers contains ".hlp"
    or $message_headers contains ".hta"
    or $message_headers contains ".shs"
    or $message_headers contains ".ade"
    or $message_headers contains ".adp"
    or $message_headers contains ".bas"
    or $message_headers contains ".inf"
    or $message_headers contains ".ins"
    or $message_headers contains ".isp"
    or $message_headers contains ".jse"
    or $message_headers contains ".mde"
    or $message_headers contains ".msc"
    or $message_headers contains ".msi"
    or $message_headers contains ".msp"
    or $message_headers contains ".mst"
    or $message_headers contains ".pcd"
    or $message_headers contains ".sct"
    or $message_headers contains ".shb"
    or $message_headers contains ".url"
    or $message_headers contains ".vb"
    or $message_headers contains ".wsc"
    or $message_headers contains ".wsf"
    or $message_headers contains ".wsh"
    or $header_content-type: contains "Content-Type: application/octet-stream"
    or $header_content-type: contains "Content-Type: application/x-msdownload"
    or $header_content-type: contains "Content-Type: audio/x-wav"
    or $header_content-type: contains "Content-Type: audio/x-midi"
    or $header_subject: contains "My details"
    or $header_subject: contains "Your details"
    or $header_subject: contains "Thank you!"
    or $header_subject: contains "That movie"
    or $header_subject: contains "Wicked screensaver"
    or $header_subject: contains "Your application"
    or $header_subject: contains "Re: Details"
    or $header_subject: contains "Re: My details"
    or $header_subject: contains "Re: Your details"
    or $header_subject: contains "Re: Thank you!"
    or $header_subject: contains "Re: That movie"
    or $header_subject: contains "Re: Wicked screensaver"
    or $header_subject: contains "Re: Your application"
    or $header_subject: contains "Re: Re: My details"
    or $header_subject: contains "Re: Approved"
    or $header_subject: contains "Undeliverable"
    then
    save "/dev/null" 660
    endif


    -------------------------------------------------------------


    Now I want to apply this rules to all domains in the server adding these lines to exim.conf but when I do that, exim fails.

    Where can I put these lines in exim.conf in order to apply the rules to all domains?


    Thanks for your help ;)
     
  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
    Haven't got a direct answer, but if you have a look at how antivirus.exim is hooked in, it might give you what you need.
     
  3. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Open /etc/exim.conf and find this:

    #!!# message_filter renamed system_filter
    system_filter = /etc/antivirus.exim

    Make a copy of the /etc/antivirus.exim file and put your own filters inside it. Open WHM exim editor, and put the new file name you created and replace the /etc/antivirus.exim.
     
Loading...

Share This Page