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

Bug: Tor Connection Never Connects to Tor on TailsOS #1060

Open
1 task done
ghost opened this issue Dec 23, 2024 · 0 comments
Open
1 task done

Bug: Tor Connection Never Connects to Tor on TailsOS #1060

ghost opened this issue Dec 23, 2024 · 0 comments

Comments

@ghost
Copy link

ghost commented Dec 23, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Tor Connection does not work on TailsOS for the AppImage native settings.

Expected Behavior

For the UI to set the Tor socks port to use 9050 and for it show green connected to Tor status on Tor only configured OS.

Reproduce Steps

I created a test wallet of two different stacks (Monero & Firo)
First though I enabled the Tor settings "Connect to Tor" however it was stuck at a yellow onion saying connecting.

Blockchain status: unable to synchronize

Launching with torsocks torsocks ./sw-v2.1.9.AppImage is able to get price and shows succeeded in Onion Circuits package and shows in green blockchain status for Monero in stack wallet GUI.
However Firo is unable to synchronize the blockchain when launching the AppImage with torsocks cli wrapper.
Also regardless of being launched with torsocks it still locks up on yellow status for Tor Connection status (never connects).

Environment

  • Operating system and version: TailsOS 6.10
  • Device platform and version: Debian 12

Logs

(dont want create a Gist for this see bellow)

Further Information

When launched with ./sw-v2.1.9.AppImage:

flutter: Log: [Info][2024-12-23 01:34:50.783Z]: TorSyncStatusChangedEvent fired with arg newStatus = TorConnectionStatus.connecting (TorService.start call in progress)
flutter: BUILD: DraggableSwitchButtonState
flutter: didChangeAppLifecycleState: inactive
flutter: didChangeAppLifecycleState: resumed
flutter: Log: [Info][2024-12-23 01:35:20.491Z]: RefreshPercentChangedEvent fired on f4284740-c0c7-11ef-9116-2f0d7d416c07 with percent (range of 0.0-1.0)= 0.0
flutter: Log: [Info][2024-12-23 01:35:20.491Z]: WalletSyncStatusChangedEvent fired in f4284740-c0c7-11ef-9116-2f0d7d416c07 with arg newStatus = WalletSyncStatus.syncing
flutter: Log: [Info][2024-12-23 01:35:41.799Z]: HTTP.get() rethrew: SocketException: Connection failed (OS Error: Network is unreachable, errno = 101), address = api.coingecko.com, port = 443
flutter: #0      _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:721)
flutter: #1      _RawSocket.startConnect (dart:io-patch/socket_patch.dart:1920)
flutter: #2      RawSocket.startConnect (dart:io-patch/socket_patch.dart:27)
flutter: #3      RawSecureSocket.startConnect (dart:io/secure_socket.dart:299)
flutter: #4      SecureSocket.startConnect (dart:io/secure_socket.dart:77)
flutter: #5      _ConnectionTarget.connect (dart:_http/http_impl.dart:2487)
flutter: #6      _HttpClient._getConnection.connect (dart:_http/http_impl.dart:2930)
flutter: #7      _HttpClient._getConnection (dart:_http/http_impl.dart:2935)
flutter: #8      _HttpClient._openUrl (dart:_http/http_impl.dart:2790)
flutter: #9      _HttpClient.getUrl (dart:_http/http_impl.dart:2632)
flutter: #10     HTTP.get (package:stackwallet/networking/http.dart:41)
flutter: #11     PriceAPI.getPricesAnd24hChange (package:stackwallet/services/price.dart:147)
flutter: <asynchronous suspension>

Proposed Fix:

Rewrite/patch the Tor Connection UI feature to detect if the operating system is Tails by reading the /etc/os-release file and then configuring a Tor connection to use 127.0.0.1 and port 9050 and state in the UI you are using Tails on 127.0.0.1:9050 or something of the likes.

import 'dart:io';

Future<void> main() async {
  // Check if the OS is Tails
  bool isTails = await isTailsOS();

  if (isTails) {
    print('Detected Tails OS. Configuring Tor connection...');
    // Use 127.0.0.1 and port 9050 for Tor connection
    String torHost = '127.0.0.1';
    int torPort = 9050;

    // Here you would set up your Tor connection using the specified host and port
    // For example, if using the http package:
    // var client = HttpClient();
    // client.findProxy = (uri) {
    //   return "PROXY $torHost:$torPort";
    // };
    
    // Continue with your application logic...
  } else {
    print('Not running on Tails OS. Using default Tor settings...');
    // Use the default Tor settings
  }
}

Future<bool> isTailsOS() async {
  try {
    // Read the /etc/os-release file
    final osRelease = await File('/etc/os-release').readAsString();
    
    // Check if the content contains "Tails"
    return osRelease.contains('Tails');
  } catch (e) {
    print('Error reading /etc/os-release: $e');
    return false;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants