Docker makes it easy to set up a Privoxy + Tor environment. Basically, you can understand it by reading the official page below, but since I realized the convenience of Docker, I will write it as an article.
This time, I used the image of dperson / torproxy
, but you can find some images of Privoxy + Tor by searching. I haven't tried anything else, but I think it's possible to do the same with any of the simple requirements I'll show you here.
In Linux, just install Tor and start it, and with the default settings, a SOCKS5 proxy will start up on port 9050 of the local host, and you can use that proxy to access the Web via Tor. However, although access by curl etc. is good, in some cases HTTP proxy can be used but SOCKS proxy cannot be used directly. In that case, Privoxy and Tor will be used in combination. With proper settings, you can access the flow like Privoxy → Tor → website via HTTP proxy by Privoxy (port 8118 by default). The specific setting method is introduced on the following page, for example.
4.10. How do I use Privoxy together with Tor?
This is fine, but installing Privoxy and rewriting the config file is a hassle. It's also a bit unpleasant for Privoxy to remain local. You can solve those problems by launching the environment with Docker.
Start the Privoxy + Tor container with a command similar to the following:
docker run -it -p 8118:8118 -p 9050:9050 -d dperson/torproxy
-p 8118: 8118
specifies the port binding.
Notation like -p host side port: container side port
.
Therefore, if the host port 8118 is already in use
docker run -it -p 8119:8118 -p 9050:9050 -d dperson/torproxy
It is okay if you change the port number to one that is not used.
Also, -p 9050: 9050
is a port for connecting to Tor's SOCKS proxy, so if you only need an HTTP proxy,
docker run -it -p 8118:8118 -d dperson/torproxy
If you omit the setting of port 9050 as in, only the HTTP proxy will start in a state where it can be accessed from the host.
Check the operation with curl.
curl -L ipinfo.io
If you access ipinfo.io with curl like this, the IP of the connection source etc. will be displayed. If you don't set any proxy, you should see your home IP address.
Start the container with the command docker run -it -p 8118: 8118 -p 9050: 9050 -d dperson / torproxy
, and if you can access the Privoxy HTTP proxy on port 8118, use the following command via the proxy Web access for.
curl -Lx localhost:8118 ipinfo.io
(Specify the proxy with the -x option) If the container is started and you can access it through the proxy correctly, you should see an IP address different from your home one.
Check the SOCKS proxy as well.
curl -Lx socks5h://localhost:9050 ipinfo.io
You should be able to confirm that you are accessing via Tor with this command.
Check the container that is up with the following command.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ae9565085d51 dperson/torproxy "/sbin/tini -- /usr/…" 8 hours ago Up 8 hours (healthy) 0.0.0.0:8118->8118/tcp, 9050/tcp, 0.0.0.0:9050->9050/tcp inspiring_brahmagupta
Check the CONTAINER ID
or NAMES
here and use it as an argument for the following command.
docker stop ae9565085d51
Specify CONTAINER ID
or NAMES
in the argument of docker stop
.
This will stop the container.
Recommended Posts