Skip to contentSkip to conversation

ssh

DISCUSSION Daniel Sercaianu 4 participants 4 messages Jun 24, 2002

lore
Share & tools
lore
#0 lore raw

Hello,

How can I drop ssh packets for destination hosts to which destination port is unknown and different from 22/tc?.

Daniel

#1 lore raw
Quoted 4 lines · Daniel Sercaianu

Hello,

How can I drop ssh packets for destination hosts to which destination port is unknown and different from 22/tc?.

I can think of two answers to this:

1. You can't. Netfilter / IPtables works by port number, not by content, so
you can only filter by port number.

2. You allow through the traffic on the port numbers you want, and you block
everything else. Doesn't stop someone running an SSH server on port 80,
though, if you're trying to allow web access.

Antony.

#2 lore raw
Quoted 2 lines

1. You can't. Netfilter / IPtables works by port number, not by content, so
you can only filter by port number.

Hmm, maybe you could...
Look:
1. look for a openingpacket with ssh connection characteristics, say a version string and mark packets, use recent module, put them to a seperate chain. something like that.
2. filter by port number.

What do you think?

Maciej

#3 lore raw
Quoted 7 lines · Maciej Soltysiak
Quoted 2 lines

1. You can't. Netfilter / IPtables works by port number, not by content, so
you can only filter by port number.

Hmm, maybe you could...
Look:
1. look for a openingpacket with ssh connection characteristics, say a version string and mark packets, use recent module, put them to a seperate chain. something like that.

Yes. Very expensive though and not full-proof in case of fragments.

Ramin

Quoted 6 lines

2. filter by port number.

What do you think?

Maciej