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 (take 2) #12991
[Tor] Towards Whonix & Tails (take 2) #12991
Conversation
64b9fe7
to
f86a4dd
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
d3307b9
to
b173d8c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
b173d8c
to
73b61e4
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
73b61e4
to
79e407e
Compare
In the latest version of the PR, when I set an invalid TorSocksPort, I can see:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
UseTor=EnabledOnlyRunning
and no Tor is already running Wasabi is kinda stuck, Tor is not running, the backend is not connected, and the wallet cannot be loaded.
Now Wasabi crashes: System.InvalidOperationException: No attempt to start Tor was successful.
Logs
2024-05-11 22:35:19.256 [1] INFO WasabiApplication.BeforeStarting (85) Wasabi GUI started (6f4ee334-6570-45e3-903f-541f6523600c).
2024-05-11 22:35:20.474 [1] INFO FileSystemBlockRepository.Prune (78) Blocks folder was over 300 MB. Deleted 279 blocks.
2024-05-11 22:35:20.885 [1] INFO P2pNetwork..ctor (55) Loaded AddressManager from `C:\Users\User\AppData\Roaming\WalletWasabi\Client\BitcoinP2pNetwork\AddressManagerTestNet.dat`.
2024-05-11 22:35:21.423 [1] INFO Program.RunAsGuiAsync (166) Wasabi GUI started.
2024-05-11 22:35:22.967 [12] WARNING SpecificNodeBlockProvider.ReconnectingLoopAsync (135) Failed to establish a connection to the node '127.0.0.1:18333'. Exception: System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at NBitcoin.Protocol.Connectors.DefaultEndpointConnector.ConnectSocket(Socket socket, EndPoint endpoint, NodeConnectionParameters nodeConnectionParameters, CancellationToken cancellationToken)
at NBitcoin.Protocol.Node.ConnectAsync(Network network, EndPoint endpoint, NetworkAddress peer, NodeConnectionParameters parameters)
at WalletWasabi.Wallets.SpecificNodeBlockProvider.ConnectAsync(CancellationToken cancellationToken) in WalletWasabi\Wallets\SpecificNodeBlockProvider.cs:line 193
at WalletWasabi.Wallets.SpecificNodeBlockProvider.ReconnectingLoopAsync() in WalletWasabi\Wallets\SpecificNodeBlockProvider.cs:line 101
2024-05-11 22:35:49.398 [14] INFO WasabiApplication.TerminateApplicationAsync (132) Wasabi GUI stopped gracefully (6f4ee334-6570-45e3-903f-541f6523600c).
2024-05-11 22:35:49.401 [14] WARNING Global.DisposeAsync (438) Process is exiting.
2024-05-11 22:35:49.403 [14] INFO Global.DisposeAsync (447) WalletManager is stopped.
2024-05-11 22:35:49.404 [14] INFO Global.DisposeAsync (455) UpdateManager is stopped.
2024-05-11 22:35:49.407 [14] INFO Global.DisposeAsync (469) BlockDownloadService is disposed.
2024-05-11 22:35:49.409 [8] INFO Global.DisposeAsync (475) SpecificNodeBlockProvider is disposed.
2024-05-11 22:35:49.409 [8] INFO Global.DisposeAsync (487) Disposed LegalChecker.
2024-05-11 22:35:49.411 [14] INFO HostedServices.StopAllAsync (89) Stopped Wasabi Synchronizer.
2024-05-11 22:35:49.411 [12] INFO HostedServices.StopAllAsync (89) Stopped Software Update Checker.
2024-05-11 22:35:49.492 [8] INFO P2pNetwork.StopAsync (160) AddressManager is saved to `C:\Users\User\AppData\Roaming\WalletWasabi\Client\BitcoinP2pNetwork\AddressManagerTestNet.dat`.
2024-05-11 22:35:49.495 [12] INFO HostedServices.StopAllAsync (89) Stopped Bitcoin P2P Network.
2024-05-11 22:35:49.495 [14] INFO HostedServices.StopAllAsync (89) Stopped Blockstream.info Fee Provider.
2024-05-11 22:35:49.497 [14] INFO HostedServices.StopAllAsync (89) Stopped Third Party Fee Provider.
2024-05-11 22:35:49.498 [14] INFO HostedServices.StopAllAsync (89) Stopped Hybrid Fee Provider.
2024-05-11 22:35:49.498 [8] INFO HostedServices.StopAllAsync (89) Stopped Unconfirmed Transaction Chain Provider.
2024-05-11 22:35:49.499 [8] INFO HostedServices.Dispose (148) Disposed Wasabi Synchronizer.
2024-05-11 22:35:49.499 [8] INFO HostedServices.Dispose (148) Disposed Software Update Checker.
2024-05-11 22:35:49.500 [8] INFO HostedServices.Dispose (148) Disposed Bitcoin P2P Network.
2024-05-11 22:35:49.500 [8] INFO HostedServices.Dispose (148) Disposed Blockstream.info Fee Provider.
2024-05-11 22:35:49.500 [8] INFO HostedServices.Dispose (148) Disposed Third Party Fee Provider.
2024-05-11 22:35:49.501 [8] INFO HostedServices.Dispose (148) Disposed Unconfirmed Transaction Chain Provider.
2024-05-11 22:35:49.501 [8] INFO Global.DisposeAsync (495) Stopped background services.
2024-05-11 22:35:49.501 [8] INFO Global.DisposeAsync (499) Disposed RoundStateUpdaterCircuit.
2024-05-11 22:35:49.503 [14] INFO Global.DisposeAsync (504) HttpClientFactory is disposed.
2024-05-11 22:35:49.503 [14] INFO Global.DisposeAsync (508) CoordinatorHttpClientFactory is disposed.
2024-05-11 22:35:49.504 [14] INFO Global.DisposeAsync (525) TorStatusChecker is stopped.
2024-05-11 22:35:54.513 [12] WARNING Global.DisposeAsync (574) System.Threading.Tasks.TaskCanceledException: A task was canceled.
at WalletWasabi.Daemon.Global.DisposeAsync() in WalletWasabi.Daemon\Global.cs:line 531
2024-05-11 22:35:54.514 [1] INFO TerminateService.Terminate (192) Wasabi stopped gracefully (6f4ee334-6570-45e3-903f-541f6523600c).
2024-05-11 22:35:54.525 [1] INFO WasabiApplication.BeforeStopping (98) Wasabi GUI stopped gracefully (6f4ee334-6570-45e3-903f-541f6523600c).
2024-05-11 22:35:54.556 [1] CRITICAL Program.Main (79) System.InvalidOperationException: No attempt to start Tor was successful.
at WalletWasabi.Tor.TorProcessManager.StartAsync(Int32 attempts, CancellationToken cancellationToken) in WalletWasabi\Tor\TorProcessManager.cs:line 99
at WalletWasabi.Daemon.Global.StartTorProcessManagerAsync(CancellationToken cancellationToken) in WalletWasabi.Daemon\Global.cs:line 320
at WalletWasabi.Daemon.Global.InitializeNoWalletAsync(Boolean initializeSleepInhibitor, TerminateService terminateService, CancellationToken cancellationToken) in WalletWasabi.Daemon\Global.cs:line 217
at WalletWasabi.Fluent.Desktop.WasabiAppExtensions.<>c__DisplayClass0_1.<<RunAsGuiAsync>b__6>d.MoveNext() in WalletWasabi.Fluent.Desktop\Program.cs:line 178
--- End of stack trace from previous location ---
at WalletWasabi.Fluent.App.<OnFrameworkInitializationCompleted>b__6_1() in WalletWasabi.Fluent\App.axaml.cs:line 66
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
at Avalonia.Threading.SendOrPostCallbackDispatcherOperation.InvokeCore()
at Avalonia.Threading.DispatcherOperation.Execute()
at Avalonia.Threading.Dispatcher.ExecuteJob(DispatcherOperation job)
at Avalonia.Threading.Dispatcher.ExecuteJobsCore(Boolean fromExplicitBackgroundProcessingCallback)
at Avalonia.Threading.Dispatcher.Signaled()
at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
at Avalonia.Win32.Win32DispatcherImpl.RunLoop(CancellationToken cancellationToken)
at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl)
at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action`1 lifetimeBuilder)
at WalletWasabi.Fluent.Desktop.WasabiAppExtensions.<>c__DisplayClass0_0.<RunAsGuiAsync>b__0() in WalletWasabi.Fluent.Desktop\Program.cs:line 194
at WalletWasabi.Daemon.WasabiApplication.RunAsync(Func`1 afterStarting) in WalletWasabi.Daemon\WasabiApplication.cs:line 71
at WalletWasabi.Fluent.Desktop.WasabiAppExtensions.RunAsGuiAsync(WasabiApplication app) in WalletWasabi.Fluent.Desktop\Program.cs:line 151
at WalletWasabi.Fluent.Desktop.Program.Main(String[] args) in WalletWasabi.Fluent.Desktop\Program.cs:line 62
The message is incorrect because it is not starting Tor but other than that it's an expected result, or not? |
Yes this is the expected behavior imo. |
79e407e
to
c19640e
Compare
I added the following modification: https://github.com/zkSNACKs/WalletWasabi/compare/c19640e5de3551d532424d8e25a283e279204a68..5a9ee63a5755958d2af931bc6fbfe1dbbf8d0564 |
c19640e
to
5a9ee63
Compare
5a9ee63
to
4a5a025
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 4a5a025 on Qubes & Whonix, this is awesome, well done!
@@ -45,10 +46,17 @@ | |||
|
|||
<DockPanel> | |||
<TextBlock Text="Network anonymization (Tor)" /> | |||
<ToggleSwitch IsChecked="{Binding Settings.UseTor}" /> | |||
<ComboBox HorizontalAlignment="Stretch" ItemsSource="{Binding TorModes}" SelectedItem="{Binding Settings.UseTor}" Width="250"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A tooltip would have been helpful about what connect-only mode is.
@@ -45,10 +46,17 @@ | |||
|
|||
<DockPanel> | |||
<TextBlock Text="Network anonymization (Tor)" /> | |||
<ToggleSwitch IsChecked="{Binding Settings.UseTor}" /> | |||
<ComboBox HorizontalAlignment="Stretch" ItemsSource="{Binding TorModes}" SelectedItem="{Binding Settings.UseTor}" Width="250"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kiminuo The selection here doesn't even seem to be working. When I try to change it, it doesn't pop the restart message, and after restarting the software it resets back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for me the pop up does show and restarting the software keeps the right selection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something is clearly wrong, at least on Windows.
Original value: Disabled
Disabled
-> Enabled
. No restart message (there should be)
Enabled
-> Enabled connect only
restart message pops
Enabled connect only
-> Disabled
restart message stays (since Disabled is the original it should have been hidden)
Disabled
-> Enabled
no restart message (there should be)
Wasabi.Wallet.2024-05-22.11-50-19.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that also happened to me a few days ago.
my comment #12991 (comment), was a quick try just now, setting it from enabled to disabled which worked ok
@@ -92,7 +93,7 @@ public ApplicationSettings(string persistentConfigFilePath, PersistentConfig per | |||
: FeeDisplayUnit.Satoshis; | |||
_runOnSystemStartup = _uiConfig.RunOnSystemStartup; | |||
_hideOnClose = _uiConfig.HideOnClose; | |||
_useTor = _startupConfig.UseTor; | |||
_useTor = config.UseTor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@soosr Regarding your comments: I guess this line might be wrong and causes what you said.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were several iterations with how this new feature was implemented. I guess it was forgotten in one of those.
I created #13074 as that's what I would expect how it should be done. I don't have time to test it right now I'll test it later on.
Contributes to #12848
Alternative to #12979
This PR changes
--UseTor
command line option to be the following enum:--UseTor=EnabledConnectToRunning
does not rely on Tor control port2.UX
In the UI settings, it looks like this then:
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 37150On 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 --UseTor=EnabledOnlyRunning
You should be able to do a coinjoin or just use your wallet normally without a hiccup.
Footnotes
That was a goal for a long time. ↩
It seems it works but the cost is that we do not use
TorMonitor
. ↩