Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660
Rep:
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.
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.
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660
Rep:
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.