Skip to content
This repository was archived by the owner on Sep 7, 2023. It is now read-only.

Conversation

MarcAbonce
Copy link
Contributor

@MarcAbonce MarcAbonce commented Oct 13, 2021

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:

  1. Run searx with default settings.
  2. No verification should be made. Everything should work as usual.

Correctly configured Tor:

  1. Add a proxy such as all:// : socks5h://127.0.0.1:9050 and run Tor in that port.
  2. Set the using_tor_proxy setting as true.
  3. Run searx.
  4. Tor check should run successfully. Everything should work as usual.

Incorrectly configured Tor:

  1. Set the using_tor_proxy setting as true.
  2. Keep the proxies section empty or proxy to Tor using socks5 instead of socks5h.
  3. Run searx.
  4. Logs should show an explanatory error and searx should stop running.

Related issues

Rewrite of #2981
Continuation of #2969

@MarcAbonce MarcAbonce changed the title Verify that Tor proxy works every time searx starts (take 2) Verify that Tor proxy works every time searx starts Oct 13, 2021
@kvch
Copy link
Member

kvch commented Oct 25, 2021

Thank you!

@kvch kvch merged commit 7b36814 into searx:master Oct 25, 2021
@MarcAbonce MarcAbonce deleted the verify_tor_on_start2 branch October 26, 2021 05:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants