Disable SSL3 in Python wrap_socket
Against POODLE security vulnerability. Note: breaks Python2 support.
This commit is contained in:
parent
cb1508fa49
commit
cdd08e90b7
|
|
@ -833,11 +833,12 @@ class WebSocketServer(object):
|
||||||
% self.cert)
|
% self.cert)
|
||||||
retsock = None
|
retsock = None
|
||||||
try:
|
try:
|
||||||
retsock = ssl.wrap_socket(
|
# This stuff only works in Python3. In the Python 2.7.4 in Ubuntu it's mighty hard to disable SSLv3, because of the lack of SSLContext
|
||||||
sock,
|
sslcontext = ssl.SSLContext(protocol=ssl.PROTOCOL_SSLv23) # SSLv23 is the deprecrated, python 3.4 compatible way of saying 'everything, also TLS'
|
||||||
server_side=True,
|
sslcontext.load_cert_chain(certfile=self.cert, keyfile=self.key);
|
||||||
certfile=self.cert,
|
sslcontext.options |= ssl.OP_NO_SSLv3
|
||||||
keyfile=self.key)
|
|
||||||
|
retsock = sslcontext.wrap_socket(sock, server_side=True);
|
||||||
except ssl.SSLError:
|
except ssl.SSLError:
|
||||||
_, x, _ = sys.exc_info()
|
_, x, _ = sys.exc_info()
|
||||||
if x.args[0] == ssl.SSL_ERROR_EOF:
|
if x.args[0] == ssl.SSL_ERROR_EOF:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue