LinuxQuestions.org
Help answer threads with 0 replies.
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 06-18-2009, 04:19 PM   #1
Zero187
Member
 
Registered: May 2009
Posts: 32

Rep: Reputation: 15
IPTables has a "drop all anywhere" and "accept all anywhere"


As stated in the subject, I was looking through the INPUT chain rules and saw that there is a DROP all anywhere as well as an ACCEPT all anywhere.

I don't know that much about iptables, but are these rules working against each other? Should I delete both of them?

Or maybe I am interpreting this incorrectly?

Any explanation would be nice before I start messing around with iptables.

Thanks a lot,
Brian
 
Old 06-18-2009, 04:31 PM   #2
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
iptables are a bit more complicated than just that. They can also filter by interface and I have an INPUT rule that ACCEPTs all anywhere from the local interface and then DROPs all anywhere after ACCEPTing specific ports, knowing that all are from the outside facing interface. Messing with those rules does require being familiar with just how a packet flows through the process. I wouldn't suggest deleting them without that knowledge.
 
Old 06-18-2009, 04:34 PM   #3
Zero187
Member
 
Registered: May 2009
Posts: 32

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by david1941 View Post
iptables are a bit more complicated than just that. They can also filter by interface and I have an INPUT rule that ACCEPTs all anywhere from the local interface and then DROPs all anywhere after ACCEPTing specific ports, knowing that all are from the outside facing interface. Messing with those rules does require being familiar with just how a packet flows through the process. I wouldn't suggest deleting them without that knowledge.
I'm getting good with the SuSE firewall2 so I guess I'll just stick with that for now, although I do eventually want to learn iptables. Any suggestions on what I should read to help me understand it better (besides the MAN pages)?

Last edited by Zero187; 06-18-2009 at 04:36 PM.
 
Old 06-18-2009, 04:45 PM   #4
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
Try this one:
http://iptables-tutorial.frozentux.n...-tutorial.html
 
Old 06-18-2009, 07:09 PM   #5
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by Zero187 View Post
I don't know that much about iptables, but
  • are these rules working against each other?
  • Should I delete both of them?
  • Or maybe I am interpreting this incorrectly?
In order:
  • No (very probably)
  • No (certainly)
  • Yes (as far as I can tell)
Quote:
Any explanation would be nice before I start messing around with iptables.
OK, here we go (roughly): Rules are executed, one by one, in order So as a packet comes along, it meets the first rule, is tested against whatever test is implied by that rule and, if it matches, is sent off to be processed, as implied by the rule.

If it doesn't match, it is unprocessed by the first rule and then moves down to the next rule.

When (if) it falls all the way through the set of rules for a chain, there is another, implied, rule for the chain; the 'policy' for the chain, or, to be more explicit, 'a rule to deal with any packet that falls all the way through'. Having a policy of 'drop' is usually considered to be more sensible from a security point of view than 'accept'.

This process is described in a lot more detail in the frozentux tutorial (which is hardly light bedtime reading, except for serious insomniacs, but is an excellent manual). If, instead, you wanted a worked example, have a look at linuxhomenetworking. Their example is almost identical to the relevant chapter and appendix from Harrison's Linux Quick Fix Notebook - also excellent, but a bit more tutorial-ish, (where the supposed tutorial at frozen tux is more manual-ish).

Quote:
I'm getting good with the SuSE firewall2
A bit of advice; either use the SuSE firewall, or don't (or be prepared to struggle slightly). One of the troubles with 'going behind yast's back' to set up a set of firewall rules manually, is that yast has a habit of overwriting what you are doing, unless you are careful. You can get round this (either tell yast not to do anything with the firewall and do it all yourself, or let yast do what it does on boot and then modify the ruleset afterwards), but it does add a little complexity to the process.

For most purposes, Yast does a perfectly good job of writing a ruleset (I'm not trying to put you off learning - anything but), so you are probably not in the position of having to do this to 'cure' a 'broken' ruleset. But looking through the ruleset that it generates, and maybe even modifying what you tell yast and looking at the changes that it makes to the ruleset is all to the good as an easy learning stage.
 
  


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: interface on "192.168.1.0/24" won't route clients from "10.65.0.0" zivota Linux - Networking 2 06-09-2008 01:35 PM
net working eth0 eth1 wlan0 "no connection" "no LAN" "no wi-fi" Cayitano Linux - Newbie 5 12-09-2007 07:11 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
iptables not working for "accept" action rules vijfita Linux - Networking 7 05-13-2005 05:28 AM

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

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