mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-23 01:08:54 +00:00
Merge 2.2
This commit is contained in:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user