Merge 2.2

This commit is contained in:
grossmj
2023-01-05 12:38:00 +08:00
21 changed files with 301 additions and 50 deletions

View File

@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import socket
import ipaddress
from fastapi import HTTPException, status
from gns3server.config import Config
@ -145,13 +146,19 @@ class PortManager:
@console_host.setter
def console_host(self, new_host):
"""
Bind console host to 0.0.0.0 if remote connections are allowed.
Bind console host to 0.0.0.0 or :: if remote connections are allowed.
"""
remote_console_connections = Config.instance().settings.Server.allow_remote_console
if remote_console_connections:
log.warning("Remote console connections are allowed")
self._console_host = "0.0.0.0"
try:
ip = ipaddress.ip_address(new_host)
if isinstance(ip, ipaddress.IPv6Address):
self._console_host = "::"
except ValueError:
log.warning("Could not determine IP address type for console host")
else:
self._console_host = new_host