From c8d3dbcc981de8f7865530ae139206413d0a5315 Mon Sep 17 00:00:00 2001 From: dkua Date: Tue, 13 Nov 2012 11:49:34 -0500 Subject: [PATCH 1/3] Refactored warning printout as per Issue #2244 --- IPython/frontend/html/notebook/notebookapp.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py index fe1b3dc3d..2c211f77b 100644 --- a/IPython/frontend/html/notebook/notebookapp.py +++ b/IPython/frontend/html/notebook/notebookapp.py @@ -470,11 +470,13 @@ class NotebookApp(BaseIPythonApplication): ssl_options = None self.web_app.password = self.password self.http_server = httpserver.HTTPServer(self.web_app, ssl_options=ssl_options) - if ssl_options is None and not self.ip and not (self.read_only and not self.password): - self.log.critical('WARNING: the notebook server is listening on all IP addresses ' - 'but not using any encryption or authentication. This is highly ' - 'insecure and not recommended.') - + if not self.ip: + warning = "WARNING: The notebook server is listening on all IP addresses. " + if ssl_options is None: + warning += "And not using any encryption. " + if not (self.read_only and not self.password): + warning += "And not using authentication. " + self.log.critical(warning + "This is highly insecure and not recommended.") success = None for port in random_ports(self.port, self.port_retries+1): try: From da8c05414ec823cc89a2e188484b6f22776ee827 Mon Sep 17 00:00:00 2001 From: dkua Date: Tue, 13 Nov 2012 13:25:50 -0500 Subject: [PATCH 2/3] Made some changes to message and logic as advised by Fernando. --- IPython/frontend/html/notebook/notebookapp.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py index 2c211f77b..942c22a06 100644 --- a/IPython/frontend/html/notebook/notebookapp.py +++ b/IPython/frontend/html/notebook/notebookapp.py @@ -471,12 +471,12 @@ class NotebookApp(BaseIPythonApplication): self.web_app.password = self.password self.http_server = httpserver.HTTPServer(self.web_app, ssl_options=ssl_options) if not self.ip: - warning = "WARNING: The notebook server is listening on all IP addresses. " + warning = "WARNING: The notebook server is listening on all IP addresses" if ssl_options is None: - warning += "And not using any encryption. " - if not (self.read_only and not self.password): - warning += "And not using authentication. " - self.log.critical(warning + "This is highly insecure and not recommended.") + warning += ", and not using any encryption" + if not self.password and not self.read_only: + warning += ", and not using authentication" + self.log.critical(warning + ". This is highly insecure and not recommended.") success = None for port in random_ports(self.port, self.port_retries+1): try: From 5993c3bf9f075b6ebb39b5bce186dda4de5b24b2 Mon Sep 17 00:00:00 2001 From: dkua Date: Tue, 13 Nov 2012 18:06:15 -0500 Subject: [PATCH 3/3] Made changes as per discussion in PR thread. --- IPython/frontend/html/notebook/notebookapp.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py index 942c22a06..8ddd9a00b 100644 --- a/IPython/frontend/html/notebook/notebookapp.py +++ b/IPython/frontend/html/notebook/notebookapp.py @@ -473,10 +473,11 @@ class NotebookApp(BaseIPythonApplication): if not self.ip: warning = "WARNING: The notebook server is listening on all IP addresses" if ssl_options is None: - warning += ", and not using any encryption" + self.log.critical(warning + " and not using encryption. This" + "is not recommended.") if not self.password and not self.read_only: - warning += ", and not using authentication" - self.log.critical(warning + ". This is highly insecure and not recommended.") + self.log.critical(warning + "and not using authentication." + "This is highly insecure and not recommended.") success = None for port in random_ports(self.port, self.port_retries+1): try: