JAR.JAR.beans
JAR.JAR.beans

Reputation: 10014

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 [email protected]

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

Any suggestions?

Upvotes: 13

Views: 12521

Answers (1)

nbari
nbari

Reputation: 26925

Try using a socks5 proxy for example:

$ ssh -D 8080 -f -C -q -N [email protected]
  • -D 8080 tells ssh to launch a SOCKS server on port 8080 locally.
  • -f Forks the process to the background.
  • -C Compresses the data before sending it.
  • -q Uses quiet mode.
  • -N Tells SSH that no command will be sent once the tunnel is up.

Then you could use curl like this:

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

Upvotes: 39

Related Questions