Fixing a future check for persistent v3 onions (still disabled for now)

This commit is contained in:
Miguel Jacq 2018-09-13 16:35:24 +10:00
parent 0b0eef7245
commit 25eed81b00
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6
2 changed files with 9 additions and 9 deletions

View File

@ -446,11 +446,10 @@ class Onion(object):
basic_auth = None basic_auth = None
if self.settings.get('private_key'): if self.settings.get('private_key'):
try: key_content = self.settings.get('private_key')
# is the key a v2 key? # is the key a v2 key?
key = onionkey.is_v2_key(self.settings.get('private_key')) if onionkey.is_v2_key(key_content):
key_type = "RSA1024" key_type = "RSA1024"
key_content = self.settings.get('private_key')
# The below section is commented out because re-publishing # The below section is commented out because re-publishing
# a pre-prepared v3 private key is currently unstable in Tor. # a pre-prepared v3 private key is currently unstable in Tor.
# This is fixed upstream but won't reach stable until 0.3.5 # This is fixed upstream but won't reach stable until 0.3.5
@ -460,11 +459,11 @@ class Onion(object):
# v3 onions, which should not be possible via the GUI settings # v3 onions, which should not be possible via the GUI settings
# anyway. # anyway.
# Our ticket: https://github.com/micahflee/onionshare/issues/677 # Our ticket: https://github.com/micahflee/onionshare/issues/677
except: #
pass # Assume it was a v3 key
# Assume it was a v3 key # key_type = "ED25519-V3"
# key_type = "ED25519-V3" else:
# key_content = self.settings.get('private_key') raise TorErrorProtocolError(strings._('error_invalid_private_key'))
self.common.log('Onion', 'Starting a hidden service with a saved private key') self.common.log('Onion', 'Starting a hidden service with a saved private key')
else: else:
# Work out if we can support v3 onion services, which are preferred # Work out if we can support v3 onion services, which are preferred

View File

@ -139,6 +139,7 @@
"settings_error_bundled_tor_broken": "OnionShare could not connect to Tor in the background:\n{}", "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: {}", "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": "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_invalid_private_key": "This private key type is unsupported",
"connecting_to_tor": "Connecting to the Tor network", "connecting_to_tor": "Connecting to the Tor network",
"update_available": "A new version of OnionShare is available. <a href='{}'>Click here</a> to download it.<br><br>Installed version: {}<br>Latest version: {}", "update_available": "A new version of OnionShare is available. <a href='{}'>Click here</a> to download it.<br><br>Installed version: {}<br>Latest version: {}",
"update_error_check_error": "Error checking for updates: Maybe you're not connected to Tor, or maybe the OnionShare website is down.", "update_error_check_error": "Error checking for updates: Maybe you're not connected to Tor, or maybe the OnionShare website is down.",