Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
iptables syntax question...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
wallace1819
Apprentice
Apprentice


Joined: 17 Aug 2002
Posts: 195
Location: VT

PostPosted: Wed May 28, 2003 3:46 pm    Post subject: iptables syntax question... Reply with quote

if I want to log all attempted incomming ssh connections is it better to use ...


Code:

$IPTABLES -A allow-ssh-traffic-in -p tcp --source-ports ssh --tcp-flags ALL SYN -j LOG --log-prefix "SSH-IN:"


or...

Code:

$IPTABLES -A allow-ssh-traffic-in -p tcp --source-ports ssh --tcp-flags SYN,RST,ACK SYN -j LOG --log-prefix "SSH-IN:"


the man pages sugests the 2ed option but is there any reason you all can think of not to use the first option?

wallace
Back to top
View user's profile Send private message
xedx
Tux's lil' helper
Tux's lil' helper


Joined: 23 May 2003
Posts: 93

PostPosted: Thu May 29, 2003 5:20 am    Post subject: ? Reply with quote

the 1st option which indicates ALL SYN is an illegal combination if im right its a syn flood
_________________
--+//+
Back to top
View user's profile Send private message
psp
Tux's lil' helper
Tux's lil' helper


Joined: 06 Aug 2002
Posts: 120
Location: Cape Town, South Africa

PostPosted: Thu May 29, 2003 12:53 pm    Post subject: Reply with quote

Perhaps it's for speed? Less flags to check. That's the only reason I can think.
Why do you use "--source-ports ssh" when you want incoming ssh connections. i.e. connections to your ssh server (dport 22)?

I use:
Code:

iptables -A ssh-in -i $ETH_IN -p tcp -s 0/0 -d my.ip.addr --dport 22 -m state --state NEW -j LOG --log-prefix "SSH-IN: "

This makes good use of iptables stateful inspection and should only log good connections.

xedx: The syntax "ALL SYN" means... check ALL the flags and make sure that only SYN is set.

Hope this helps...
Back to top
View user's profile Send private message
wallace1819
Apprentice
Apprentice


Joined: 17 Aug 2002
Posts: 195
Location: VT

PostPosted: Thu May 29, 2003 1:01 pm    Post subject: thx! Reply with quote

nice catch on the --source-ports mistake! Thx. and thx for the input.

another question... would a statement like ....

Code:
$IPTABLES -A allow-ssh-traffic-in -p tcp --dport ssh --tcp-flags SYN,ACK SYN -j LOG --log-prefix "SSH-IN:"


catch SYN,FIN and/or SYN,RST packets? It should right because the SYN is set and the ACK is unset everything else is ignored. Right?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum