瀏覽代碼

HUE-9199 [core] Log list of SSL ciphers used by OpenSSL (#1072)

Ivan Dzikovsky 5 年之前
父節點
當前提交
832b256837
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      desktop/core/src/desktop/management/commands/runcherrypyserver.py

+ 7 - 2
desktop/core/src/desktop/management/commands/runcherrypyserver.py

@@ -77,6 +77,7 @@ def start_server(options):
     Start CherryPy server
     """
     from desktop.lib.wsgiserver import CherryPyWSGIServer as Server
+    from desktop.lib.wsgiserver import SSLConnection
     from django.core.handlers.wsgi import WSGIHandler
     # Translogger wraps a WSGI app with Apache-style combined logging.
     server = Server(
@@ -100,6 +101,11 @@ def start_server(options):
     try:
         server.bind_server()
         drop_privileges_if_necessary(options)
+
+        if isinstance(server.socket, SSLConnection):
+          ciphers = server.socket.get_cipher_list()
+          logging.info(_("List of enabled ciphers: {}").format(':'.join(ciphers)))
+
         server.listen_and_loop()
     except KeyboardInterrupt:
         server.stop()
@@ -121,8 +127,7 @@ def runcpserver(argset=[], **kwargs):
         return
 
     # Start the webserver
-    print(_('starting server with options:'))
-    pprint.pprint(options)
+    logging.info(_("Starting server with options:\n{}").format(pprint.pformat(options)))
 
     start_server(options)