Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Member hostmedic's Avatar
    Join Date
    Apr 2003
    Location
    Ohio
    Posts
    552
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default block incoming mail in exim for specific domains except from 1 ip

    Greetings friends:

    After a nice long search - both here and some other forums - I am just not sure of the fix - so figured I would come here and ask...

    We are now providing an Anti-Spam appliance above our shared servers.
    For clients that purchase this service - we want to do the following

    1. Change the Clients mx record to use the anti-spam appliance (easy enough)
    2. block all incoming mail that comes direct to the server unless it is within an ip range and/also the anti-spam appliance.

    The trick of just blocking port 25 will not work - because the mail server will be used by other domains that are not subscribing to the anti-spam service.

  2. #2
    Member hostmedic's Avatar
    Join Date
    Apr 2003
    Location
    Ohio
    Posts
    552
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default firewall worked

    funny - found this old posting.
    A simple firewall setting worked just fine.

  3. #3
    Member
    Join Date
    Jul 2008
    Posts
    45

    Default

    Quote Originally Posted by hostmedic View Post
    funny - found this old posting.
    A simple firewall setting worked just fine.
    wats the exact rule you applied

  4. #4
    Member hostmedic's Avatar
    Join Date
    Apr 2003
    Location
    Ohio
    Posts
    552
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default depends on what firewall your using -

    in short - just block all access to port 25
    and then whitelist the ip you want mail from

    That would bypass your firewall setting of course...

    what firewall are you using - be easiest then to tell you the rule


    If iptables this should help



    SMTP is used to send mail. Sendmail, & Exim (both on cPanel) use the TCP port 25. Following two iptable rule allows incoming SMTP request on port 25 for server IP address 1.2.3.4 (open port 25):

    iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 1.2.3.4 --dport 25 -m state --state NEW,ESTABLISHED -j ACCEPT

    iptables -A OUTPUT -p tcp -s 1.2.3.4 --sport 25 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
    In order to block port 25 simply use target REJECT instead of ACCEPT in above rules.

    And following two iptables rules allows outgoing SMTP server request for server IP address 1.2.3.4:

    iptables -A OUTPUT -p tcp -s 1.2.3.4 --sport 1024:65535 -d 0/0 --dport 25 -m state --state NEW,ESTABLISHED -j ACCEPT

    iptables -A INPUT -p tcp -s 0/0 --sport 25 -d 1.2.3.4 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

    this should work as well - but just simply blocks completely

    Code:
    iptables -A INPUT -s 0.0.0.0 --dport 25 -j DROP

  5. #5
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    Default

    We use an Exim ACL.

    Directly under the line "check_recipient:" in advanced Exim conf...

    deny message = You may not make direct SMTP connections to this host
    log_message = untrusted host
    domains = +local_domains
    !hosts = 1.1.1.1 : 2.2.2.2 : 3.3.3.3 : 4.4.4.4 : 127.0.0.1
    !authenticated = *
    Has been working great for a couple of years now. Any host trying to make a direct connection will receive a "550 You may not make direct SMTP connections to this host" and it will be logged in exim log file as "untrusted host". It allows authenticated users to relay through and those IP's specified.

Similar Threads & Tags
Similar threads

  1. block domains and subdomains for spam, incoming emails
    By system1351 in forum E-mail Discussions
    Replies: 0
    Last Post: 07-07-2011, 03:56 PM
  2. Block Incoming Mail on a Server Level
    By webdr in forum E-mail Discussions
    Replies: 6
    Last Post: 09-13-2007, 03:21 PM
  3. Block POP3 access for specific mail
    By dimitar in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-18-2006, 03:03 PM
  4. block / deflect a specific incoming email address?
    By spaceman in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 12-05-2005, 07:14 AM
  5. how to block incoming mail senders?
    By ricardom in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 04-07-2004, 08:55 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube