Support meek_lite Pluggable Transport

Currently, meek/meek_lite is one of the few, if not only, mature pluggable transport that works in some heavily cenosored areas, for example, China. Therefore, this can be a nice feature to have.
This commit is contained in:
irykoon 2018-02-15 23:19:53 +00:00
parent 090a023db0
commit b2c310f2e0
No known key found for this signature in database
GPG Key ID: A14B4DBC6DCDD53C
9 changed files with 98 additions and 1 deletions

View File

@ -192,6 +192,8 @@ Section "install"
File "${BINPATH}\share\torrc_template" File "${BINPATH}\share\torrc_template"
File "${BINPATH}\share\torrc_template-windows" File "${BINPATH}\share\torrc_template-windows"
File "${BINPATH}\share\torrc_template-obfs4" File "${BINPATH}\share\torrc_template-obfs4"
File "${BINPATH}\share\torrc_template-meek_lite_amazon"
File "${BINPATH}\share\torrc_template-meek_lite_azure"
File "${BINPATH}\share\version.txt" File "${BINPATH}\share\version.txt"
File "${BINPATH}\share\wordlist.txt" File "${BINPATH}\share\wordlist.txt"
@ -404,6 +406,8 @@ FunctionEnd
Delete "$INSTDIR\share\torrc_template" Delete "$INSTDIR\share\torrc_template"
Delete "$INSTDIR\share\torrc_template-windows" Delete "$INSTDIR\share\torrc_template-windows"
Delete "$INSTDIR\share\torrc_template-obfs4" Delete "$INSTDIR\share\torrc_template-obfs4"
Delete "$INSTDIR\share\torrc_template-meek_lite_amazon"
Delete "$INSTDIR\share\torrc_template-meek_lite_azure"
Delete "$INSTDIR\share\version.txt" Delete "$INSTDIR\share\version.txt"
Delete "$INSTDIR\share\wordlist.txt" Delete "$INSTDIR\share\wordlist.txt"
Delete "$INSTDIR\sip.pyd" Delete "$INSTDIR\sip.pyd"

View File

