1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-08 21:18:00 +03:00

Addoed some logs to UDS operations and fixed udsactor ssl verification

This commit is contained in:
Adolfo Gómez García 2023-04-04 14:43:28 +02:00
parent ea343659ff
commit 59d578f292
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
5 changed files with 16 additions and 6 deletions

View File

@ -107,6 +107,7 @@ def _getIpAndMac(ifname: str) -> typing.Tuple[typing.Optional[str], typing.Optio
return (ip, mac)
def checkPermissions() -> bool:
return True
return os.getuid() == 0 # getuid only available on linux. Expect "complaioins" if edited from Windows
def getComputerName() -> str:

View File

@ -124,6 +124,10 @@ class UDSApi: # pylint: disable=too-few-public-methods
kwargs["ssl_context"] = context
return super().init_poolmanager(*args, **kwargs)
def cert_verify(self, conn, url, verify, cert): # pylint: disable=unused-argument
# Overridden to do nothing
return super().cert_verify(conn, url, validateCert, cert)
self._session = requests.Session()
self._session.mount("https://", UDSHTTPAdapter())
@ -200,7 +204,7 @@ class UDSServerApi(UDSApi):
priority=v['priority'],
isCustom=v['isCustom'],
)
except Exception:
except Exception as e:
pass
def register( # pylint: disable=too-many-arguments, too-many-locals

View File

@ -52,5 +52,6 @@ class Config(Handler):
def put(self):
for section, secDict in self._params.items():
for key, vals in secDict.items():
logger.info('Updating config value %s.%s to %s by %s', section, key, vals['value'], self._user.name)
CfgConfig.update(section, key, vals['value'])
return 'done'

View File

@ -199,7 +199,7 @@ class UserServiceManager(metaclass=singleton.Singleton):
"""
Creates a new cache for the deployed service publication at level indicated
"""
logger.debug(
logger.info(
'Creating a new cache element at level %s for publication %s',
cacheLevel,
publication,
@ -225,7 +225,7 @@ class UserServiceManager(metaclass=singleton.Singleton):
if servicePool.service.getType().publicationType is not None:
publication = servicePool.activePublication()
logger.debug(
logger.info(
'Creating a new assigned element for user %s por publication %s',
user,
publication,
@ -239,7 +239,7 @@ class UserServiceManager(metaclass=singleton.Singleton):
)
)
else:
logger.debug('Creating a new assigned element for user %s', user)
logger.info('Creating a new assigned element for user %s', user)
assigned = self.__createAssignedAtDbForNoPublication(servicePool, user)
assignedInstance = assigned.getInstance()
@ -323,7 +323,7 @@ class UserServiceManager(metaclass=singleton.Singleton):
@return: the Uservice canceling
"""
userService.refresh_from_db()
logger.debug('Canceling userService %s creation', userService)
logger.info('Canceling userService %s creation', userService)
if userService.isPreparing() is False:
logger.info(
@ -356,7 +356,7 @@ class UserServiceManager(metaclass=singleton.Singleton):
"""
with transaction.atomic():
userService = UserService.objects.select_for_update().get(id=userService.id)
logger.debug('Removing userService %a', userService)
logger.info('Removing userService %a', userService)
if (
userService.isUsable() is False
and State.isRemovable(userService.state) is False

View File

@ -110,6 +110,10 @@ def secureRequestsSession(verify: bool = True) -> 'requests.Session':
return super().init_poolmanager(*args, **kwargs)
def cert_verify(self, conn, url, _, cert): # pylint: disable=unused-argument
# Overridden to do nothing
return super().cert_verify(conn, url, verify, cert)
session = requests.Session()
session.mount("https://", UDSHTTPAdapter())