From f09bb66425ea61973a46750e8f37e8292bce286f Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 14 Nov 2021 17:52:40 -0800 Subject: [PATCH] Snap successfully builds meek-client, and WIP getting tor to connect --- cli/onionshare_cli/onion.py | 38 ++++++++++++++++++---------- desktop/src/onionshare/gui_common.py | 2 +- snap/snapcraft.yaml | 25 +++++++++++------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/cli/onionshare_cli/onion.py b/cli/onionshare_cli/onion.py index 536b9ba0..39b1dc9a 100644 --- a/cli/onionshare_cli/onion.py +++ b/cli/onionshare_cli/onion.py @@ -354,6 +354,11 @@ class Onion(object): f.write("\nUseBridges 1\n") # Execute a tor subprocess + self.common.log( + "Onion", + "connect", + f"starting {self.tor_path} subprocess", + ) start_ts = time.time() if self.common.platform == "Windows": # In Windows, hide console window when opening tor.exe subprocess @@ -374,22 +379,29 @@ class Onion(object): ) # Wait for the tor controller to start + self.common.log( + "Onion", + "connect", + f"tor pid: {self.tor_proc.pid}", + ) time.sleep(2) # Connect to the controller - try: - if ( - self.common.platform == "Windows" - or self.common.platform == "Darwin" - ): - self.c = Controller.from_port(port=self.tor_control_port) - self.c.authenticate() - else: - self.c = Controller.from_socket_file(path=self.tor_control_socket) - self.c.authenticate() - except Exception as e: - print("OnionShare could not connect to Tor:\n{}".format(e.args[0])) - raise BundledTorBroken(e.args[0]) + self.common.log( + "Onion", + "connect", + "authenticating to tor controller", + ) + # try: + if self.common.platform == "Windows" or self.common.platform == "Darwin": + self.c = Controller.from_port(port=self.tor_control_port) + self.c.authenticate() + else: + self.c = Controller.from_socket_file(path=self.tor_control_socket) + self.c.authenticate() + # except Exception as e: + # print("OnionShare could not connect to Tor:\n{}".format(e)) + # raise BundledTorBroken(e.args[0]) while True: try: diff --git a/desktop/src/onionshare/gui_common.py b/desktop/src/onionshare/gui_common.py index af755401..d0ad249b 100644 --- a/desktop/src/onionshare/gui_common.py +++ b/desktop/src/onionshare/gui_common.py @@ -412,7 +412,7 @@ class GuiCommon: def get_tor_paths(self): if self.common.platform == "Linux": base_path = self.get_resource_path("tor") - if base_path: + if base_path and os.path.isdir(base_path): self.common.log( "GuiCommon", "get_tor_paths", "using paths in resources" ) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 7413bf72..e197c207 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -15,6 +15,7 @@ apps: onionshare: common-id: org.onionshare.OnionShare command: onionshare + extensions: [ gnome-3-34 ] plugs: - desktop - home @@ -125,7 +126,7 @@ parts: - setuptools - pynacl - colorama - - git+https://github.com/onionshare/stem.git@1.8.1 + - cepa == 1.8.3 stage-packages: - build-essential - libssl-dev @@ -135,7 +136,7 @@ parts: stage: - -usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 - -usr/share/doc/libssl1.1/changelog.Debian.gz - after: [tor, obfs4, snowflake-client] + after: [tor, obfs4, snowflake-client, meek-client] tor: source: https://dist.torproject.org/tor-0.4.6.8.tar.gz @@ -165,11 +166,17 @@ parts: source: https://git.torproject.org/pluggable-transports/snowflake.git source-type: git source-tag: v2.0.1 + organize: + bin/client: bin/snowflake-client - # meek-client: - # plugin: go - # go-importpath: git.torproject.org/pluggable-transports/meek.git/meek-client - # go-packages: ["google.golang.org/appengine"] - # source: https://git.torproject.org/pluggable-transports/meek.git - # source-type: git - # source-tag: v0.37.0 + meek-client: + plugin: go + go-channel: stable + go-importpath: git.torproject.org/pluggable-transports/meek.git/meek-client + # Not sure why I have to do this, but it works + override-build: | + cd meek-client + go build -o /root/parts/meek-client/install/bin ./... + source: https://git.torproject.org/pluggable-transports/meek.git + source-type: git + source-tag: v0.37.0