Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Curl failure with socks proxy through SSH tunnel between EC2 instances : "curl: (7) Failed to receive SOCKS5 connect request ack."

I am seeing curl issues while setting up a socks proxy through a simple SSH tunnel between two EC2 instances in AWS.

box1 $ ssh -v -D 12345 ubuntu@box2 -N
[...]

The socks proxy seems to be running properly on port 12345, now when I try to curl through it:

box1 $ curl -x socks5h://localhost:12345 www.google.com
curl: (7) Failed to receive SOCKS5 connect request ack.

Back on the ssh -D window, this error appears when I run the curl command :

debug1: Connection to port 12345 forwarding to socks port 0 requested.
debug1: channel 1: new [dynamic-tcpip]
channel 1: open failed: administratively prohibited: open failed
debug1: channel 1: free: direct-tcpip: listening port 12345 for www.google.com port 80, connect from 127.0.0.1 port 36240 to 127.0.0.1 port 12345, nchannels 2

Can anybody shed some light about what's going on here?

like image 978
Thibault Reuille Avatar asked Sep 14 '25 03:09

Thibault Reuille


1 Answers

maybe it is because domain address resolved to IPv6, and your socks5 proxy does not support that.

in this case, curl --ipv4 ... will work properly

like image 97
Mostafa Nazari Avatar answered Sep 15 '25 17:09

Mostafa Nazari