Merge pull request #2574 from dkua/Fix#2244

Reformatted the warning message of notebook server starting.

Public IP without SSL should prompt a warning.
Public IP in read-write mode and no password, also a warning.

Fix #2244
This commit is contained in:
Bussonnier Matthias 2012-11-17 09:02:02 -08:00
commit c0390645f2

View File

@ -470,11 +470,14 @@ 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:
self.log.critical(warning + " and not using encryption. This"
"is not recommended.")
if not self.password and not self.read_only:
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: