Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] remoteip allowlisting #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

[RFC] remoteip allowlisting #184

wants to merge 1 commit into from

Conversation

i-infra
Copy link

@i-infra i-infra commented Apr 1, 2024

Hi, I made this very simple implementation of allowlisting by remote-IP.

It relies on a single envar, ie OK_REMOTE_IPS=1.1.1.1,2.2.2.2,3.3.3.3...

I was wondering if you had a better idea for how this design should go, or if there is another implementation of this feature I missed?

Thank you for your work on this software!

@Jonney
Copy link
Contributor

Jonney commented Apr 25, 2024

I think you don't have to modify the code.
You just need to write your own code.

from pproxy import server,proto

ARGS='-l socks5://127.0.0.1:8080#user:pass -r socks5://192.168.0.1:8080 -v'
IP_WHITELIST=(
    '127.0.0.2',
)

origin_init=server.AuthTable.__init__
def init(self, remote_ip, authtime):
    if remote_ip not in IP_WHITELIST:
        raise Exception('Unauthorized IP')
    origin_init(self, remote_ip, authtime)

server.AuthTable.__init__=init
server.main(ARGS.split(' '))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants