LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 09-15-2011, 07:39 AM   #1
msasson
LQ Newbie
 
Registered: Sep 2011
Posts: 3

Rep: Reputation: Disabled
iptables question


Hi There,

I have a question regarding iptables on Debian. What am I doing wrong kind of question. I want to be able to monitor remote machines from my zabbix server. I have put in the following commands in hope of opening the input chain to ssh, http, zabbix_agent and zabbix_trap:

iptables -A INPUT -p tcp --dport ssh -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 10050 -j ACCEPT
iptables -A INPUT -p tcp --dport 10051 -j ACCEPT
iptables -I INPUT 1 -i lo -j ACCEPT
iptables -A INPUT -j DROP

I have not touched the output chain and it is wide open. Once I executed the last command "iptables -A INPUT -j DROP" I can no longer go out on port 10050 on remote machines.
telnet 1.2.3.4 10050 from the server times out.
ssh & http connections are fine btw.

Thank You.
Mark
 
Old 09-15-2011, 09:49 AM   #2
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Most types of communications have return traffic on higher numbered ports. For example, when you go to a web site, you connect to that server on it's port 80, but you are typically using a very high numbered port. Without a rule line to accept established and related connections, you communications will only be one way as the return traffic will be blocked. The trick is that you can't know in advance what the high numbered return port will be, hence you need to make use of the state-full functions of iptables. You could do this with a rule (place above or below your loopback rule) like this:
Code:
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
 
1 members found this post helpful.
Old 09-15-2011, 10:37 AM   #3
msasson
LQ Newbie
 
Registered: Sep 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Smile iptables question

Hi,

Thank you for the reply and the explanation. I did as you suggested and it works very nicely.

Thanx
 
Old 09-15-2011, 12:00 PM   #4
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
I'm glad that worked for you. I thought you might also find these iptables tutorials interesting. There LOTS of them out there, but I think these are pretty good.
First: http://bodhizazen.net/Tutorials/iptables. There is also one from this author about preventing DOS attacks. Overall, the site is a good one with a lot of information.
Second: http://www.frozentux.net/iptables-tutorial/chunkyhtml/ This one is courtesy of Win32sux. It is a rather large document, but is comprehensive.
 
Old 09-15-2011, 02:36 PM   #5
msasson
LQ Newbie
 
Registered: Sep 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you. I will check these sites out.
 
  


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
iptables question sang_froid Linux - Security 6 05-14-2010 03:16 PM
Question for iptables. mkp Linux - Newbie 13 11-16-2009 08:36 AM
Iptables question Hammett Linux - Networking 8 09-09-2007 06:38 PM
iptables question vijeesh Linux - Newbie 2 08-06-2006 03:20 AM
iptables question ruben0076 Linux - Networking 2 01-16-2005 12:26 PM

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

All times are GMT -5. The time now is 01:34 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