guardianproject / orbot

The Github home of Orbot: Tor on Android (Also available on gitlab!)
https://gitlab.com/guardianproject/orbot
Other
2.05k stars 327 forks source link

Missing pt log messages in orbot's tor log #741

Open cohosh opened 1 year ago

cohosh commented 1 year ago

To help users debug snowflake connectivity issues, we recently added a feature to send snowflake connection messages to the tor log (see https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40062, https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40044). This has been very useful for us in figuring out how and where snowflake is failing from user reports, since users can easily copy and paste the log from the tor browser app. Here's an example of us using this feature recently to unblock snowflake in TM.

It looks like orbot is using a new enough version of tor and snowflake to take advantage of this feature, but when I connect I still don't see the log messages in the tor log. I think they might be getting lost within iptproxy.

This isn't urgent, but I'd recommend this feature because it often informs us on how to modify the snowflake bridge line by region and it could be useful for the orbot support team as well.

n8fr8 commented 1 year ago

This might be something that we need to add in the IPtProxy library itself.

cohosh commented 1 year ago

Oh, should I open an issue there instead?

n8fr8 commented 1 year ago

https://github.com/tladesignz/IPtProxy/issues/31

tladesignz commented 1 year ago

@cohosh: How do the Snowflake log messages end up in the Tor log? I'm a little confused here.

IPtProxy does support handing over a log file path to Snowflake. @n8fr8, you can leverage that anytime.

However, I guess, it would be a dangerous idea, to point it to the same file as Tor. 2 threads writing in the same file will probably create havok.

Anyway, I'll add another log tab to Orbot iOS, where users can see and copy the Snowflake log output. It will not be interwoven, but it has timestamps, so should be good enough?

n8fr8 commented 1 year ago

Thanks for the reminder about the IPtProxy snowflake log option. Looking into that now.

tladesignz commented 1 year ago

So, I improved logging support by exposing the hardcoded Obfs4proxy log file name.

For Snowflake, everything can/must be fully configured yourself, so there's no equivalent.

For your Android implementation I suggest to have a look at my iOS stuff:

https://github.com/tladesignz/IPtProxyUI-ios/blob/main/IPtProxyUI/Classes/Shared/Transport.swift#L74-L114

Don't forget to call IPtProxy.setStateLocation("...") (at app startup at best) to fix the path to something actually writable.

cohosh commented 1 year ago

@cohosh: How do the Snowflake log messages end up in the Tor log? I'm a little confused here.

IPtProxy does support handing over a log file path to Snowflake. @n8fr8, you can leverage that anytime.

However, I guess, it would be a dangerous idea, to point it to the same file as Tor. 2 threads writing in the same file will probably create havok.

Sorry for the delayed reply. This is not the same as the snowflake log option. This uses the pt.Log() function from goptlib to put select messages from Snowflake into the tor log. I can take a quick look at the iptproxy code and give some pointers here.

cohosh commented 1 year ago

Okay now that I'm looking at it, IPtProxy should already have support for sending snowflake events to the tor log.

The key piece of code is the call of AddSnowflakeEventListener(NewPTEventLogger()) and IPtProxy uses snowflake v2.3.1 so this should just work.

Is it possible that the update to v2.3.1 just hasn't been rolled out to orbot clients?

tladesignz commented 1 year ago

Orbot iOS containing Snowflake v2.3.1 is currently in beta. Will release this week if nothing comes up.

Orbot Android I'm not sure, but I just updated IPtProxy a few days ago, so probably not released, yet, too!

n8fr8 commented 1 year ago

Working on Android release for today with latest Snowflake.

cohosh commented 1 year ago

Okay, I think this issue will be automatically handled with that update. Thanks!

n8fr8 commented 1 year ago

Orbot Android v16.6.3 Beta 1 release with tor 0.4.7.10 and Snowflake 2.3 now up here: https://github.com/guardianproject/orbot/releases/tag/16.6.3-BETA-1-tor.0.4.7.10