I need to have my server use my workstation as a proxy for a single request. I've succeeded in creating a tunnel connection, But the curl command hangs indefinitely.
I've created a Reverse proxy from my workstation (macOS) (to the server) with the command
ssh -N -R :8888:localhost:443 -i [key_file] [user]@[server_ip]
and on the server I'm doing the command
curl --proxy socks5://localhost:8888 'https://www.example.com'
which seems to connect fine (If I ^c on my workstation, It closes the curl command's connection on the server), but curl just doesn't seem to execute after the connection.
Doing the same curl command on my workstation
curl https://www.example.com
works just fine.
I've tried setting GatewayPorts=yes in the sshd_config file and restarting ssh with no luck. the verbose output from curl shows :
* Trying 127.0.0.1:8888...
* TCP_NODELAY set
* SOCKS5 communication to www.example.com:443
<< Hangs indefinitely right here, Pressed ^c on my workstation to close the tunnel.
* Unable to receive initial SOCKS5 response.
* Closing connection 0
curl: (7) Unable to receive initial SOCKS5 response.
And verbose on the ssh shows :
debug1: remote forward success for: listen :8888, connect localhost:443
debug1: All remote forwarding requests processed
<< Tunnel created, Listening for connections. Enter curl command on server
debug1: client_input_channel_open: ctype forwarded-tcpip rchan 2 win 2097152 max 32768
debug1: client_request_forwarded_tcpip: listen port 8888, originator 127.0.0.1 port 54782
debug1: connect_next: host localhost ([::1]:443) in progress, fd=6
debug1: channel 0: new [127.0.0.1]
debug1: confirm forwarded-tcpip
debug1: channel 0: connected to localhost port 443
<< Hangs here along with curl on the server, until I killed with ^c
^Cdebug1: channel 0: free: 127.0.0.1, nchannels 1
Killed by signal 2.
Not sure what the issue from here could be, since there is clearly a working connection between the two devices via the tunnel. Seems like the curl command doesn't want to execute on my workstation. Not sure if the issue is with : Workstation Mac Settings? (I've tried turning on Network > advanced > Proxy > SOCKS5 with no luck) Server side Settings? Curl Command / settings issue? SSH Command / settings issue?
Any help would be appreciated. I just found out about SSH tunneling for the first time today.