Tunnel HTTP traffic through a linux server

1

I want to tunnel data (HTTP / HTTPS) from one linux server through another to access proxies.

The reason I cannot go straight to the proxies is because they are all firewalled and I have far too many to whitelist. This is just a temporary setup to use the proxies.

So I want to go from point A to points C, D & E through point B (only B can access C, D & E). Any advice would be appreciated.

Daniel Pilch

Posted 2014-02-09T21:25:26.307

Reputation: 111

Please specify the browser, and the linux distribution – elomage – 2014-02-09T21:54:08.040

No browser running python scripts, point A is CentOS point B is Ubuntu. – Daniel Pilch – 2014-02-09T22:09:34.883

For forwarding from any source, including from python scripts, make a SSH tunnel from localhost ports 80 and 443 to your middle server. – elomage – 2014-02-09T22:26:03.923

Answers

2

You may use simpleproxy program to pass any TCP traffic coming to one port on your pass-through server to a certain other host:port. Then on the client machine change the proxy settings in your browser to use the pass-through server.

Simpleproxy can be installed using apt-get on debian/Ubuntu:

sudo apt-get install simpleproxy

Example of simpleproxy synopsis is as follows, but look up man simpleproxy for more details:

simpleproxy  -L [<local host>:]<local port> -R <remote host>:<remote port> -S <proxy host>:<proxy port>

elomage

Posted 2014-02-09T21:25:26.307

Reputation: 266

I use simpleproxy for exactly this purpose. On my "relay" machine that proxies the requests ("B" in the question), I run simpleproxy -L 7701 -R destination.example.com:80 to proxy requests to the relay on port 7701 to destination.example.com on port 80. If you need HTTPS, use -S instead of -R and port 443 instead of 80, of course – Nathan Wallace – 2017-12-01T00:46:44.647

1

If the linux box has an ssh server, you can simply use an ssh tunnel to proxy http.

If the client is running Linux, run:

ssh -D 8080 user@linux_ssh_server

This will open port 8080 on the local host, and make it behave like a socks proxy, making everything sent to that port appear as if it was sent by the proxy. Set up localhost:8080 as a socks5 proxy in your browser and you're done.

On windows, the same can be achieved with putty (see tutorial here)

Malt

Posted 2014-02-09T21:25:26.307

Reputation: 421