docker container and tor #20
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi @throwaway, I have a private docker 4get instance running locally on my own PC. I want to not expose my IP to the search engines, so I thought about setting up Tor on the host, I changed all the "false" values to "onion" in the container data/config.php, but when I try to do a search I get a "couldn't find html"error. My wild guess is that the container can't connect to tor on the host machine, is that correct? Searching through the web I found that the best solution should be tweaking the docker-compose.yaml so to run Tor in another container and haveTor and 4get in the same network. However I have no idea how to do that and the documentation about Tor in a docker container is quite sparse.
Could setting " network_mode: host" be any effective? My OS is Arch Linux.
Hello :D
You can use tor as socks5 proxy which should make outgoing requests go through tor
For example if you wanted to use curl with tor you'd just do
Yes. Localhost inside the container would mean the container itself, not your host. You can make the host available to your 4get container by using --add-host when running your container with plain docker command. In docker compose you can use "extra_hosts" https://stackoverflow.com/a/61231167
The alternative is to run tor in another container and have them connected via networking like you mentioned. You'd need to create a Dockerfile that starts tor service on container start and a docker compose file that has both containers listed. They'd be added to the default docker network. When two containers are in the same network they are accessible via the service name (or hostname if you set that value).
https://docs.docker.com/compose/networking/
this link contains an example of how two containers can communicate in the default network created
Once you have a way to access the tor service via a hostname, you can use it as a proxy by following https://git.lolcat.ca/lolcat/4get/src/branch/master/docs/configure.md#proxies
lets say you added the host "my_tor_host" that resolved to the container running tor (or the your host running tor)
you'd create a proxy list named "my_proxy.txt" for example and mount it to /var/www/html/4get/data/proxies/
the content of "my_proxy.txt" would look like this
in docker compose you'd mount it like this
Btw I haven't tried any of this. I'll try my hand at it in the near future and make an example guide :3
Hope this helps!
Thanks for your quick and detailed answer:) what worked for me was the second method, I added a "tor" service based on the osminogin/tor-simple image to docker-compose.yaml, exposing the 9050 port and mounting the whole /data folder. There I changed sock5: localhost:9050:: to socks5:tor:9050:: in onion.txt and changed all the "false" values to "onion" in config.php.
However, Google scraper does always return a captcha, that's the downside of using Tor. I tried to restart the container but no joy lol. In fact, Google seems much more forgiving while searching over a VPN, at least for me.
Hoping this would be of help, thanks so much again:3
throwie is the goat