Added ignore certificate for getting server stats on localhost

This commit is contained in:
Adolfo Gómez García 2021-06-15 13:32:22 +02:00
parent 69fe9e0d38
commit d5f29bd20f
2 changed files with 6 additions and 0 deletions

View File

@ -269,7 +269,12 @@ class IPMachinesService(IPServiceBase):
IPMachineDeployed, userDeployment
)
theIP = IPServiceBase.getIp(assignableId)
theMAC = IPServiceBase.getMac(assignableId)
if self.storage.readData(theIP) is None:
self.storage.saveData(theIP, theIP)
if theMAC:
theIP += ';' + theMAC
return userServiceInstance.assign(theIP)
return userServiceInstance.error('IP already assigned')

View File

@ -137,6 +137,7 @@ async def getServerStats(detailed: bool = False) -> None:
# Context for local connection (ignores cert hostname)
context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE # For ServerStats, do not checks certificate
try:
host = cfg.listen_address if cfg.listen_address != '0.0.0.0' else 'localhost'