curlsshproxy

curl HTTPS via an SSH proxy


I want the below curl command to run from my machine, but via a remote proxy server.

curl "https://site.fake/ping"

However, I want this to always work via a remote proxy server.

I was tring to set this up with an ssh tunnel:

sudo ssh -i ~/.ssh/private_key_file -L 443:site.com:443 username@remote.proxy.com

But this did not do the trick, running under osx.

Any suggestions?


Solution

  • Try using a socks5 proxy for example:

    $ ssh -D 8080 -f -C -q -N user@remote.host
    

    Then you could use curl like this:

    curl -x socks5h://0:8080 https://example.com