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

Proxy SOCKS support #3311

Open
1 of 3 tasks
linkdd opened this issue Oct 16, 2024 · 4 comments
Open
1 of 3 tasks

Proxy SOCKS support #3311

linkdd opened this issue Oct 16, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@linkdd
Copy link
Contributor

linkdd commented Oct 16, 2024

Problem to solve

ssh -D8080 user@host

curl --socks5 localhost:8080 https://httpbin.org/anything

Proposal

In the [Options] section, the proxy field should be a URL, such as:

  • http://localhost:8012
  • socks5://localhost:8012
  • ...

The scheme of the URL could then be used to determine the type of proxy (no scheme would default to HTTP for backward compatibility) we want to connect to.

Then, we should be able to connect to SOCKS proxy as demonstrated with cURL above.

EDIT: Let's add instead a sock5 request option with the host and port of the SOCKS proxy to use.

Additional context and resources

We are using Hurl to implement the test suite of a Reverse Proxy service we provide in our infrastructure. Its configuration is pulled from Netbox. One feature is the Access Control Lists, which translates to the following NGINX configuration:

server {
  # ...

  location / {
    # ...

    deny 192.168.2.0/24;
    allow all;

    # ...
  }

  # ...
}

The test we want to execute is the following:

# Rejection when coming from 192.168.2.0/24
GET https://example.com

HTTP 403

# No rejection when coming from 127.0.0.1/8
GET https://example.com
[Options]
socks5: localhost:8012

HTTP 200

Tasks to complete

  • Support URLs in proxy request option
  • Add socks5 request option
  • Support Proxy SOCKS protocol
@linkdd linkdd added the enhancement New feature or request label Oct 16, 2024
@jcamiel
Copy link
Collaborator

jcamiel commented Oct 16, 2024

Hi @linkdd

I think I prefer to have a dedicated socks5 option to match exactly the curl option name

GET https://example.com
[Options]
socks5: localhost:8012
HTTP 200

@linkdd
Copy link
Contributor Author

linkdd commented Oct 16, 2024

Sounds good to me. But what would be the behavior when we define both proxy and socks5 fields then? Should it be an error?

@jcamiel
Copy link
Collaborator

jcamiel commented Oct 16, 2024

Yes we can check what is the behavior of curl in this case and try to match it.

@linkdd
Copy link
Contributor Author

linkdd commented Oct 16, 2024

Ok, I updated the issue description accordingly.

It seems the curl crate you use already provides everything needed, the Easy2::proxy() function (docs) seems to accept URLs of the form socks5://host:port, which correspond to the CURLOPT_PROXY option.

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

No branches or pull requests

2 participants