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

How to use ALLOWED_DEST_FQDN? #49

Open
alveox opened this issue Oct 18, 2023 · 1 comment
Open

How to use ALLOWED_DEST_FQDN? #49

alveox opened this issue Oct 18, 2023 · 1 comment

Comments

@alveox
Copy link

alveox commented Oct 18, 2023

Hi, from what i read restricting outgoing to an ip/fqdn is do able on socks5-server, is there any guide for it?

already tried "- ALLOWED_DEST_FQDN=(ip address) or - ALLOWED_DEST_FQDN=(cnn.com)" but nothing is working, the client cant open anything with that env enabled on compose.

@exaV
Copy link

exaV commented Dec 27, 2023

I face the same issue and investigated for a bit. The reason it does not work is that the filtering only implemented for domain names, not for ip addresses.

Here req.DestAddr.FQDN is checked against a pattern read from ALLOWED_DEST_FQDN
https://github.com/serjs/socks5-server/blob/master/ruleset.go#L22

However req.DestAddr.FQDN is only defined if the address type was fqdnAddress (the two other cases are ipv6Address and ipv4Address). Therefore if you connect directly to an ip-address while having ALLOWED_DEST_FQDN in place you just get an error.
https://github.com/armon/go-socks5/blob/master/request.go#L290

To fix this we would need another environment variable to configure allowed ip-address patterns for ipv4 and ipv6.

@serjs Could you add an option to the restrict destination ipv4 address?

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

No branches or pull requests

2 participants