LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-29-2007, 07:52 PM   #1
alizard
Member
 
Registered: Jan 2003
Posts: 56

Rep: Reputation: 15
a simple question about ipchains (I hope)


I'm trying to create an ipchains rule which will take any output from localhost - SAMBA port 139 (for instance) that's going to eth0 and DROP it.

So far, every attempt I've made to write a rule to do that has failed, it doesn't show up when I do:
# ipchains -vnL

Here are examples of what I tried that failed:

iptables -A OUTPUT -o eth0 -p tcp --sport 901 --syn -j DROP
iptables -A OUTPUT -o eth0 -p udp --sport 901 -j DROP


The input from eth0 to port 901 drop command works fine:

iptables -A INPUT -i eth0 -p tcp --dport 901 -j DROP


thanks
 
Old 10-29-2007, 10:14 PM   #2
merize147
Member
 
Registered: Oct 2004
Location: Where ever I put down Lappie
Distribution: Dragged kicking and screaming to RHEL
Posts: 132

Rep: Reputation: 15
the "-i" does not stand for input it's "interface". change the "-o" to a "-i"

/sbin/iptables -A OUTPUT -o eth0 -p tcp --sport 901 --syn -j DROP
change to:
/sbin/iptables -A OUTPUT -i eth0 -p tcp --sport 901 --syn -j DROP
 
Old 10-29-2007, 10:26 PM   #3
alizard
Member
 
Registered: Jan 2003
Posts: 56

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by merize147 View Post
the "-i" does not stand for input it's "interface". change the "-o" to a "-i"

/sbin/iptables -A OUTPUT -o eth0 -p tcp --sport 901 --syn -j DROP
change to:
/sbin/iptables -A OUTPUT -i eth0 -p tcp --sport 901 --syn -j DROP
I'll give it a try - thanks
 
Old 10-29-2007, 10:28 PM   #4
alizard
Member
 
Registered: Jan 2003
Posts: 56

Original Poster
Rep: Reputation: 15
just tried it

Quote:
Originally Posted by merize147 View Post
the "-i" does not stand for input it's "interface". change the "-o" to a "-i"

/sbin/iptables -A OUTPUT -o eth0 -p tcp --sport 901 --syn -j DROP
change to:
/sbin/iptables -A OUTPUT -i eth0 -p tcp --sport 901 --syn -j DROP

iptables v1.3.8: Can't use -i with OUTPUT
 
Old 10-30-2007, 03:02 AM   #5
alizard
Member
 
Registered: Jan 2003
Posts: 56

Original Poster
Rep: Reputation: 15
never mind

Quote:
Originally Posted by merize147 View Post
the "-i" does not stand for input it's "interface". change the "-o" to a "-i"

/sbin/iptables -A OUTPUT -o eth0 -p tcp --sport 901 --syn -j DROP
change to:
/sbin/iptables -A OUTPUT -i eth0 -p tcp --sport 901 --syn -j DROP
looks like the command was right to begin with (a look at the ipchains man file says -o is out interface, -i is input interface


Chain OUTPUT (policy ACCEPT 3 packets, 211 bytes)
pkts bytes target prot opt in out source destination
0 0 DROP udp -- * eth0 0.0.0.0/0 0.0.0.0/0 udp spt:901
0 0 DROP tcp -- * eth0 0.0.0.0/0 0.0.0.0/0 tcp spt:901 flags:0x17/0x02
0 0 DROP tcp -- * eth0 0.0.0.0/0 0.0.0.0/0 tcp spt:137
0 0 DROP udp -- * eth0 0.0.0.0/0 0.0.0.0/0 udp spt:137

with the matching rules:

iptables -A OUTPUT -o eth0 -p udp --sport 901 -j DROP
iptables -A OUTPUT -o eth0 -p tcp --sport 901 --syn -j DROP
iptables -A OUTPUT -o eth0 -p tcp --sport 137 -j DROP
iptables -A OUTPUT -o eth0 -p udp --sport 137 -j DROP


The problems appears to be that it didn't like where I put the second batch of drop rules at the end, and then, for some reason, ipchains either REALLY doesn't like:
-p all
or I somehow failed to use it properly.

Thanks anyway, you got me on what I think is the right track. I've made more progress in the last few minutes than I've made in the last few days.
 
  


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
Simple Samba question (I hope) crashsystems Linux - Networking 1 07-05-2006 10:56 AM
Need help with simple problem....I hope phlav Linux - Newbie 4 01-06-2006 05:43 PM
Simple SH Error - I hope... Micah Programming 5 06-28-2005 10:41 PM
Simple Question (I hope) jon3k Linux - General 3 04-13-2005 02:51 PM
Simple grep question - I hope ! MiguelE Linux - Newbie 3 04-16-2004 08:46 AM

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

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