@ -15,6 +15,8 @@ a = Analysis(
('../share/wordlist.txt', 'share'), ('../share/wordlist.txt', 'share'),
('../share/torrc_template', 'share'), ('../share/torrc_template', 'share'),
('../share/torrc_template-obfs4', 'share'), ('../share/torrc_template-obfs4', 'share'),
('../share/torrc_template-meek_lite_amazon', 'share'),
('../share/torrc_template-meek_lite_azure', 'share'),
('../share/torrc_template-windows', 'share'), ('../share/torrc_template-windows', 'share'),
('../share/images/*', 'share/images'), ('../share/images/*', 'share/images'),
('../share/locale/*', 'share/locale'), ('../share/locale/*', 'share/locale'),

View File

@ -211,9 +211,22 @@ class Onion(object):
with open(common.get_resource_path('torrc_template-obfs4')) as o: with open(common.get_resource_path('torrc_template-obfs4')) as o:
for line in o: for line in o:
f.write(line) f.write(line)
elif self.settings.get('tor_bridges_use_meek_lite_amazon'):
f.write('ClientTransportPlugin meek_lite exec {}\n'.format(self.obfs4proxy_file_path))
with open(common.get_resource_path('torrc_template-meek_lite_amazon')) as o:
for line in o:
f.write(line)
elif self.settings.get('tor_bridges_use_meek_lite_azure'):
f.write('ClientTransportPlugin meek_lite exec {}\n'.format(self.obfs4proxy_file_path))
with open(common.get_resource_path('torrc_template-meek_lite_azure')) as o:
for line in o:
f.write(line)
if self.settings.get('tor_bridges_use_custom_bridges'): if self.settings.get('tor_bridges_use_custom_bridges'):
if 'obfs4' in self.settings.get('tor_bridges_use_custom_bridges'): if 'obfs4' in self.settings.get('tor_bridges_use_custom_bridges'):
f.write('ClientTransportPlugin obfs4 exec {}\n'.format(self.obfs4proxy_file_path)) f.write('ClientTransportPlugin obfs4 exec {}\n'.format(self.obfs4proxy_file_path))
elif 'meek_lite' in self.settings.get('tor_bridges_use_custom_bridges'):
f.write('ClientTransportPlugin meek_lite exec {}\n'.format(self.obfs4proxy_file_path))
f.write(self.settings.get('tor_bridges_use_custom_bridges')) f.write(self.settings.get('tor_bridges_use_custom_bridges'))
f.write('\nUseBridges 1') f.write('\nUseBridges 1')
@ -267,7 +280,10 @@ class Onion(object):
time.sleep(0.2) time.sleep(0.2)
# If using bridges, it might take a bit longer to connect to Tor # If using bridges, it might take a bit longer to connect to Tor
if self.settings.get('tor_bridges_use_custom_bridges') or self.settings.get('tor_bridges_use_obfs4'): if self.settings.get('tor_bridges_use_custom_bridges') or \
self.settings.get('tor_bridges_use_obfs4') or \
self.settings.get('tor_bridges_use_meek_lite_amazon') or \
self.settings.get('tor_bridges_use_meek_lite_azure'):
connect_timeout = 150 connect_timeout = 150
else: else:
# Timeout after 120 seconds # Timeout after 120 seconds

View File

@ -63,6 +63,8 @@ class Settings(object):
'autoupdate_timestamp': None, 'autoupdate_timestamp': None,
'no_bridges': True, 'no_bridges': True,
'tor_bridges_use_obfs4': False, 'tor_bridges_use_obfs4': False,
'tor_bridges_use_meek_lite_amazon': False,
'tor_bridges_use_meek_lite_azure': False,
'tor_bridges_use_custom_bridges': '', 'tor_bridges_use_custom_bridges': '',
'save_private_key': False, 'save_private_key': False,
'private_key': '', 'private_key': '',

View File

@ -156,6 +156,26 @@ class SettingsDialog(QtWidgets.QDialog):
self.tor_bridges_use_obfs4_radio = QtWidgets.QRadioButton(strings._('gui_settings_tor_bridges_obfs4_radio_option', True)) self.tor_bridges_use_obfs4_radio = QtWidgets.QRadioButton(strings._('gui_settings_tor_bridges_obfs4_radio_option', True))
self.tor_bridges_use_obfs4_radio.toggled.connect(self.tor_bridges_use_obfs4_radio_toggled) self.tor_bridges_use_obfs4_radio.toggled.connect(self.tor_bridges_use_obfs4_radio_toggled)
# meek_lite-amazon option radio
# if the obfs4proxy binary is missing, we can't use meek_lite-amazon transports
(self.tor_path, self.tor_geo_ip_file_path, self.tor_geo_ipv6_file_path, self.obfs4proxy_file_path) = common.get_tor_paths()
if not os.path.isfile(self.obfs4proxy_file_path):
self.tor_bridges_use_meek_lite_amazon_radio = QtWidgets.QRadioButton(strings._('gui_settings_tor_bridges_meek_lite_amazon_radio_option_no_obfs4proxy', True))
self.tor_bridges_use_meel_lite_amazon_radio.setEnabled(False)
else:
self.tor_bridges_use_meek_lite_amazon_radio = QtWidgets.QRadioButton(strings._('gui_settings_tor_bridges_meek_lite_amazon_radio_option', True))
self.tor_bridges_use_meek_lite_amazon_radio.toggled.connect(self.tor_bridges_use_meek_lite_amazon_radio_toggled)
# meek_lite-azure option radio
# if the obfs4proxy binary is missing, we can't use meek_lite-azure transports
(self.tor_path, self.tor_geo_ip_file_path, self.tor_geo_ipv6_file_path, self.obfs4proxy_file_path) = common.get_tor_paths()
if not os.path.isfile(self.obfs4proxy_file_path):
self.tor_bridges_use_meek_lite_azure_radio = QtWidgets.QRadioButton(strings._('gui_settings_tor_bridges_meek_lite_azure_radio_option_no_obfs4proxy', True))
self.tor_bridges_use_meel_lite_azure_radio.setEnabled(False)
else:
self.tor_bridges_use_meek_lite_azure_radio = QtWidgets.QRadioButton(strings._('gui_settings_tor_bridges_meek_lite_azure_radio_option', True))
self.tor_bridges_use_meek_lite_azure_radio.toggled.connect(self.tor_bridges_use_meek_lite_azure_radio_toggled)
# Custom bridges radio and textbox # Custom bridges radio and textbox
self.tor_bridges_use_custom_radio = QtWidgets.QRadioButton(strings._('gui_settings_tor_bridges_custom_radio_option', True)) self.tor_bridges_use_custom_radio = QtWidgets.QRadioButton(strings._('gui_settings_tor_bridges_custom_radio_option', True))
self.tor_bridges_use_custom_radio.toggled.connect(self.tor_bridges_use_custom_radio_toggled) self.tor_bridges_use_custom_radio.toggled.connect(self.tor_bridges_use_custom_radio_toggled)
@ -179,6 +199,8 @@ class SettingsDialog(QtWidgets.QDialog):
bridges_layout = QtWidgets.QVBoxLayout() bridges_layout = QtWidgets.QVBoxLayout()
bridges_layout.addWidget(self.tor_bridges_no_bridges_radio) bridges_layout.addWidget(self.tor_bridges_no_bridges_radio)
bridges_layout.addWidget(self.tor_bridges_use_obfs4_radio) bridges_layout.addWidget(self.tor_bridges_use_obfs4_radio)
bridges_layout.addWidget(self.tor_bridges_use_meek_lite_amazon_radio)
bridges_layout.addWidget(self.tor_bridges_use_meek_lite_azure_radio)
bridges_layout.addWidget(self.tor_bridges_use_custom_radio) bridges_layout.addWidget(self.tor_bridges_use_custom_radio)
bridges_layout.addWidget(self.tor_bridges_use_custom_textbox_options) bridges_layout.addWidget(self.tor_bridges_use_custom_textbox_options)
@ -401,10 +423,15 @@ class SettingsDialog(QtWidgets.QDialog):
if self.old_settings.get('no_bridges'): if self.old_settings.get('no_bridges'):
self.tor_bridges_no_bridges_radio.setChecked(True) self.tor_bridges_no_bridges_radio.setChecked(True)
self.tor_bridges_use_obfs4_radio.setChecked(False) self.tor_bridges_use_obfs4_radio.setChecked(False)
self.tor_bridges_use_meek_lite_amazon_radio.setChecked(False)
self.tor_bridges_use_meek_lite_azure_radio.setChecked(False)
self.tor_bridges_use_custom_radio.setChecked(False) self.tor_bridges_use_custom_radio.setChecked(False)
else: else:
self.tor_bridges_no_bridges_radio.setChecked(False) self.tor_bridges_no_bridges_radio.setChecked(False)
self.tor_bridges_use_obfs4_radio.setChecked(self.old_settings.get('tor_bridges_use_obfs4')) self.tor_bridges_use_obfs4_radio.setChecked(self.old_settings.get('tor_bridges_use_obfs4'))
self.tor_bridges_use_meek_lite_amazon_radio.setChecked(self.old_settings.get('tor_bridges_use_meek_lite_amazon'))
self.tor_bridges_use_meek_lite_azure_radio.setChecked(self.old_settings.get('tor_bridges_use_meek_lite_azure'))
if self.old_settings.get('tor_bridges_use_custom_bridges'): if self.old_settings.get('tor_bridges_use_custom_bridges'):
self.tor_bridges_use_custom_radio.setChecked(True) self.tor_bridges_use_custom_radio.setChecked(True)
# Remove the 'Bridge' lines at the start of each bridge. # Remove the 'Bridge' lines at the start of each bridge.
@ -441,6 +468,20 @@ class SettingsDialog(QtWidgets.QDialog):
if checked: if checked:
self.tor_bridges_use_custom_textbox_options.hide() self.tor_bridges_use_custom_textbox_options.hide()
def tor_bridges_use_meek_lite_amazon_radio_toggled(self, checked):
"""
meek_lite-amazon bridges option was toggled. If checked, disable custom bridge options.
"""
if checked:
self.tor_bridges_use_custom_textbox_options.hide()
def tor_bridges_use_meek_lite_azure_radio_toggled(self, checked):
"""
meel_lite_azure bridges option was toggled. If checked, disable custom bridge options.
"""
if checked:
self.tor_bridges_use_custom_textbox_options.hide()
def tor_bridges_use_custom_radio_toggled(self, checked): def tor_bridges_use_custom_radio_toggled(self, checked):
""" """
Custom bridges option was toggled. If checked, show custom bridge options. Custom bridges option was toggled. If checked, show custom bridge options.
@ -624,6 +665,7 @@ class SettingsDialog(QtWidgets.QDialog):
'control_port_port', 'socks_address', 'socks_port', 'control_port_port', 'socks_address', 'socks_port',
'socket_file_path', 'auth_type', 'auth_password', 'socket_file_path', 'auth_type', 'auth_password',
'no_bridges', 'tor_bridges_use_obfs4', 'no_bridges', 'tor_bridges_use_obfs4',
'tor_bridges_use_meek_lite_amazon', 'tor_bridges_use_meek_lite_azure',
'tor_bridges_use_custom_bridges']): 'tor_bridges_use_custom_bridges']):
reboot_onion = True reboot_onion = True
@ -729,14 +771,33 @@ class SettingsDialog(QtWidgets.QDialog):
if self.tor_bridges_no_bridges_radio.isChecked(): if self.tor_bridges_no_bridges_radio.isChecked():
settings.set('no_bridges', True) settings.set('no_bridges', True)
settings.set('tor_bridges_use_obfs4', False) settings.set('tor_bridges_use_obfs4', False)
settings.set('tor_bridges_use_meek_lite_amazon', False)
settings.set('tor_bridges_use_meek_lite_azure', False)
settings.set('tor_bridges_use_custom_bridges', '') settings.set('tor_bridges_use_custom_bridges', '')
if self.tor_bridges_use_obfs4_radio.isChecked(): if self.tor_bridges_use_obfs4_radio.isChecked():
settings.set('no_bridges', False) settings.set('no_bridges', False)
settings.set('tor_bridges_use_obfs4', True) settings.set('tor_bridges_use_obfs4', True)
settings.set('tor_bridges_use_meek_lite_amazon', False)
settings.set('tor_bridges_use_meek_lite_azure', False)
settings.set('tor_bridges_use_custom_bridges', '')
if self.tor_bridges_use_meek_lite_amazon_radio.isChecked():
settings.set('no_bridges', False)
settings.set('tor_bridges_use_obfs4', False)
settings.set('tor_bridges_use_meek_lite_amazon', True)
settings.set('tor_bridges_use_meek_lite_azure', False)
settings.set('tor_bridges_use_custom_bridges', '')
if self.tor_bridges_use_meek_lite_azure_radio.isChecked():
settings.set('no_bridges', False)
settings.set('tor_bridges_use_obfs4', False)
settings.set('tor_bridges_use_meek_lite_amazon', False)
settings.set('tor_bridges_use_meek_lite_azure', True)
settings.set('tor_bridges_use_custom_bridges', '') settings.set('tor_bridges_use_custom_bridges', '')
if self.tor_bridges_use_custom_radio.isChecked(): if self.tor_bridges_use_custom_radio.isChecked():
settings.set('no_bridges', False) settings.set('no_bridges', False)
settings.set('tor_bridges_use_obfs4', False) settings.set('tor_bridges_use_obfs4', False)
settings.set('tor_bridges_use_meek_lite_amazon', False)
settings.set('tor_bridges_use_meek_lite_azure', False)
# Insert a 'Bridge' line at the start of each bridge. # Insert a 'Bridge' line at the start of each bridge.
# This makes it easier to copy/paste a set of bridges # This makes it easier to copy/paste a set of bridges
# provided from https://bridges.torproject.org # provided from https://bridges.torproject.org

View File

@ -95,6 +95,10 @@
"gui_settings_tor_bridges_no_bridges_radio_option": "Don't use bridges", "gui_settings_tor_bridges_no_bridges_radio_option": "Don't use bridges",
"gui_settings_tor_bridges_obfs4_radio_option": "Use built-in obfs4 pluggable transports", "gui_settings_tor_bridges_obfs4_radio_option": "Use built-in obfs4 pluggable transports",
"gui_settings_tor_bridges_obfs4_radio_option_no_obfs4proxy": "Use built-in obfs4 pluggable transports (requires obfs4proxy)", "gui_settings_tor_bridges_obfs4_radio_option_no_obfs4proxy": "Use built-in obfs4 pluggable transports (requires obfs4proxy)",
"gui_settings_tor_bridges_meek_lite_amazon_radio_option": "Use built-in meek_lite_amazon pluggable transports",
"gui_settings_tor_bridges_meek_lite_amazon_radio_option_no_meek_lite_obfs4proxy": "Use built-in meek_lite_amazon pluggable transports (requires obfs4proxy)",
"gui_settings_tor_bridges_meek_lite_azure_radio_option": "Use built-in meek_lite_azure pluggable transports",
"gui_settings_tor_bridges_meek_lite_azure_radio_option_no_obfs4proxy": "Use built-in meek_lite_azure pluggable transports (requires obfs4proxy)",
"gui_settings_tor_bridges_custom_radio_option": "Use custom bridges", "gui_settings_tor_bridges_custom_radio_option": "Use custom bridges",
"gui_settings_tor_bridges_custom_label": "You can get bridges from <a href=\"https://bridges.torproject.org/options\">https://bridges.torproject.org</a>", "gui_settings_tor_bridges_custom_label": "You can get bridges from <a href=\"https://bridges.torproject.org/options\">https://bridges.torproject.org</a>",
"gui_settings_tor_bridges_invalid": "None of the bridges you supplied seem to be valid, so they've been ignored.\nPlease try again with valid bridges.", "gui_settings_tor_bridges_invalid": "None of the bridges you supplied seem to be valid, so they've been ignored.\nPlease try again with valid bridges.",

View File

@ -0,0 +1,2 @@
Bridge meek_lite 0.0.2.0:2 B9E7141C594AF25699E0079C1F0146F409495296 url=https://d2cly7j4zqgua7.cloudfront.net/ front=a0.awsstatic.com
UseBridges 1

View File

@ -0,0 +1,2 @@
Bridge meek_lite 0.0.2.0:3 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com
UseBridges 1

View File

@ -60,6 +60,8 @@ class TestSettings:
'autoupdate_timestamp': None, 'autoupdate_timestamp': None,
'no_bridges': True, 'no_bridges': True,
'tor_bridges_use_obfs4': False, 'tor_bridges_use_obfs4': False,
'tor_bridges_use_meek_lite_amazon': False,
'tor_bridges_use_meek_lite_azure': False,
'tor_bridges_use_custom_bridges': '', 'tor_bridges_use_custom_bridges': '',
'save_private_key': False, 'save_private_key': False,
'private_key': '', 'private_key': '',
@ -125,6 +127,8 @@ class TestSettings:
assert settings_obj.get('autoupdate_timestamp') is None assert settings_obj.get('autoupdate_timestamp') is None
assert settings_obj.get('no_bridges') is True assert settings_obj.get('no_bridges') is True
assert settings_obj.get('tor_bridges_use_obfs4') is False assert settings_obj.get('tor_bridges_use_obfs4') is False
assert settings_obj.get('tor_bridges_use_meek_lite_amazon') is False
assert settings_obj.get('tor_bridges_use_meek_lite_azure') is False
assert settings_obj.get('tor_bridges_use_custom_bridges') == '' assert settings_obj.get('tor_bridges_use_custom_bridges') == ''