Skip to content

Don't kill managed proxy on method error

Cecylia Bocovich requested to merge cohosh/tor:issue/7362 into main

Some PT applications support more than one transport. For example, obfs4proxy supports obfs4, obfs3, and meek. If one or more transports specified in the torrc file are supported, we shouldn't kill the managed proxy on a {C,S}METHOD-ERROR. Instead, we should log a warning.

We were already logging warnings on method errors. This change just makes sure that the managed proxy isn't killed, and then if no transports are configured for the managed proxy, bumps the log level up from a notice to a warning.

Closes #7362 (closed)

I was triaging tickets and realized this was a really fast 3 line change >.<

You can reproduce this behaviour with the following torrc file (it's a default bridge so no worries):

UseBridges 1
DataDirectory datadir

ClientTransportPlugin fakename,obfs4 exec /usr/bin/obfs4proxy

Bridge obfs4 209.148.46.65:443 74FAD13168806246602538555B5521A0383A1875 cert=ssH+9rP8dG2NLDN2XuFw63hIO/9MNNinLmxQDpVa+7kTOa9/m+tGWT1SmSYpQ9uTBGa6Hw iat-mode=0

SocksPort auto

Before the patch, this would fail:

Nov 19 15:09:55.769 [notice] Tor 0.4.7.2-alpha-dev (git-9d8b0c5bdc6f7589) running on Linux with Libevent 2.1.12-stable, OpenSSL 1.1.1l, Zlib 1.2.11, Liblzma 5.2.5, Libzstd N/A and Glibc 2.34 as libc.
Nov 19 15:09:55.769 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Nov 19 15:09:55.769 [notice] This version is not a stable Tor release. Expect more bugs than usual.
Nov 19 15:09:55.777 [notice] Opening Socks listener on 127.0.0.1:0
Nov 19 15:09:55.777 [notice] Socks listener listening on port 36193.
Nov 19 15:09:55.778 [notice] Opened Socks listener connection (ready) on 127.0.0.1:36193
Nov 19 15:09:55.000 [notice] Bootstrapped 0% (starting): Starting
Nov 19 15:09:56.000 [notice] Starting with guard context "bridges"
Nov 19 15:09:56.000 [notice] Delaying directory fetches: No running bridges
Nov 19 15:09:56.000 [notice] new bridge descriptor 'GeorgetownPontem' (cached): $74FAD13168806246602538555B5521A0383A1875~GeorgetownPontem [ZWCs12Nk8NW7PEGQ2r5ZBF6PLXFnT+o5W3TS5QC/JGM] at 209.148.46.65
Nov 19 15:09:56.000 [warn] Client managed proxy encountered a method error. (fakename no such transport is supported)
Nov 19 15:09:56.000 [warn] Managed proxy at '/usr/bin/obfs4proxy' failed the configuration protocol and will be destroyed.
Nov 19 15:09:56.000 [warn] Pluggable Transport process terminated with status code 13
Nov 19 15:09:57.000 [warn] Can't use bridge at [scrubbed]: there is no configured transport called "obfs4".
Nov 19 15:09:57.000 [warn] We were supposed to connect to bridge '209.148.46.65:443 ID=ZWCs12Nk8NW7PEGQ2r5ZBF6PLXFnT+o5W3TS5QC/JGM RSA_ID=74FAD13168806246602538555B5521A0383A1875' using pluggable transport 'obfs4', but we can't find a pluggable transport proxy supporting 'obfs4'. This can happen if you haven't provided a ClientTransportPlugin line, or if your pluggable transport proxy stopped running.
Nov 19 15:09:58.000 [warn] Can't use bridge at [scrubbed]: there is no configured transport called "obfs4".
Nov 19 15:09:58.000 [notice] Delaying directory fetches: No running bridges

After the patch, it bootstraps successfully:

Nov 19 15:07:42.610 [notice] Tor 0.4.7.2-alpha-dev (git-9d8b0c5bdc6f7589) running on Linux with Libevent 2.1.12-stable, OpenSSL 1.1.1l, Zlib 1.2.11, Liblzma 5.2.5, Libzstd N/A and Glibc 2.34 as libc.
Nov 19 15:07:42.610 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Nov 19 15:07:42.610 [notice] This version is not a stable Tor release. Expect more bugs than usual.
Nov 19 15:07:42.622 [notice] Opening Socks listener on 127.0.0.1:0
Nov 19 15:07:42.622 [notice] Socks listener listening on port 36461.
Nov 19 15:07:42.622 [notice] Opened Socks listener connection (ready) on 127.0.0.1:36461
Nov 19 15:07:42.000 [notice] Bootstrapped 0% (starting): Starting
Nov 19 15:07:42.000 [notice] Starting with guard context "bridges"
Nov 19 15:07:42.000 [notice] Delaying directory fetches: No running bridges
Nov 19 15:07:42.000 [notice] new bridge descriptor 'GeorgetownPontem' (cached): $74FAD13168806246602538555B5521A0383A1875~GeorgetownPontem [ZWCs12Nk8NW7PEGQ2r5ZBF6PLXFnT+o5W3TS5QC/JGM] at 209.148.46.65
Nov 19 15:07:43.000 [warn] Client managed proxy encountered a method error. (fakename no such transport is supported)
Nov 19 15:07:43.000 [notice] Bootstrapped 1% (conn_pt): Connecting to pluggable transport
Nov 19 15:07:44.000 [notice] Bootstrapped 2% (conn_done_pt): Connected to pluggable transport
Nov 19 15:07:44.000 [notice] Bootstrapped 10% (conn_done): Connected to a relay
Nov 19 15:07:44.000 [notice] Bootstrapped 14% (handshake): Handshaking with a relay
Nov 19 15:07:44.000 [notice] Bootstrapped 15% (handshake_done): Handshake with a relay done
Nov 19 15:07:44.000 [notice] Bootstrapped 75% (enough_dirinfo): Loaded enough directory info to build circuits
Nov 19 15:07:44.000 [notice] Bootstrapped 95% (circuit_create): Establishing a Tor circuit
Nov 19 15:07:44.000 [notice] Bootstrapped 100% (done): Done

Merge request reports

Loading