LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 02-09-2004, 06:22 PM   #1
atticboy1
LQ Newbie
 
Registered: Jan 2004
Posts: 13

Rep: Reputation: 0
Firewall and sendmail


I am using iptables as a firewall on a 450 MHz system, and I have another system which is used for my email server behind it.
I was wondering if there was a way to block external users from being able to connect to port 25, but still allow my mail to get to my email server and from my email server.
Here is the current rule I use:

$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -p tcp --dport 25 \
-m state --state NEW,ESTABLISHED,RELATED -j ACCEPT


$IPTABLES -A PREROUTING -t nat -p tcp -d $EXTIP --dport 25 \
-j DNAT --to 192.168.1.4:25
 
Old 02-09-2004, 07:18 PM   #2
pembo13
Member
 
Registered: May 2003
Location: Caribbean
Distribution: Fedora Core2
Posts: 403

Rep: Reputation: 30
Have you considered settign up Authentication on SMTP?
 
Old 02-09-2004, 07:25 PM   #3
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
If you mean allowing outside email to get in, you still need to allow the external access to port 25. And users will connect to port 110 or 143 depending on pop or imap. So just don't open external access to those. Also, in the mail server config - disable relaying for anything but local network.

Last edited by TBC Cosmo; 02-09-2004 at 07:27 PM.
 
Old 02-09-2004, 08:29 PM   #4
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 going to block port 25 and still be able to get mail? Are you aware of how SMTP actually works???

By the way, if you're concerned about Sendmail being a security risk (which you should be), consider using Postfix or Qmail instead. They're both much more secure than Sendmail.
 
Old 02-09-2004, 11:04 PM   #5
atticboy1
LQ Newbie
 
Registered: Jan 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Really, there is only one user which needs to get mail on this mail server. Since I am a "newbie," maybe I am not altogether familiar with the exact details of sendmail, but we all have to start somewhere.
Other than the access list for sendmail, any other suggestions?
Pembo13, what do you mean by authentication by smtp?
TBC Cosmo, I have pop running on my box, could you be more specific?
Thanks, I appreciate the help.
 
Old 02-10-2004, 12:08 AM   #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
In order to receive mail for your domain, it has to be delivered to you, right? How is the mail going to be delivered if there isn't a network path for it? It doesn't just magically appear. The SMTP protocol uses TCP port 25 to receive e-mail, that is why you need it open through your firewall to the Sendmail server. If port 25/tcp is not open, then mail cannot be delivered--it's as simple as that. The above iptables rules are exactly what you need in order to allow the bare minimum for mail to be delivered.

Now perhaps you could explain in greater detail what you're trying to accomplish. Does your MX record point to your IP address, or does it point to your ISP or some other host? If another host acts at your primary MX record, you can tighten up your iptables rules to only receive mail from your MX host, i.e. just specify the IP of the MX host as the source IP address. That would block any random host on the Internet from sending mail directly to your server, but of course they could still send mail to your MX host and it would eventuall be delivered to your mail server.

Also, do any users need to fetch their e-mail from outside your firewall, or are they all going to connect from inside your firewall? If you're going to allow outside retrieval, what protocol will be used: POP3, IMAP4, or some type of webmail? If you're allowing retrieval from outside, then you'll need to open ports for the protocols you're going to use. POP3 is 110/tcp, IMAP4 is 143/tcp, HTTP (which is usually used for webmail) is 80/tcp. There are also TLS/SSL encrypted flavors of the aforementioned that use different ports, 995/tcp, 993/tcp, and 443/tcp respectively.
 
Old 02-12-2004, 12:16 AM   #7
witeshark
Member
 
Registered: Jan 2004
Location: Miami FL
Distribution: Mac OS X 10.4.11 Ubuntu 12.04 LTS
Posts: 429

Rep: Reputation: 30
Post

//moderator.note: removed off topic remark.

Last edited by unSpawn; 02-12-2004 at 12:52 AM.
 
Old 02-12-2004, 12:48 AM   #8
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Witeshark, if you have an issue with one of the mods then I suggest you take it up with him or with Jeremy directly, off of the forum. Posting comments like that are completely unacceptable and I take offense to them. Tricky has contributed a huge amount to this site and I consider him to be one of the best mods here. You can consider this a public warning against posting further rubbish like that.

Last edited by Capt_Caveman; 02-12-2004 at 12:54 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
sendmail on solaris with no hostname & ipfw (or other firewall) tutorials Maidros Solaris / OpenSolaris 1 07-10-2005 01:34 PM
Help! Can I install an smtp Server/(sendmail) on my firewall? mfeoli Linux - Networking 4 02-12-2004 09:19 AM
Firewall Builder sample firewall policy file ? (.xml) nuwanguy Linux - Networking 0 09-13-2003 12:32 PM
Setting BIND/Sendmail behind a broadband router/firewall ppuddick Linux - Networking 1 03-27-2003 06:20 PM
Sendmail - RunAsUser=sendmail:mail/What files to i have to change ForumKid Linux - Security 45 01-18-2002 11:47 AM

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

All times are GMT -5. The time now is 03:16 AM.

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