From f409b2986ce4d0436aa5ecccd6feb9c966ce3bf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Mon, 4 May 2020 14:12:36 +0200 Subject: [PATCH] fixing up stuff --- actor/src/udsactor/http/public.py | 4 +++- client-py3/full/src/uds/forward.py | 1 + server/src/uds/core/managers/user_service.py | 4 ++-- server/src/uds/core/managers/userservice/comms.py | 2 +- server/src/uds/dispatchers/guacamole/views.py | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/actor/src/udsactor/http/public.py b/actor/src/udsactor/http/public.py index 2dce4d10a..53f17ecf8 100644 --- a/actor/src/udsactor/http/public.py +++ b/actor/src/udsactor/http/public.py @@ -82,4 +82,6 @@ class PublicProvider(handler.Handler): return self._service._clientsPool.screenshot() # pylint: disable=protected-access def get_uuid(self) -> typing.Any: - return self._service._cfg.own_token # pylint: disable=protected-access + if self._service.isManaged(): + return self._service._cfg.own_token # pylint: disable=protected-access + return '' diff --git a/client-py3/full/src/uds/forward.py b/client-py3/full/src/uds/forward.py index 23d34b8f5..2bab11599 100644 --- a/client-py3/full/src/uds/forward.py +++ b/client-py3/full/src/uds/forward.py @@ -42,6 +42,7 @@ class Handler(socketserver.BaseRequestHandler): return logger.debug('Connected! Tunnel open %r -> %r -> %r', self.request.getpeername(), chan.getpeername(), (self.chain_host, self.chain_port)) + # self.ssh_transport.set_keepalive(10) # Keep alive every 10 seconds... try: while self.event.is_set() is False: r, _w, _x = select.select([self.request, chan], [], [], 1) # pylint: disable=unused-variable diff --git a/server/src/uds/core/managers/user_service.py b/server/src/uds/core/managers/user_service.py index cdf56206d..bb08e2380 100644 --- a/server/src/uds/core/managers/user_service.py +++ b/server/src/uds/core/managers/user_service.py @@ -607,8 +607,8 @@ class UserServiceManager: if self.checkUuid(userService) is False: # The service is not the expected one serviceNotReadyCode = 0x0004 - log.doLog(userService, log.WARN, "User service is not accessible (ip {0})".format(ip), log.TRANSPORT) - logger.debug('Transport is not ready for user service %s', userService) + log.doLog(userService, log.WARN, "User service is not accessible due to invalid UUID (ip {0})".format(ip), log.TRANSPORT) + logger.debug('UUID check failed for user service %s', userService) else: events.addEvent(userService.deployed_service, events.ET_ACCESS, username=userName, srcip=srcIp, dstip=ip, uniqueid=userService.unique_id) if ip: diff --git a/server/src/uds/core/managers/userservice/comms.py b/server/src/uds/core/managers/userservice/comms.py index 9ef739225..28267019b 100644 --- a/server/src/uds/core/managers/userservice/comms.py +++ b/server/src/uds/core/managers/userservice/comms.py @@ -102,7 +102,7 @@ def checkUuid(userService: 'UserService') -> bool: ''' try: uuid = _requestActor(userService, 'uuid') - if uuid != userService.uuid: + if uuid and uuid != userService.uuid: # Empty UUID means "no check this, fixed pool machine" logger.info('Machine %s do not have expected uuid %s, instead has %s', userService.friendly_name, userService.uuid, uuid) return False except NoActorComms: diff --git a/server/src/uds/dispatchers/guacamole/views.py b/server/src/uds/dispatchers/guacamole/views.py index c872b90d2..1e8217909 100644 --- a/server/src/uds/dispatchers/guacamole/views.py +++ b/server/src/uds/dispatchers/guacamole/views.py @@ -62,7 +62,7 @@ def guacamole(request: HttpRequest, tunnelId: str) -> HttpResponse: response = dict2resp(val) except Exception: - logger.error('Invalid guacamole ticket (F5 on client?): %s', tunnelId) + # logger.error('Invalid guacamole ticket (F5 on client?): %s', tunnelId) return HttpResponse(ERROR, content_type=CONTENT_TYPE) return HttpResponse(response, content_type=CONTENT_TYPE)