diff --git a/onionshare/__init__.py b/onionshare/__init__.py
index becca93f..51210b6b 100644
--- a/onionshare/__init__.py
+++ b/onionshare/__init__.py
@@ -111,6 +111,10 @@ def main(cwd=None):
except KeyboardInterrupt:
print("")
sys.exit()
+ except (TorTooOld, TorErrorProtocolError) as e:
+ print("")
+ print(e.args[0])
+ sys.exit()
# Prepare files to share
print(strings._("preparing_files"))
diff --git a/onionshare/onion.py b/onionshare/onion.py
index 9aef3191..d213cd6a 100644
--- a/onionshare/onion.py
+++ b/onionshare/onion.py
@@ -443,18 +443,18 @@ class Onion(object):
# is the key a v2 key?
if onionkey.is_v2_key(key_content):
key_type = "RSA1024"
- # The below section is commented out because re-publishing
- # a pre-prepared v3 private key is currently unstable in Tor.
- # This is fixed upstream but won't reach stable until 0.3.5
- # (expected in December 2018)
- # See https://trac.torproject.org/projects/tor/ticket/25552
- # Until then, we will deliberately not work with 'persistent'
- # v3 onions, which should not be possible via the GUI settings
- # anyway.
- # Our ticket: https://github.com/micahflee/onionshare/issues/677
- #
- # Assume it was a v3 key
- # key_type = "ED25519-V3"
+ # The below section is commented out because re-publishing
+ # a pre-prepared v3 private key is currently unstable in Tor.
+ # This is fixed upstream but won't reach stable until 0.3.5
+ # (expected in December 2018)
+ # See https://trac.torproject.org/projects/tor/ticket/25552
+ # Until then, we will deliberately not work with 'persistent'
+ # v3 onions, which should not be possible via the GUI settings
+ # anyway.
+ # Our ticket: https://github.com/micahflee/onionshare/issues/677
+ #
+ # Assume it was a v3 key
+ # key_type = "ED25519-V3"
else:
raise TorErrorProtocolError(strings._('error_invalid_private_key'))
else:
@@ -473,6 +473,7 @@ class Onion(object):
basic_auth = None
self.stealth = False
+ self.common.log('Onion', 'start_onion_service', 'key_type={}'.format(key_type))
try:
if basic_auth != None:
res = self.c.create_ephemeral_hidden_service({ 80: port }, await_publication=True, basic_auth=basic_auth, key_type=key_type, key_content=key_content)
@@ -480,8 +481,8 @@ class Onion(object):
# if the stem interface is older than 1.5.0, basic_auth isn't a valid keyword arg
res = self.c.create_ephemeral_hidden_service({ 80: port }, await_publication=True, key_type=key_type, key_content=key_content)
- except ProtocolError:
- raise TorErrorProtocolError(strings._('error_tor_protocol_error'))
+ except ProtocolError as e:
+ raise TorErrorProtocolError(strings._('error_tor_protocol_error').format(e.args[0]))
self.service_id = res.service_id
onion_host = self.service_id + '.onion'
@@ -512,7 +513,7 @@ class Onion(object):
self.settings.save()
return onion_host
else:
- raise TorErrorProtocolError(strings._('error_tor_protocol_error'))
+ raise TorErrorProtocolError(strings._('error_tor_protocol_error_unknown'))
def cleanup(self, stop_tor=True):
"""
diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py
index b710fa3c..32e56ba0 100644
--- a/onionshare/onionshare.py
+++ b/onionshare/onionshare.py
@@ -21,6 +21,7 @@ along with this program. If not, see .
import os, shutil
from . import common, strings
+from .onion import TorTooOld, TorErrorProtocolError
from .common import ShutdownTimer
class OnionShare(object):
diff --git a/share/locale/en.json b/share/locale/en.json
index 4e7143d3..7d3daba8 100644
--- a/share/locale/en.json
+++ b/share/locale/en.json
@@ -122,7 +122,8 @@
"settings_error_bundled_tor_timeout": "Connecting to Tor is taking too long. Maybe your computer is offline, or your system clock isn't accurate.",
"settings_error_bundled_tor_broken": "OnionShare could not connect to Tor in the background:\n{}",
"settings_test_success": "Congratulations, OnionShare can connect to the Tor controller.\n\nTor version: {}\nSupports ephemeral onion services: {}\nSupports stealth onion services: {}",
- "error_tor_protocol_error": "Could not communicate with the Tor controller.\nIf you're using Whonix, check out https://www.whonix.org/wiki/onionshare to make OnionShare work.",
+ "error_tor_protocol_error": "There was an error with Tor: {}",
+ "error_tor_protocol_error_unknown": "There was an unknown error with Tor",
"error_invalid_private_key": "This private key type is unsupported",
"connecting_to_tor": "Connecting to the Tor network",
"update_available": "A new version of OnionShare is available. Click here to download it.
Installed version: {}
Latest version: {}",