Linux - Security This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
08-25-2006, 10:40 AM
|
#1
|
LQ Newbie
Registered: Aug 2006
Posts: 16
Rep:
|
SMTP iptables problem
Hello,
I'm having problems with getting iptables to work correctly with smtp. When I have the firewall off (default accept) it works fine. But when I turn it back on:
input -i eth0 -p tcp --dport smtp -j accept
output -o eth0 -p tcp --sport smtp -m state --state new,est.,rel. -j accept
It will not work. After reviewing the maillog, I can see a good email go through when the firewall is off in comparison to when the firewall is on and the email will not go through. The process stops and does not generate the sendmail line:
Code:
Aug 25 10:11:35 srv01 ipop3d[3346]: pop3 service init from 24.172.189.255
Aug 25 10:11:35 srv01 ipop3d[3346]: Auth user=venom@shadow.net host=rrcs-24-172-189-255.central.biz.rr.com [24.172.189.255] nmsgs=0/0
Aug 25 10:11:35 srv01 ipop3d[3346]: Logout user=venom@shadow.net host=rrcs-24-172-189-255.central.biz.rr.com [24.172.189.255] nmsgs=0 ndele=0
Aug 25 10:12:20 srv01 sm-acceptingconnections[3350]: AUTH=server, relay=rrcs-24-172-189-255.central.biz.rr.com [24.172.189.255], authid=venom@shadow.net@, mech=PLAIN, bits=0
Aug 25 10:12:20 srv01 sm-acceptingconnections[3350]: k7PECKE0003350: from=<venom@shadow.net>, size=316, class=0, nrcpts=1, msgid=<44EF028D.8040107@shadow.net>, proto=ESMTP, daemon=MTA, relay=rrcs-24-172-189-255.central.biz.rr.com [24.172.189.255]
Aug 25 10:12:20 srv01 sm-acceptingconnections[3350]: k7PECKE0003350: to=<w@twmi.rr.com>, delay=00:00:00, mailer=esmtp, pri=30316, stat=queued
Aug 25 10:12:21 srv01 MailScanner[2254]: New Batch: Scanning 1 messages, 860 bytes
Aug 25 10:12:21 srv01 MailScanner[2254]: Virus and Content Scanning: Starting
Aug 25 10:12:21 srv01 MailScanner[3353]: Unrar command /usr/bin/unrar does not exist or is not executable, please either install it or remove the setting from MailScanner.conf
Aug 25 10:12:21 srv01 MailScanner[2254]: Uninfected: Delivered 1 messages
On the good email, this line is added to the end:
Code:
Aug 25 10:05:12 srv01 sendmail[3125]: k7PE58BZ003119: to=<w@twmi.rr.com>, delay=00:00:04, xdelay=00:00:03, mailer=esmtp, pri=120321, relay=orngca-02.mgw.rr.com. [66.75.160.148], dsn=2.0.0, stat=Sent (ok: Message 1353941463 accepted)
Any help is greatly appreciated, I've been fighting with this for a couple days now. Thanks in advance!
|
|
|
08-25-2006, 11:43 AM
|
#2
|
Senior Member
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,191
Rep:
|
Quote:
Aug 25 10:11:35 srv01 ipop3d[3346]: pop3 service init from 24.172.189.255
Aug 25 10:11:35 srv01 ipop3d[3346]: Auth user=venom@shadow.net host=rrcs-24-172-189-255.central.biz.rr.com [24.172.189.255] nmsgs=0/0
|
i see pop3 there, you probably need to allow 110 also.
|
|
|
08-25-2006, 02:19 PM
|
#3
|
LQ Newbie
Registered: Aug 2006
Posts: 16
Original Poster
Rep:
|
Re
Thanks, pop3 = 110 in my /etc/services so they're one in the same. Also, pop3 is working fine, I can receive emails with no problem. I just can't send them.
|
|
|
08-25-2006, 03:18 PM
|
#4
|
Senior Member
Registered: Dec 2003
Location: Shelbyville, TN, USA
Distribution: Fedora Core, CentOS
Posts: 1,019
Rep:
|
Is all outgoing traffic being filtered? If so you should probably have a rule that allows anything that is outgoing if it is established or related. I see you have one rule that applies does that for port 25, but go ahead and let it all out to see if the problem is related to the outgoing rules.
Also, maybe you could turn on logging for your filewall and see what happens when an email is sent.
|
|
|
08-25-2006, 04:50 PM
|
#5
|
LQ Newbie
Registered: Aug 2006
Posts: 16
Original Poster
Rep:
|
All outgoing/incoming/forward policies are set to drop. So yes, only allowed connections are allowed outbound. All of my other outgoing rules are established, with exception to ftp (related).
I've tried both ways... allowing input to accept, and then turning it back to drop as well as turning output to accept. Neither of those work. The only way that the email is sent is if I change both input and output to accept.
How do I turn on firewall logging?
|
|
|
08-25-2006, 05:08 PM
|
#6
|
Senior Member
Registered: Dec 2003
Location: Shelbyville, TN, USA
Distribution: Fedora Core, CentOS
Posts: 1,019
Rep:
|
It depends how you did your firewall. If you did it manually (meaning created a script that controls the rules) you can do something like this:
iptables -A INPUT -i eth0 -p tcp --dport 25 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 25 -j LOG --log-prefix [SMTP LOGGGING]
I'm pretty sure this will log everything incomming to port 25
|
|
|
08-25-2006, 07:15 PM
|
#7
|
LQ Newbie
Registered: Aug 2006
Posts: 16
Original Poster
Rep:
|
Hey,
Thanks for the suggestion. Another friend of mine said the same thing and I started messing around logging different things both incoming and outgoing, as well as whatever else the server was dropping.
In the end, I found the solution which was to add the following rules:
input -i eth0 -p tcp --dport smtp -state new,established -j accept
input -i eth0 -p tcp --dport 1024: --sport smtp -j accept
output -o eth0 -p tcp --sport smtp -state established -j accept
output -o eth0 -p tcp --sport 1024: --dport smtp -j accept
Thanks for the help, greatly appreciated!! 
|
|
|
All times are GMT -5. The time now is 12:00 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.
|
Latest Threads
LQ News
|
|