From 9d47050dff18c4ca39be0d2f3cfff7f6863a8ea0 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 9 Oct 2019 16:35:42 +0800 Subject: [PATCH] Use 0.0.0.0 by default for server host. Fixes https://github.com/GNS3/gns3-server/issues/1663 --- gns3server/run.py | 2 +- gns3server/web/route.py | 2 +- tests/test_run.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gns3server/run.py b/gns3server/run.py index 55cc1757..47f5067d 100644 --- a/gns3server/run.py +++ b/gns3server/run.py @@ -116,7 +116,7 @@ def parse_arguments(argv): config = Config.instance().get_section_config("Server") defaults = { - "host": config.get("host", "localhost"), + "host": config.get("host", "0.0.0.0"), "port": config.get("port", 3080), "ssl": config.getboolean("ssl", False), "certfile": config.get("certfile", ""), diff --git a/gns3server/web/route.py b/gns3server/web/route.py index 132e70a7..e656d45b 100644 --- a/gns3server/web/route.py +++ b/gns3server/web/route.py @@ -118,7 +118,7 @@ class Route(object): if not user: log.error("HTTP authentication is enabled but no username is configured") else: - log.error("Invalid authentication for username '{}'".format(user)) + log.error("Invalid HTTP authentication for username '{}'".format(user)) response = Response(request=request, route=route) response.set_status(401) diff --git a/tests/test_run.py b/tests/test_run.py index 356a2e9c..1f706847 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -71,7 +71,7 @@ def test_parse_arguments(capsys, tmpdir): assert "optional arguments" in out assert run.parse_arguments(["--host", "192.168.1.1"]).host == "192.168.1.1" - assert run.parse_arguments([]).host == "localhost" + assert run.parse_arguments([]).host == "0.0.0.0" server_config["host"] = "192.168.1.2" assert run.parse_arguments(["--host", "192.168.1.1"]).host == "192.168.1.1" assert run.parse_arguments([]).host == "192.168.1.2"