LinuxQuestions.org
Visit Jeremy's Blog.
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-21-2015, 05:48 AM   #1
fornax
LQ Newbie
 
Registered: Jun 2011
Posts: 13

Rep: Reputation: Disabled
iptables does not block anything


Hi, I guess this is a rather simple problem, but I could not figure it out yet.

I am currently forced to work on a Ubuntu 14.04.1 (3.16.0-30-generic) and
face a really strange behavior, namely iptables not blocking anything.

Config:

Code:
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
COMMIT
Tried as well with explicit DROP anything rules in each chain.

As mentioned, I can see incoming traffic of all kinds on all interfaces with tcpdump -- just like iptables not being active at all.

I already removed ufw and network-manager which might be messing with the configuration.

Thanks for any hints on this.
 
Old 09-21-2015, 06:19 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Just because tcpdump shows traffic that does not mean iptables not blocking things. IIRC tcpdump shows traffic regardless of iptables settings.
Also have in mind that iptables works on the ip level thus arp packets are not effect by it.

With that out of the way did you try to connect to something from your machine to something outside of the machine? Can you ping your gateway for example?
Regarding the numbers behind the single chains. I'm not sure if they count up if the machine sees traffic in contrast of traffic beeing directed to it.

network-manager should not affect iptables. But ufw definitely should
 
1 members found this post helpful.
Old 09-21-2015, 06:29 AM   #3
fornax
LQ Newbie
 
Registered: Jun 2011
Posts: 13

Original Poster
Rep: Reputation: Disabled
Interesting, from my previous experience tcpdump never displayed any traffic that was blocked.
It seems you're right. My current setup is just generic traffic testing to a promisc interface
w/o any service actually listening. For ping there are no responses (as I would expect it).
Do you know a way I can force the listening socket behind iptables?
 
Old 09-21-2015, 08:25 AM   #4
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by fornax View Post
Interesting, from my previous experience tcpdump never displayed any traffic that was blocked.
It seems you're right. My current setup is just generic traffic testing to a promisc interface
w/o any service actually listening. For ping there are no responses (as I would expect it).
Searching for "tcpdump iptables" it seems that the output of tcpdump differs depending on the direction packets go. Incoming packages are first seen by tcpdump then by iptables. Outgoing packages first go through iptables then through tcpdump. Also i can't confirm this it makes sense. libpcap is used by tcpdump and might give some more info. One intresting sites is http://sgros-students.blogspot.de/20...h-tcpdump.html
Also this heavily depends on the interface you have tcpdump listen to. As well as promisc mode set or not.

Quote:
Originally Posted by fornax View Post
Do you know a way I can force the listening socket behind iptables?
Not sure what you ask for here. Searching "socket" within man iptables shows the "owner" module. Specially the --uid-owner option of it. And --socket-exists that matches if there is a socket.
"socket" module is also within the man page. NFLOG target and ULOG target as well.

If you just want to match a specific interface use -i eth0 for incoming on eth0 or -o eth0 for outgoing on eth0....
 
1 members found this post helpful.
Old 09-21-2015, 10:46 AM   #5
fornax
LQ Newbie
 
Registered: Jun 2011
Posts: 13

Original Poster
Rep: Reputation: Disabled
Sorry that was unclear. As the behavior really seems to depend on a lot of factors, I was looking for a way to explicitly force tcpdump to listen before and/or after iptables.
But the link you provided already somehow answers the question. At least I have a good point for further research.
Thank you for your help!
 
  


Reply

Tags
iptables



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 block IP Almaz Linux - Security 5 02-12-2015 04:58 PM
iptables - block in/out help rlbeaver Linux - Security 1 08-05-2013 07:41 PM
Iptables - How to block sites with Iptables. hackum Linux - Software 1 11-15-2011 07:05 PM
IPTABLES BLOCK ALL NON-US IP's cachemonet Linux - Security 3 06-14-2006 03:57 PM
IPTables and PPTPD :S (to block or not to block) thewonka Linux - Networking 0 03-24-2005 06:58 PM

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

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