Later thought I had written SSH Firefox SOCKS agent Switch A text, in fact, the prototype has been, so this article slightly modified to add.
Build Socks Proxy Server #
ssh-d 9999-c zfanw@zfanw.com
The D parameter represents the creation of a SOCKS proxy server on the native 9999 port and a secure connection to the remote server (zfanw.com host) via the SSH channel. C is used to compress the transfer data, which is an optional parameter.
Configure Privoxy Forwarding #
So we now have two proxy servers on this machine:
SOCKS Proxy Server with port 9999
Privoxy HTTP Proxy Server with Port 8118
The next thing to do is to forward the Privoxy proxy server traffic to the SOCKS agent. Open the Privoxy config file and add the following code:
forward-socks5/127.0.0.1:9999.
Where FORWARD-SOCKS5 represents the forwarding target is SOCKS server, 5 is the protocol version,/means forwarding all HTTP requests, 127.0.0.1:9999 is the first step of the SOCKS proxy server, the last. Indicates that the request after the SOCKS agent is no longer over the HTTP proxy server.
Privoxy supports multiple versions of SOCKS forwarding protocols. The difference between FORWARD-SOCKS4 and forward-socks4a is that the latter DNS resolution occurs on the SOCKS server, the former is local, and FORWARD-SOCKS5 is also on the SOCKS server.