LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-03-2008, 03:51 AM   #1
Kumonryu1971
LQ Newbie
 
Registered: Mar 2008
Location: Lancashire, UK
Posts: 2

Rep: Reputation: 0
iptables MessageLabs smtp configuration


We are using MessageLabs to filter our email. I have been trying to lock down our firewall to only accept smtp connections from the messagelabs mail servers using the following;

INPUT -p tcp -m tcp --dport 25 -m iprange --src-range xxx.xxx.xxx.xxx-xxx.xxx.xxx.xxx -j ACCEPT

I have done this for each of ML's IP ranges.

However, some mail is still getting through from other hosts (spammers) by directly connecting to our mail server.

What else do I need to lock down to prevent this?

Thank you.
 
Old 07-03-2008, 04:30 AM   #2
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 55
You are accepting from them
Quote:
I have done this for each of ML's IP ranges.
- but do you deny others?
A DROP rule for port 25 as the last line?
 
Old 07-03-2008, 05:48 AM   #3
Kumonryu1971
LQ Newbie
 
Registered: Mar 2008
Location: Lancashire, UK
Posts: 2

Original Poster
Rep: Reputation: 0
This is my config file.

eth0 is a local NIC. eth1 is the external NIC.

Sorry for my ignorance, but I think I have denied all access to eth1 on port 25, except to the IP's listed below.

Thank you.

:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [559:660700]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -i eth0 -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p ipv6-crypt -j ACCEPT
-A RH-Firewall-1-INPUT -p ipv6-auth -j ACCEPT
-A RH-Firewall-1-INPUT -d 224.0.0.251 -p udp -m udp --dport 5353 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 25 -m iprange --src-range 85.158.136.0-85.158.143.255 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 25 -m iprange --src-range 216.82.240.0-216.82.255.255 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 25 -m iprange --src-range 117.120.16.0-117.120.23.255 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 25 -m iprange --src-range 193.109.254.0-193.109.255.255 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 25 -m iprange --src-range 194.106.220.0-194.106.221.255 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 25 -m iprange --src-range 195.245.230.0-195.245.231.255 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 25 -m iprange --src-range 62.231.131.0-62.231.131.255 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 25 -m iprange --src-range 212.125.75.0-212.125.75.31 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 25 -m iprange --src-range 62.173.108.16-62.173.108.31 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 25 -m iprange --src-range 62.173.108.208-62.173.108.223 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 110 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
 
Old 07-03-2008, 05:53 AM   #4
ddaemonunics
Member
 
Registered: May 2008
Location: Romania
Distribution: Debian
Posts: 242

Rep: Reputation: 41
I think there should by a DROP rule or policy

Last edited by ddaemonunics; 07-03-2008 at 06:07 AM.
 
Old 07-03-2008, 06:53 PM   #5
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
Quote:
Originally Posted by ddaemonunics View Post
I think there should by a DROP rule or policy
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
 
Old 07-03-2008, 06:57 PM   #6
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
How are you making the determination that other IPs are connecting to your mail server? It's possible that they are forging headers to appear to have come from somewhere else, when the mail is actually going through MessageLabs but simply not getting blocked.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SMTP AND POP3 through iptables vedang Linux - Server 5 01-30-2008 11:47 PM
IPTABLES and SMTP daveginorge Linux - Networking 1 01-24-2007 04:14 PM
SMTP iptables problem venom_casos Linux - Security 6 08-25-2006 07:15 PM
Iptables Configuration for pop3 and smtp access ! help Pluster Linux - Networking 3 05-13-2006 12:24 AM
SMTP issue with iptables dragonleech Linux - Security 4 12-21-2005 10:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration