Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 1 of 1
  1. #1
    Member
    Join Date
    May 2003
    Posts
    239

    Default How to Block Port 25 Spam in FreeBSD IPFW

    This tip will provide you information on how to block port 25 for anything but the Exim mail server.

    By default, FreeBSD uses ipfw as a firewall rule (compared to Linux iptables). You simply need to add the following rules through shell command line as a root user:

    prompt# ipfw add 100 allow tcp from any to any dst-port 25 uid root
    prompt# ipfw add 100 allow tcp from any to any dst-port 25 uid mailnull
    prompt# ipfw add 100 allow tcp from any to any dst-port 25 uid mailman
    prompt# ipfw add 100 allow tcp from me to me dst-port 25
    prompt# ipfw add 101 deny log tcp from any to any dst-port 25 out

    ** Updated by removing allow from uid nobody, and replaced it with allow from me to me which enables sendmail to communicate with Exim without needing to exit. However, if you are not running SUPHP and require your PHP application to connect to an external mail server, you'll need to add:
    prompt# ipfw add 100 allow tcp from any to any dst-port 25 uid nobody

    Hope this helps people looking to implement SMTP Tweak but running on FreeBSD.

    Tamouh
    Last edited by hicom; 03-07-2010 at 01:24 AM.

Similar Threads & Tags
Similar threads

  1. IPFW firewall rules for Cpanel on FreeBSD server
    By daniele81 in forum cPanel and WHM Discussions
    Replies: 16
    Last Post: 04-25-2008, 05:43 PM
  2. SBC ISP block port 26?
    By aboyz in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 01-10-2006, 03:14 PM
  3. How to block telneting to port 25 ???
    By bsasninja in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-16-2005, 11:27 AM
  4. iptables - how to block a port to one IP?
    By minotauro in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 10-11-2004, 11:10 AM
  5. How do I block port 25 exim?
    By pingo in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-31-2003, 05:14 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube