Hi,
I've encountered an issue with the Tor exit node update cron in DBTech Security.
On two consecutive daily cron runs, the request to the Tor Project bulk exit list failed with the following exception:
Code:
GuzzleHttp\Exception\ConnectException:
cURL error 35: Recv failure: Connection reset by peer
The exception occurs while
TorRepository::updateNodes() is fetching the Tor bulk exit list.
I had a look at the exception handling around this request and noticed that it currently catches
RequestException:
PHP:
catch (RequestException $e)
{
\XF::logException($e, false, "[Security] Error fetching TOR exit nodes: ");
return;
}
However, in these two cases Guzzle threw
GuzzleHttp\Exception\ConnectException.
As
ConnectException is not a subclass of
RequestException, the existing catch block does not handle this particular connection failure. The exception therefore propagates into XenForo's server error log instead of following the intended graceful failure path.
Perhaps
ConnectException could also be handled here, or the appropriate broader Guzzle exception type could be caught.
I also tested the same Tor endpoint directly from the server afterwards. It is currently working normally:
Code:
HTTP: 200
TLS verification: OK
Response size: 21535 bytes
So the original connection resets appear to have been temporary rather than a persistent connectivity problem.
There is also one minor observation which may be worth reviewing.
The request currently uses the bulk endpoint in this form:
Code:
https://check.torproject.org/torbulkexitlist?ip=<host>&port=<port>
According to Tor Project's 2020 changes to the bulk exit list service, exit-policy-based queries are no longer supported and the bulk list is returned regardless of the query.
For comparison, I tested both the query form used by the add-on and the endpoint without query parameters. Both responses had exactly the same size and SHA-256 hash.
This does not appear to be related to the connection reset itself, but the
ip/
port parameters may now be obsolete.
The existing behavior of retaining the current Tor node data when the remote request fails looks correct. The main issue I'm reporting is that a temporary connection-level failure can currently escape the exception handler and become a XenForo server error.