We have an old multiplayer game (no source code) which crashes any time someone sends the server unexpected packets, and many of the players use telnet to do it with ease. I'm using iptables, and I want to filter out packets (and drop the connection) that the game server will not recognize. I want to do the following to the game server's port:
Pseudocode
if (PSH flag && Payload.Length > 0 bytes && Payload.Length < 6 bytes)
{
// reject data, and drop client
}
else if (PSH flag && Payload.Length > 2)
{
if (First3BytesOfPayload Not in [7f:ef:09, dc:0b:09, 08:00:09])
{
// reject data, and drop client
}
}
This is not a foolproof solution, but it should work good enough for the few people we have. How can I accomplish this with iptables, if at all?
Thank you for your time.