[Discuss] Limit the number of ip addresses which can connect to a port

Dale R. Worley worley at alum.mit.edu
Wed Nov 1 21:52:37 EDT 2017


> From: Tom Luo <mariolzx at gmail.com>
>
> Yes. I want only one IP gets access to the service. However, I don't own
> this application and I don't have the source code. That is why I can only
> using firewall to handle it.
> If there is no software capable to handle this, I am thinking about writing
> a shell script to do it myself.

One way to do this would be to use "tcpforward", which is out there.
There forwards incoming TCP connections to a specified host/port.
Firewall your application so that it can receive connections only from
localhost.  Set up tcpforward to forward to your application's port on
127.0.0.1.  Then modify tcpforward to record the originating host of any
connection request, and check that any subsequence requests come from
the same host.

(Of course, whoever is trying to make the connections can set up
tcpforward on some host, and relay all their connection attempts through
it.)

Dale



More information about the Discuss mailing list