2

I am trying to use the cURL utility to fetch a web page through a NordVPN SOCKS5 proxy, but not having any luck. I would expect the following command line to work.

curl -v -x "socks5://<username>:<password>@se.socks.nordhold.net:1080" -4 http://google.com

However, this returns the following.

*   Trying 185.236.42.56:1080...
* SOCKS5 connect to IPv6 2a00:1450:4009:815::200e:80 (locally resolved)
* Can't complete SOCKS5 connection to google.com. (4)
* Closing connection 0
curl: (97) Can't complete SOCKS5 connection to google.com. (4)

Is there some special configuration I need for cURL to connect to a SOCKS5 proxy operated by NordVPN?

The customer support were able to tell me that

We’ve changed the way for users to connect to socks5 to reduce the chances for socks5 from being used for malicious purposes such as web scans/proxying/credential stuffing attacks.

... but they could not offer any suggestions on how to use cURL. All I can say is that some other software seems to be able to use NordVPN SOCKS5 proxies without issue.

1 Answer 1

2

Note: I've just figured out the problem myself. (As so often tends to happen shortly after spelling it out in full!) In case someone else searches for this, I thought I'd post what worked for me, rather than merely deleting the question.

It turned out there were two issues at play here. The main one was that the version of cURL bundled with macOS (/usr/bin/curl) is not built with SOCKS5 support. I had the Homebrew version of cURL installed too, which does have SOCKS5 support, but it's "keg-only" (not symlinked somewhere the system can see). Putting Homebrew's version of cURL in my PATH meant that the IPv4 request of my original question then worked.

Furthermore, when I then used the socks5h URL scheme (instead of just socks5), IPv6 requests worked too. That ensures that hostname resolution is done remotely rather than locally.

curl -v -x "socks5h://<username>:<password>@se.socks.nordhold.net:1080" -L http://google.com

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.