BLU Discuss list archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss] Limit the number of ip addresses which can connect to a port
- Subject: [Discuss] Limit the number of ip addresses which can connect to a port
- From: warlord at MIT.EDU (Derek Atkins)
- Date: Wed, 01 Nov 2017 10:54:38 -0400
- In-reply-to: <CAJWk+TOjVd8a7DvZxTY3DdR5w6dLvNePeuJSC9uG+g=w1+=2pA@mail.gmail.com> (Tom Luo's message of "Tue, 31 Oct 2017 19:45:19 -0500")
- References: <CAJWk+TMC0434dz13VaDiFRogoeGRxpRqty2eUtnSp+0=HYyQmw@mail.gmail.com> <CAFv2jcYTbwfnZwYbYusR1+-KT4yGPR+COf=UBFhtAt6X_aR31Q@mail.gmail.com> <6d6633d0-54eb-49c6-85dc-2484c27a1c97@gmail.com> <CAJWk+TOjVd8a7DvZxTY3DdR5w6dLvNePeuJSC9uG+g=w1+=2pA@mail.gmail.com>
Tom, Tom Luo <mariolzx at gmail.com> writes: > 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. Just so I understand: You have a service running on a server which *anyone* can use. But once *someone* is using it, further connections can only come from that single IP address. And then, once all connections drop again (i.e., nobody is using the service), then it opens up to anyone on any IP address again until someone else connects? Do I have this right? If so, I'm honestly not sure how to do this outside the application itself. You MIGHT be able to do it with tcp_wrappers with some state on the machine for the number of open connections. Another option is that you MIGHT be able to do this with something like fail2ban + firewalld. Every time there is a first-time connection then you add a firewall rule that limits access to only that IP address, and then once the user "logs out" you remove that restriction. Of course you would need to ensure that the connection/disconnection get logged properly, and you'd need to write the fail2ban scripts. If you cannot modify the application itself then this might be challenging to get all the connect/disconnect messages to properly line up. > Thanks, -derek -- Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory Member, MIT Student Information Processing Board (SIPB) URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH warlord at MIT.EDU PGP key available
- Follow-Ups:
- [Discuss] Limit the number of ip addresses which can connect to a port
- From: mariolzx at gmail.com (Tom Luo)
- [Discuss] Limit the number of ip addresses which can connect to a port
- Next by Date: [Discuss] Limit the number of ip addresses which can connect to a port
- Next by thread: [Discuss] Limit the number of ip addresses which can connect to a port
- Index(es):