mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Log attempts to do SSL renegotiation
This commit is contained in:
parent
a43efc8a5a
commit
60d03c0153
@ -356,6 +356,8 @@ class ServerLoop(object):
|
|||||||
def on_ssl_servername(self, socket, server_name, ssl_context):
|
def on_ssl_servername(self, socket, server_name, ssl_context):
|
||||||
c = self.connection_map.get(socket.fileno())
|
c = self.connection_map.get(socket.fileno())
|
||||||
if getattr(c, 'ssl_handshake_done', False):
|
if getattr(c, 'ssl_handshake_done', False):
|
||||||
|
c.ready = False
|
||||||
|
c.ssl_terminated = True
|
||||||
# We do not allow client initiated SSL renegotiation
|
# We do not allow client initiated SSL renegotiation
|
||||||
return ssl.ALERT_DESCRIPTION_NO_RENEGOTIATION
|
return ssl.ALERT_DESCRIPTION_NO_RENEGOTIATION
|
||||||
|
|
||||||
@ -543,6 +545,11 @@ class ServerLoop(object):
|
|||||||
self.close(s, conn)
|
self.close(s, conn)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
ignore.add(s)
|
ignore.add(s)
|
||||||
|
ssl_terminated = getattr(conn, 'ssl_terminated', False)
|
||||||
|
if ssl_terminated:
|
||||||
|
self.log.warn('Client tried to initiate SSL renegotiation, closing connection')
|
||||||
|
self.close(s, conn)
|
||||||
|
else:
|
||||||
self.log.exception('Unhandled exception in state: %s' % conn.state_description)
|
self.log.exception('Unhandled exception in state: %s' % conn.state_description)
|
||||||
if conn.ready:
|
if conn.ready:
|
||||||
if conn.response_started:
|
if conn.response_started:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user