This repository was archived by the owner on Sep 7, 2023. It is now read-only.
Verify that Tor proxy works every time searx starts #3015
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a cherry-pick of searxng/searxng#341 which is meant to replace my other PR #2981.
The problem is that I didn't know that you could have more than one proxy configured in the settings, so this version actually verifies that Tor is used in all the proxies and not just the first one.
What does this PR do?
Every time searx starts, if the
using_tor_proxy
setting is true, verify that outgoing HTTP(s) requests are actually passing through Tor. This is done by sending a request to https://check.torproject.org/api/ip which is Tor Project's official API for this purpose.Why is this change important?
Avoid any future regression for #2968 and ensure that searx instance maintainers are configuring their Tor proxies correctly.
How to test this PR locally?
Default scenario:
Correctly configured Tor:
all:// : socks5h://127.0.0.1:9050
and run Tor in that port.using_tor_proxy
setting as true.Incorrectly configured Tor:
using_tor_proxy
setting as true.socks5
instead ofsocks5h
.Related issues
Rewrite of #2981
Continuation of #2969