Will SSL being removed in 2.8 it and not supported in Android and iOS lets prevent it from living in 2.6.

Just removed the SSL code to stop the settings and not start the SSL server full removal will be in 2.8 when we change server infrastructure,
With test this time.

lp:~trb143/openlp/removessl26 (revision 2728)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1921/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1832/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Te...

bzr-revno: 2726
This commit is contained in:
tim.bentley@gmail.com 2017-03-04 17:41:53 +00:00 committed by Tim Bentley
commit e5abad85a7
6 changed files with 20 additions and 140 deletions

View File

@ -111,11 +111,6 @@ class OpenLPServer(RegistryProperties):
self.address = address
self.is_secure = Settings().value(self.settings_section + '/https enabled')
self.needs_authentication = Settings().value(self.settings_section + '/authentication enabled')
if self.is_secure:
port = Settings().value(self.settings_section + '/https port')
self.port = port
self.start_server_instance(address, port, HTTPSServer)
else:
port = Settings().value(self.settings_section + '/port')
self.port = port
self.start_server_instance(address, port, ThreadingHTTPServer)
@ -158,19 +153,3 @@ class OpenLPServer(RegistryProperties):
self.http_thread.stop()
self.httpd = None
log.debug('Stopped the server.')
class HTTPSServer(HTTPServer):
def __init__(self, address, handler):
"""
Initialise the secure handlers for the SSL server if required.s
"""
BaseServer.__init__(self, address, handler)
local_data = AppLocation.get_directory(AppLocation.DataDir)
self.socket = ssl.SSLSocket(
sock=socket.socket(self.address_family, self.socket_type),
certfile=os.path.join(local_data, 'remotes', 'openlp.crt'),
keyfile=os.path.join(local_data, 'remotes', 'openlp.key'),
server_side=True)
self.server_bind()
self.server_activate()

View File

@ -88,42 +88,6 @@ class RemoteTab(SettingsTab):
self.live_url.setOpenExternalLinks(True)
self.http_setting_layout.addRow(self.live_url_label, self.live_url)
self.left_layout.addWidget(self.http_settings_group_box)
self.https_settings_group_box = QtWidgets.QGroupBox(self.left_column)
self.https_settings_group_box.setCheckable(True)
self.https_settings_group_box.setChecked(False)
self.https_settings_group_box.setObjectName('https_settings_group_box')
self.https_settings_layout = QtWidgets.QFormLayout(self.https_settings_group_box)
self.https_settings_layout.setObjectName('https_settings_layout')
self.https_error_label = QtWidgets.QLabel(self.https_settings_group_box)
self.https_error_label.setVisible(False)
self.https_error_label.setWordWrap(True)
self.https_error_label.setObjectName('https_error_label')
self.https_settings_layout.addRow(self.https_error_label)
self.https_port_label = QtWidgets.QLabel(self.https_settings_group_box)
self.https_port_label.setObjectName('https_port_label')
self.https_port_spin_box = QtWidgets.QSpinBox(self.https_settings_group_box)
self.https_port_spin_box.setMaximum(32767)
self.https_port_spin_box.setObjectName('https_port_spin_box')
self.https_settings_layout.addRow(self.https_port_label, self.https_port_spin_box)
self.remote_https_url = QtWidgets.QLabel(self.https_settings_group_box)
self.remote_https_url.setObjectName('remote_http_url')
self.remote_https_url.setOpenExternalLinks(True)
self.remote_https_url_label = QtWidgets.QLabel(self.https_settings_group_box)
self.remote_https_url_label.setObjectName('remote_http_url_label')
self.https_settings_layout.addRow(self.remote_https_url_label, self.remote_https_url)
self.stage_https_url_label = QtWidgets.QLabel(self.http_settings_group_box)
self.stage_https_url_label.setObjectName('stage_https_url_label')
self.stage_https_url = QtWidgets.QLabel(self.https_settings_group_box)
self.stage_https_url.setObjectName('stage_https_url')
self.stage_https_url.setOpenExternalLinks(True)
self.https_settings_layout.addRow(self.stage_https_url_label, self.stage_https_url)
self.live_https_url_label = QtWidgets.QLabel(self.https_settings_group_box)
self.live_https_url_label.setObjectName('live_url_label')
self.live_https_url = QtWidgets.QLabel(self.https_settings_group_box)
self.live_https_url.setObjectName('live_https_url')
self.live_https_url.setOpenExternalLinks(True)
self.https_settings_layout.addRow(self.live_https_url_label, self.live_https_url)
self.left_layout.addWidget(self.https_settings_group_box)
self.user_login_group_box = QtWidgets.QGroupBox(self.left_column)
self.user_login_group_box.setCheckable(True)
self.user_login_group_box.setChecked(False)
@ -177,8 +141,6 @@ class RemoteTab(SettingsTab):
self.thumbnails_check_box.stateChanged.connect(self.on_thumbnails_check_box_changed)
self.address_edit.textChanged.connect(self.set_urls)
self.port_spin_box.valueChanged.connect(self.set_urls)
self.https_port_spin_box.valueChanged.connect(self.set_urls)
self.https_settings_group_box.clicked.connect(self.https_changed)
def retranslateUi(self):
self.server_settings_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'Server Settings'))
@ -200,14 +162,6 @@ class RemoteTab(SettingsTab):
translate('RemotePlugin.RemoteTab',
'Scan the QR code or click <a href="{qr}">download</a> to install the iOS app from the App '
'Store.').format(qr='https://itunes.apple.com/app/id1096218725'))
self.https_settings_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'HTTPS Server'))
self.https_error_label.setText(
translate('RemotePlugin.RemoteTab', 'Could not find an SSL certificate. The HTTPS server will not be '
'available unless an SSL certificate is found. Please see the manual for more information.'))
self.https_port_label.setText(self.port_label.text())
self.remote_https_url_label.setText(self.remote_url_label.text())
self.stage_https_url_label.setText(self.stage_url_label.text())
self.live_https_url_label.setText(self.live_url_label.text())
self.user_login_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'User Authentication'))
self.user_id_label.setText(translate('RemotePlugin.RemoteTab', 'User id:'))
self.password_label.setText(translate('RemotePlugin.RemoteTab', 'Password:'))
@ -218,17 +172,11 @@ class RemoteTab(SettingsTab):
"""
ip_address = self.get_ip_address(self.address_edit.text())
http_url = 'http://{url}:{text}/'.format(url=ip_address, text=self.port_spin_box.value())
https_url = 'https://{url}:{text}/'.format(url=ip_address, text=self.https_port_spin_box.value())
self.remote_url.setText('<a href="{url}">{url}</a>'.format(url=http_url))
self.remote_https_url.setText('<a href="{url}">{url}</a>'.format(url=https_url))
http_url_temp = http_url + 'stage'
https_url_temp = https_url + 'stage'
self.stage_url.setText('<a href="{url}">{url}</a>'.format(url=http_url_temp))
self.stage_https_url.setText('<a href="{url}">{url}</a>'.format(url=https_url_temp))
http_url_temp = http_url + 'main'
https_url_temp = https_url + 'main'
self.live_url.setText('<a href="{url}">{url}</a>'.format(url=http_url_temp))
self.live_https_url.setText('<a href="{url}">{url}</a>'.format(url=https_url_temp))
def get_ip_address(self, ip_address):
"""
@ -254,43 +202,25 @@ class RemoteTab(SettingsTab):
"""
Load the configuration and update the server configuration if necessary
"""
self.is_secure = Settings().value(self.settings_section + '/https enabled')
self.port_spin_box.setValue(Settings().value(self.settings_section + '/port'))
self.https_port_spin_box.setValue(Settings().value(self.settings_section + '/https port'))
self.address_edit.setText(Settings().value(self.settings_section + '/ip address'))
self.twelve_hour = Settings().value(self.settings_section + '/twelve hour')
self.twelve_hour_check_box.setChecked(self.twelve_hour)
self.thumbnails = Settings().value(self.settings_section + '/thumbnails')
self.thumbnails_check_box.setChecked(self.thumbnails)
local_data = AppLocation.get_directory(AppLocation.DataDir)
if not os.path.exists(os.path.join(local_data, 'remotes', 'openlp.crt')) or \
not os.path.exists(os.path.join(local_data, 'remotes', 'openlp.key')):
self.https_settings_group_box.setChecked(False)
self.https_settings_group_box.setEnabled(False)
self.https_error_label.setVisible(True)
else:
self.https_settings_group_box.setChecked(Settings().value(self.settings_section + '/https enabled'))
self.https_settings_group_box.setEnabled(True)
self.https_error_label.setVisible(False)
self.user_login_group_box.setChecked(Settings().value(self.settings_section + '/authentication enabled'))
self.user_id.setText(Settings().value(self.settings_section + '/user id'))
self.password.setText(Settings().value(self.settings_section + '/password'))
self.set_urls()
self.https_changed()
def save(self):
"""
Save the configuration and update the server configuration if necessary
"""
if Settings().value(self.settings_section + '/ip address') != self.address_edit.text() or \
Settings().value(self.settings_section + '/port') != self.port_spin_box.value() or \
Settings().value(self.settings_section + '/https port') != self.https_port_spin_box.value() or \
Settings().value(self.settings_section + '/https enabled') != \
self.https_settings_group_box.isChecked():
Settings().value(self.settings_section + '/port') != self.port_spin_box.value():
self.settings_form.register_post_process('remotes_config_updated')
Settings().setValue(self.settings_section + '/port', self.port_spin_box.value())
Settings().setValue(self.settings_section + '/https port', self.https_port_spin_box.value())
Settings().setValue(self.settings_section + '/https enabled', self.https_settings_group_box.isChecked())
Settings().setValue(self.settings_section + '/ip address', self.address_edit.text())
Settings().setValue(self.settings_section + '/twelve hour', self.twelve_hour)
Settings().setValue(self.settings_section + '/thumbnails', self.thumbnails)
@ -317,12 +247,6 @@ class RemoteTab(SettingsTab):
if check_state == QtCore.Qt.Checked:
self.thumbnails = True
def https_changed(self):
"""
Invert the HTTP group box based on Https group settings
"""
self.http_settings_group_box.setEnabled(not self.https_settings_group_box.isChecked())
def generate_icon(self):
"""
Generate icon for main window
@ -330,12 +254,6 @@ class RemoteTab(SettingsTab):
self.remote_server_icon.hide()
icon = QtGui.QImage(':/remote/network_server.png')
icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
if self.is_secure:
overlay = QtGui.QImage(':/remote/network_ssl.png')
overlay = overlay.scaled(60, 60, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
painter = QtGui.QPainter(icon)
painter.drawImage(0, 0, overlay)
painter.end()
if Settings().value(self.settings_section + '/authentication enabled'):
overlay = QtGui.QImage(':/remote/network_auth.png')
overlay = overlay.scaled(60, 60, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)

View File

@ -37,8 +37,6 @@ from tests.helpers.testmixin import TestMixin
__default_settings__ = {
'remotes/twelve hour': True,
'remotes/port': 4316,
'remotes/https port': 4317,
'remotes/https enabled': False,
'remotes/user id': 'openlp',
'remotes/password': 'password',
'remotes/authentication enabled': False,
@ -85,7 +83,6 @@ class TestRemoteTab(TestCase, TestMixin):
"""
Test the get_ip_address function with given ip address
"""
# GIVEN: A mocked location
# GIVEN: An ip address
given_ip = '192.168.1.1'
# WHEN: the default ip address is given
@ -114,36 +111,24 @@ class TestRemoteTab(TestCase, TestMixin):
self.form.set_urls()
# THEN: the following screen values should be set
self.assertEqual(self.form.address_edit.text(), ZERO_URL, 'The default URL should be set on the screen')
self.assertEqual(self.form.https_settings_group_box.isEnabled(), False,
'The Https box should not be enabled')
self.assertEqual(self.form.https_settings_group_box.isChecked(), False,
'The Https checked box should note be Checked')
self.assertEqual(self.form.user_login_group_box.isChecked(), False,
'The authentication box should not be enabled')
def test_set_certificate_urls(self):
def test_set_urls(self):
"""
Test the set_urls function with certificate available
Test the set_url function to generate correct url links
"""
# GIVEN: A mocked location
with patch('openlp.core.common.Settings') as mocked_class, \
patch('openlp.core.common.applocation.AppLocation.get_directory') as mocked_get_directory, \
patch('openlp.core.common.check_directory_exists') as mocked_check_directory_exists, \
patch('openlp.core.common.applocation.os') as mocked_os:
# GIVEN: A mocked out Settings class and a mocked out AppLocation.get_directory()
mocked_settings = mocked_class.return_value
mocked_settings.contains.return_value = False
mocked_get_directory.return_value = TEST_PATH
mocked_check_directory_exists.return_value = True
mocked_os.path.normpath.return_value = TEST_PATH
# WHEN: when the set_urls is called having reloaded the form.
self.form.load()
# GIVEN: An ip address
self.form.address_edit.setText('192.168.1.1')
# WHEN: the urls are generated
self.form.set_urls()
# THEN: the following screen values should be set
self.assertEqual(self.form.http_settings_group_box.isEnabled(), True,
'The Http group box should be enabled')
self.assertEqual(self.form.https_settings_group_box.isChecked(), False,
'The Https checked box should be Checked')
self.assertEqual(self.form.https_settings_group_box.isEnabled(), True,
'The Https box should be enabled')
# THEN: the following links are returned
self.assertEqual(self.form.remote_url.text(),
"<a href=\"http://192.168.1.1:4316/\">http://192.168.1.1:4316/</a>",
'The return value should be a fully formed link')
self.assertEqual(self.form.stage_url.text(),
"<a href=\"http://192.168.1.1:4316/stage\">http://192.168.1.1:4316/stage</a>",
'The return value should be a fully formed stage link')
self.assertEqual(self.form.live_url.text(),
"<a href=\"http://192.168.1.1:4316/main\">http://192.168.1.1:4316/main</a>",
'The return value should be a fully formed main link')

View File

@ -35,8 +35,6 @@ from tests.helpers.testmixin import TestMixin
__default_settings__ = {
'remotes/twelve hour': True,
'remotes/port': 4316,
'remotes/https port': 4317,
'remotes/https enabled': False,
'remotes/user id': 'openlp',
'remotes/password': 'password',
'remotes/authentication enabled': False,