LinuxQuestions.org
Review your favorite Linux distribution.
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 08-10-2015, 04:45 PM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Would drop rules at the top of input chain affect other protocols/traffic?


Still working on wrapping my brain around IPTables.

However I've noticed this issue. Alot of the rules that I've inherited have DROP rules, say at the beginning of the the INPUT Chain, such as:

Code:
1  0.0.0.0/0.0.0.0/0   port 136 DROP 
2  0.0.0.0/0.0.0.0/0   port 25 DROP
3  ACCEPT rules follow
I'm having issues trying to setup traffic for ports 5500, 5501 and 5502 and I'm wondering if having these two DROP rules for rule #1 and #2 would impact it?

If so, then why?
 
Old 08-11-2015, 04:05 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Please post complete (but obfuscated if necessary) 'iptables-save' output instead?
 
Old 08-12-2015, 09:48 AM   #3
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by unSpawn View Post
Please post complete (but obfuscated if necessary) 'iptables-save' output instead?

Here they are, with the last two octets obfuscated. I've bolded the DROP rules for the INPUT Chain. Again, my thinking is that the drop ones should be towards the end of the chain.

Code:
# Generated by iptables-save v1.3.5 on Tue Aug 11 08:23:12 2015
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
:INPUT-XXX-SUBNET - [0:0]
:INPUT-XXX-SUBNET - [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -p udplite -j DROP
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p udp -m udp --dport 123 -j ACCEPT
-A INPUT -s 143.83.XXX.XX -p tcp -m tcp --dport 8505:8535 -j ACCEPT
-A INPUT -s 143.83.XXX.XX -p tcp -m tcp --dport 8400:8404 -j ACCEPT
-A INPUT -s 143.83.XXX.XX -p tcp -m tcp --dport 8505:8535 -j ACCEPT
-A INPUT -s 143.83.XXX.XX -p tcp -m tcp --dport 8400:8404 -j ACCEPT
-A INPUT -s 143.83.XXX.XX -p tcp -m tcp -j ACCEPT
-A INPUT -s 143.83.XXX.XX -p tcp -m tcp -j ACCEPT
-A INPUT -s 128.XX.XXX.XXX -p tcp -m multiport --ports 80,443,591,8443 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 9898 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 9898 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 1521 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 1521 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 1521 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 1521 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p udp -m udp --dport 514 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 1158 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m multiport --ports 80,443,1158,5501,5502,5503 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 1158 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 5501 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 5502 -j ACCEPT
-A INPUT -s 143.83.XXX.XXX -p tcp -m tcp --dport 5502 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 13 -j DROP
-A INPUT -j INPUT-XXX-SUBNET
-A INPUT -j INPUT-XXX-SUBNET
-A INPUT -j RH-Firewall-1-INPUT
-A INPUT -s 127.0.0.1 -p tcp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -j DROP

Last edited by JockVSJock; 08-12-2015 at 06:32 PM. Reason: change quote tags to code tags
 
Old 08-12-2015, 05:33 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by JockVSJock View Post
(..) my thinking is that the drop ones should be towards the end of the chain.
0) Rule order seems off as you would usually start with loop back, then ESTABLISHED,RELATED etc, etc.
1) You've got INPUT-XXX-SUBNET targets that aren't used.
2) If these last two .XXX.XXX octets are the same you can combine single port rules with "-m multiport --dports start:end,other,other"
3) You've got a default DROP policy so all you generally speaking would need is explicit ACCEPT rules.
*Also next time please use [CODE][/CODE] tags instead of quote tags, thanks.
 
Old 08-12-2015, 06:45 PM   #5
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by unSpawn View Post
1) You've got INPUT-XXX-SUBNET targets that aren't used.

Thanks for the feedback, I will start to implement these suggestions.

I don't understand this statement, the previous admin setup chains for two subnets, and there are rules under the INPUT chain that pushes traffic into it. Is this not being used?


Quote:
Originally Posted by unSpawn View Post
2) If these last two .XXX.XXX octets are the same you can combine single port rules with "-m multiport --dports start:end,other,other"
This is one of the problems I face. THe last admin instead of assigning single port rules to say a subnet, this admin was doing it on an ip basis. Of course these ips belong to desktop computers, which are controlled by DHCP and with the changing addresses, this would cause chaos, which I'm still trying to get on top of. However your suggestions are helping with the cleanup process.
 
Old 08-14-2015, 06:09 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Well I remember inviting you in an earlier thread to post your cleaned up rule set for comments...
 
Old 08-18-2015, 03:11 PM   #7
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by unSpawn View Post
Well I remember inviting you in an earlier thread to post your cleaned up rule set for comments...
True.

For some reason, where I work is blocking that website, so I found a work around: http://linuxtopia.org/Linux_Firewall...les/index.html

Hopefully I will be submitting a few to critique.
 
  


Reply

Tags
drop, iptables


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
Is it necessary to drop specific flags in IPTABLES with an INPUT DROP policy? rootaccess Linux - Networking 5 08-22-2012 08:10 PM
iptables rules doesn't seem to affect openntpd reverse Linux - Security 14 11-25-2007 04:33 PM
need an app which protocols net traffic g-string 3 Linux - Networking 4 06-05-2005 10:03 AM
Process order of iptables chain rules. mrpc_cambodia Linux - Networking 1 07-14-2004 12:21 AM
forwarded traffic is caught by input chain kc8tbe Linux - Security 5 04-14-2004 02:14 PM

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

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