Re: Filter or change tcp packets
- From: Pascal Hambourg <boite-a-spam@xxxxxxxxxxxxxxx>
- Date: Thu, 24 Apr 2008 16:41:59 +0200
Hello,
Nowitzki Rados a écrit :
Hello, I need to filter packets that are comming from certain server (IP
address/port number). Server sends packets to my client program, but some of
those packets cause client to crash (those packets are generated by other
server users because of hole in chat program). So I tried to configure iptables to search data section of tcp packets comming from that IP address
and if it finds "unwanted pattern that crash client", it should drop
packets. I managed to do that, but it seems like it was bad solution.
As Rick said, a better solution would be to patch/fix/update the client or stop using that service.
Problem is that when packet from server is dropped by iptables, my client
application stop working properly (I think it stops comunication with server
because of packet loss, but I am not sure). I read that when iptables drop
packet it does not notify sender about it.
The REJECT target can notify the sender with various ICMP error types or a TCP reset. TCP reset would close the connexion, not sure about ICMP error types.
Does that means that sender
continue to send same packet over and over again? (and because there is no
response from client side they stop to communicate).
Yes, TCP segments need to be acknowledged by the receiver.
If that is true is there any way to drop packet and to tell server to send
next one? Altough I can see another problem there because if that happens
client side would have wrong sequence number for next packet? Anyone have
idea how could I solve this problem?
I also thought about changing tcp packet data. Is there any way to do
something like this:
-when packet arives, program (or iptables) search pattern in its data
-if pattern is found, program (or iptables, but i doubt it has that feature)
change data in tcp packet, so that "unwanted pattern that cause buffer
overflow" is removed from it.
-changed packet is forwarded to client like nothing happened
I guess this could be done with the QUEUE target in iptables, which queues packets to userland. I cannot tell more about this. However there is no guaranty that the whole pattern is contained in a single segment, it could be split across two segments.
A better solution would be to use a proxy which would do the filtering (matching and mangling) in the data stream at application level rather than with iptables.
.
- References:
- Filter or change tcp packets
- From: Nowitzki Rados
- Filter or change tcp packets
- Prev by Date: ClarkConnect (Linux-Based Router) and IPV6
- Next by Date: Re: inconsistent HTTP download speeds on a LAN
- Previous by thread: Re: Filter or change tcp packets
- Next by thread: inconsistent HTTP download speeds on a LAN
- Index(es):
Relevant Pages
|