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.

Reject senders based on wildcard domain names like *.link

Discussion in 'E-mail Discussions' started by ebizindia, Dec 3, 2014.

  1. ebizindia

    ebizindia Well-Known Member

    Joined:
    Oct 13, 2005
    Messages:
    72
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    Kolkata, India
    cPanel Access Level:
    Root Administrator
    Hi

    We want to reject all mails from domains like *.link and *.*.link at the earliest stage, server level (not domain level). I have searched around but no working solution could be located. We don't want to mark these as spam. We just want to delete these straightaway.

    Can you please help?

    Some additional information to help you:

    Centos server, running cpanel ver 11.46.0 (build 17). Has mailscanner installed by Configserver team.
     
  2. ebizindia

    ebizindia Well-Known Member

    Joined:
    Oct 13, 2005
    Messages:
    72
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    Kolkata, India
    cPanel Access Level:
    Root Administrator
    Nice one. Thanks Michael.

    I have applied the custom filter option and it seems to work. Do you suggest having one if with several ORs or several blocks, each with one rule?
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,776
    Likes Received:
    663
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  4. ebizindia

    ebizindia Well-Known Member

    Joined:
    Oct 13, 2005
    Messages:
    72
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    Kolkata, India
    cPanel Access Level:
    Root Administrator
    Ref: Exim custom filter

    The code below does not stop the mail from someone@gmail.com. Any clue? I restarted Exim after saving the custom filter and it is also set as the custom filter in the WHM Exim configuration.

    if first_delivery
    and ("$h_from:" contains "somename@gmail.com")
    then
    seen finish
    endif

    Edit: Typo corrected
     
  5. IGonza

    IGonza Member

    Joined:
    Dec 6, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    can it be achieved with the method described here ? http://forums.cpanel.net/f43/exim-how-block-domains-239182.html#post984082

    I use that method to block certain domains and it works fine, but I could not find a way to block whole tld.
    I just don't want to have many methods/places to block incoming emails. That way one day it will be hard to find all blocks/filters in case of a fault block.

    Thanks.
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,466
    Likes Received:
    196
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    3 posts above yours here, is a link posted by cPanelMichael. Have a peek at that one.
     
  7. IGonza

    IGonza Member

    Joined:
    Dec 6, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I saw that post and method. But I asked how to do it (if possible) with the method described here:

    # Inserted to block domains access
    # Local from blacklist: /etc/exim_blacklist

    reject_domains:

    driver = redirect
    # RBL Blacklist incoming hosts
    domains = +exim_blacklist
    allow_fail
    data = :fail: Connection rejected: SPAM source $domain is blacklisted.
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,776
    Likes Received:
    663
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    The method in the referenced thread uses an Exim filter rule, whereas the method you posted is a modification of the Exim configuration. You are welcome to use whichever method you prefer, but you may want to test both methods to ensure they are working as intended.

    Thank you.
     
  9. ebizindia

    ebizindia Well-Known Member

    Joined:
    Oct 13, 2005
    Messages:
    72
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    Kolkata, India
    cPanel Access Level:
    Root Administrator
    I did the following and it is not working (FWIW, I use Exim and Mailscanner both):

    I changed the Exim filter to cpanel_exim_filter_custom

    In this file, I have the following:

    if "$header_from:" ends ".link"
    or "$header_from:" ends ".rocks"
    then
    seen finish
    endif

    I had tried with $h_from also.


    We have also tried

    if "$header_from:" ends ".link"
    or "$header_from:" ends ".rocks"
    then
    pipe "/dev/null"
    endif

    Nothing is stopping the mail.

    I am assuming that Exim gets to handle the mail first and then Mailscanner takes over. Is it possible that Mailscanner is bypassing the Exim filter and therefore the filter is not having any effect?

    TIA
     
  10. stormy

    stormy Well-Known Member

    Joined:
    Nov 22, 2003
    Messages:
    109
    Likes Received:
    6
    Trophy Points:
    18
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    #11 stormy, Jan 14, 2015
    Last edited: Jan 14, 2015
  11. ebizindia

    ebizindia Well-Known Member

    Joined:
    Oct 13, 2005
    Messages:
    72
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    Kolkata, India
    cPanel Access Level:
    Root Administrator
    Thanks Stormy. However please note that I have set up filters to delete these mails but the filter does not seem to work. That is my primary concern here.
     
Loading...

Share This Page