simple-socks icon indicating copy to clipboard operation
simple-socks copied to clipboard

IP Authentication

Open mehdyhaghy opened this issue 6 years ago • 5 comments

Does simple-socks support IP Authentication (IP White Listing) ?

mehdyhaghy avatar Feb 28 '20 01:02 mehdyhaghy

https://github.com/brozeph/simple-socks/blob/master/examples/createServerConnectionFilter.js#L6

The example above is for whitelisting, but with a dns lookup of hostname based on the value of address. Would the address value work for you if you’re looking to whitelist on IP specifically?

brozeph avatar Feb 28 '20 01:02 brozeph

@brozeph
I'm trying to authenticate proxy users based on originating IP address. the above sample filters based on destination host.

mehdyhaghy avatar Feb 28 '20 03:02 mehdyhaghy

@mehdyhaghy, thank you for clarifying! There is an ability to get the originating socket via the handshake event: https://github.com/brozeph/simple-socks#handshake

You could perform a check at that point and close the socket... but this isn't quite elegant. I feel like the right path is to extend the connectionFilter and support both origin and destination filtering.

brozeph avatar Mar 13 '20 00:03 brozeph

Also, worth noting, the socket for the origin (client) connection is provided in the connectionFilter event in v1.0.4 and earlier. Again, this isn't as elegant or consistent with the destination portion of the API... revising in v2.0.0.

brozeph avatar Mar 13 '20 00:03 brozeph

@mehdyhaghy - I've updated the connectionFilter in v2.0.0 to make it a lot more straightforward to access the origin and destination for filtering purposes: https://github.com/brozeph/simple-socks#connectionfilter

brozeph avatar Mar 13 '20 21:03 brozeph