Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tor] Towards Whonix & Tails #12979

Closed

Conversation

kiminuo
Copy link
Contributor

@kiminuo kiminuo commented May 6, 2024

Contributes to #12848

This PR adds --UseOnlyRunningTor command line option and its purpose is to use only a pre-running Tor instance to which we can connect. The purpose is then:

  • WW2 should be compatible with Whonix or Tails1 then because it is not possible to spin up a new Tor instance in these distributions because Tor-over-Tor problem would occur.
  • To facilitate this, --UseOnlyRunningTor does not rely on Tor control port2.

How to test

On master branch, start WW, disable "terminate Tor on exit" in settings, start WW again and turn it off -> you should have a Tor process running on port 37150

On the PR's branch, connect to TorSocksPort=37150 and set a made up port for TorControlPort to make sure it CANNOT be used.

dotnet build && dotnet run --framework net8.0 -- --TorSocksPort=37150 --TorControlPort=63999 --UseOnlyRunningTor=true

You should be able to do a coinjoin or just use your wallet normally without a hiccup.

Footnotes

  1. That was a goal for a long time.

  2. It seems it works but the cost is that we do not use TorMonitor.

@kiminuo kiminuo force-pushed the feature/2024-05-03-towards-Whonix branch from 2ecc6c3 to 95b8198 Compare May 6, 2024 11:48
Copy link
Collaborator

@yahiheb yahiheb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, LGTM.

If UseTor is false and UseOnlyRunningTor is used and set to true, should the wallet use an already running Tor?

@kiminuo
Copy link
Contributor Author

kiminuo commented May 6, 2024

If UseTor is false and UseOnlyRunningTor is used and set to true, should the wallet use an already running Tor?

This is a good point. I believe I can make sure that UseOnlyRunningTor=true leads to UseTor=true (whatever its value was).

Thinking about it a bit more, I think we could modify code to support:

UseTor=True|False|OnlyRunning

WDYT?

@yahiheb
Copy link
Collaborator

yahiheb commented May 6, 2024

Thinking about it a bit more, I think we could modify code to support:

UseTor=True|False|OnlyRunning

WDYT?

It seems good to me.

In such case if UseTor=OnlyRunning and no Tor is already running we fall back to UseTor=True?

@kiminuo kiminuo force-pushed the feature/2024-05-03-towards-Whonix branch from 95b8198 to e9f8302 Compare May 7, 2024 11:56
@@ -524,6 +531,11 @@ internal virtual async Task<HttpResponseMessage> SendCoreAsync(TorTcpConnection
/// </remarks>
public void ReportStreamStatus(string streamUsername, StreamStatusFlag streamStatus, string circuitID)
{
if (!TorControlAvailable)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yahiheb FYI, this was wrong it was if (TorControlAvailable) so we could report exceptions when we shouldn't. That's probably what you reported over Slack.

@kiminuo
Copy link
Contributor Author

kiminuo commented May 7, 2024

Thinking about it a bit more, I think we could modify code to support:
UseTor=True|False|OnlyRunning
WDYT?

It seems good to me.

In such case if UseTor=OnlyRunning and no Tor is already running we fall back to UseTor=True?

I created an alternative PR #12991 for this where you can use:

  • UseTor=False (backward compatibility)
  • UseTor=True (backward compatibility)
  • UseTor=Disabled
  • UseTor=Enabled
  • UseTor=EnabledOnlyRunning (used to be OnlyRunning)

The names are not that great as I would like to preserve backward compatibility ...

@kiminuo
Copy link
Contributor Author

kiminuo commented May 13, 2024

Replaced with #12991

@kiminuo kiminuo closed this May 13, 2024
@kiminuo kiminuo deleted the feature/2024-05-03-towards-Whonix branch May 13, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants