From 58124632f6fb541c9f26dc601fcd4a2372c62d78 Mon Sep 17 00:00:00 2001 From: Matt Woodyard Date: Sat, 2 Nov 2013 22:39:41 -0400 Subject: [PATCH] Change Default SSL Configuration The default SSL configuration has problems negotiating the TLS bits on some sites. Setting TLSv1 as the only protocol choice, got alot more (at least the set I cared about) to work. --- ghost/ghost.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ghost/ghost.py b/ghost/ghost.py index f64ec11..dde96df 100644 --- a/ghost/ghost.py +++ b/ghost/ghost.py @@ -13,7 +13,7 @@ from PySide import QtWebKit from PySide.QtNetwork import QNetworkRequest, QNetworkAccessManager, \ QNetworkCookieJar, QNetworkDiskCache, \ - QNetworkProxy, QNetworkCookie + QNetworkProxy, QNetworkCookie, QSslConfiguration, QSsl from PySide import QtCore from PySide.QtCore import QSize, QByteArray, QUrl, QDateTime, \ QtCriticalMsg, QtDebugMsg, QtFatalMsg, \ @@ -27,7 +27,7 @@ from PyQt4 import QtWebKit from PyQt4.QtNetwork import QNetworkRequest, QNetworkAccessManager, \ QNetworkCookieJar, QNetworkDiskCache, \ - QNetworkProxy, QNetworkCookie + QNetworkProxy, QNetworkCookie, QSslConfiguration, QSsl from PyQt4 import QtCore from PyQt4.QtCore import QSize, QByteArray, QUrl, QDateTime, \ QtCriticalMsg, QtDebugMsg, QtFatalMsg, \ @@ -224,7 +224,7 @@ def __init__(self, user_agent=default_user_agent, wait_timeout=8, cache_dir=os.path.join(tempfile.gettempdir(), "ghost.py"), plugins_enabled=False, java_enabled=False, plugin_path=['/usr/lib/mozilla/plugins', ], - download_images=True, qt_debug=False, + download_images=True, qt_debug=False, no_sslv3 = True, show_scroolbars=True): self.http_resources = [] @@ -252,6 +252,15 @@ def __init__(self, user_agent=default_user_agent, wait_timeout=8, for p in plugin_path: Ghost._app.addLibraryPath(p) + + + if no_sslv3: + # enable tls1 only + old = QSslConfiguration.defaultConfiguration() + old.setProtocol(QSsl.TlsV1) + QSslConfiguration.setDefaultConfiguration(old) + + self.popup_messages = [] self.page = GhostWebPage(Ghost._app, self) QtWebKit.QWebSettings.setMaximumPagesInCache(0)