ntop / n2n

Peer-to-peer VPN
GNU General Public License v3.0
6.07k stars 927 forks source link

Authentication: limit the number of connecting edges for every user #1118

Open datong-new opened 1 year ago

datong-new commented 1 year ago

n2n is a powerful and easy-to-use P2P VPN tool.

I have a specific use case that I believe other users may encounter as well. I want authentication for users connecting to the supernode, which has already been implemented in https://github.com/ntop/n2n/blob/dev/doc/Authentication.md.

Additionally, I would like to impose a limit on the number of devices (Edges) for each user. For instance, authorized users should only be able to use a maximum of two devices.

Does n2n currently have this functionality? If not, what would be the most efficient way to implement it with minimal development effort?

datong-new commented 1 year ago

I have a naive idea. Currently, n2n supports authentication through usernames and passwords. If I count the number of connections for each user when it connects to the supernode, incrementing the count for each new connection, and if the count exceeds a specified limit, the authentication will fail. Similarly, when a connection is disconnected, the count will decrease.

For this idea, I wonder if anyone has any suggestions or opinions. I'm not very familiar with the n2n code, so where would be the best place to make modifications if I want to add this functionality?

Logan007 commented 1 year ago

Hello,

Yes, it would be a change in the supernode code... if we only had one supernode. But we also need to think federated supernode scenario which makes it way more difficult, because counts would need to be kept track of over all the supernodes... for which I do not know a simple solution.