From ace11fd77a9df8eecc3c07b387222784e91dac2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Wed, 8 Feb 2017 11:23:52 +0100 Subject: [PATCH] Added timeout to RDP Tranpsort & little fix for OpenNebula access using SPICE --- server/src/uds/services/OpenNebula/LiveService.py | 4 ++-- server/src/uds/transports/RDP/TRDPTransport.py | 8 ++++++-- server/src/uds/transports/RDP/scripts/linux/tunnel.py | 2 +- server/src/uds/transports/RDP/scripts/macosx/tunnel.py | 4 ++-- server/src/uds/transports/RDP/scripts/windows/tunnel.py | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/server/src/uds/services/OpenNebula/LiveService.py b/server/src/uds/services/OpenNebula/LiveService.py index 05c0633a..d4d00d4a 100644 --- a/server/src/uds/services/OpenNebula/LiveService.py +++ b/server/src/uds/services/OpenNebula/LiveService.py @@ -40,7 +40,7 @@ from uds.core.ui import gui import logging -__updated__ = '2017-01-17' +__updated__ = '2017-02-02' logger = logging.getLogger(__name__) @@ -88,7 +88,7 @@ class LiveService(Service): # : Types of deploys (services in cache and/or assigned to users) deployedType = LiveDeployment - allowedProtocols = protocols.GENERIC + allowedProtocols = protocols.GENERIC + (protocols.SPICE,) servicesTypeProvided = (serviceTypes.VDI,) # Now the form part diff --git a/server/src/uds/transports/RDP/TRDPTransport.py b/server/src/uds/transports/RDP/TRDPTransport.py index 5b43b1d9..f26cf62b 100644 --- a/server/src/uds/transports/RDP/TRDPTransport.py +++ b/server/src/uds/transports/RDP/TRDPTransport.py @@ -48,7 +48,7 @@ import logging import random import string -__updated__ = '2017-01-25' +__updated__ = '2017-02-05' logger = logging.getLogger(__name__) @@ -69,7 +69,10 @@ class TRDPTransport(BaseRDPTransport): group = TUNNELED_GROUP tunnelServer = gui.TextField(label=_('Tunnel server'), order=1, tooltip=_('IP or Hostname of tunnel server sent to client device ("public" ip) and port. (use HOST:PORT format)'), tab=gui.TUNNEL_TAB) - tunnelCheckServer = gui.TextField(label=_('Tunnel host check'), order=2, tooltip=_('If not empty, this server will be used to check if service is running before assigning it to user. (use HOST:PORT format)'), tab=gui.TUNNEL_TAB) + # tunnelCheckServer = gui.TextField(label=_('Tunnel host check'), order=2, tooltip=_('If not empty, this server will be used to check if service is running before assigning it to user. (use HOST:PORT format)'), tab=gui.TUNNEL_TAB) + + tunnelWait = gui.NumericField(length=3, label=_('Tunnel wait time'), defvalue='10', minValue=1, maxValue=65536, order=2, tooltip=_('Maximum time to wait before closing the tunnel listener'), required=True, tab=gui.TUNNEL_TAB) + useEmptyCreds = BaseRDPTransport.useEmptyCreds fixedName = BaseRDPTransport.fixedName @@ -133,6 +136,7 @@ class TRDPTransport(BaseRDPTransport): 'tunPass': tunpass, 'tunHost': sshHost, 'tunPort': sshPort, + 'tunWait': self.tunnelWait.num(), 'username': username, 'password': password, 'hasCredentials': username != '' and password != '', diff --git a/server/src/uds/transports/RDP/scripts/linux/tunnel.py b/server/src/uds/transports/RDP/scripts/linux/tunnel.py index 2619290b..ea325081 100644 --- a/server/src/uds/transports/RDP/scripts/linux/tunnel.py +++ b/server/src/uds/transports/RDP/scripts/linux/tunnel.py @@ -61,7 +61,7 @@ if app is None or fnc is None: ''') else: # Open tunnel - forwardThread, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}', '{m.tunPass}', '{m.ip}', 3389) + forwardThread, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}', '{m.tunPass}', '{m.ip}', 3389, {m.tunnelWait}) # @UndefinedVariable if forwardThread.status == 2: raise Exception('Unable to open tunnel') diff --git a/server/src/uds/transports/RDP/scripts/macosx/tunnel.py b/server/src/uds/transports/RDP/scripts/macosx/tunnel.py index e7bb7d6e..ff6415ea 100644 --- a/server/src/uds/transports/RDP/scripts/macosx/tunnel.py +++ b/server/src/uds/transports/RDP/scripts/macosx/tunnel.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals # pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable, invalid-sequence-index -from PyQt4 import QtCore, QtGui +from PyQt4 import QtCore, QtGui # @UnresolvedImport import subprocess import os import urllib @@ -56,7 +56,7 @@ if executable is None: ''', QtGui.QMessageBox.Ok) -forwardThread, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}', '{m.tunPass}', '{m.ip}', 3389) +forwardThread, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}', '{m.tunPass}', '{m.ip}', 3389, {m.tunnelWait}) # @UndefinedVariable if forwardThread.status == 2: raise Exception('Unable to open tunnel') diff --git a/server/src/uds/transports/RDP/scripts/windows/tunnel.py b/server/src/uds/transports/RDP/scripts/windows/tunnel.py index 0f29a9c9..cd2e32b8 100644 --- a/server/src/uds/transports/RDP/scripts/windows/tunnel.py +++ b/server/src/uds/transports/RDP/scripts/windows/tunnel.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals # pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable -from PyQt4 import QtCore, QtGui +from PyQt4 import QtCore, QtGui # @UnresolvedImport import win32crypt # @UnresolvedImport import os import subprocess @@ -14,7 +14,7 @@ from uds import tools # @UnresolvedImport import six -forwardThread, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}', '{m.tunPass}', '{m.ip}', 3389) +forwardThread, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}', '{m.tunPass}', '{m.ip}', 3389, {m.tunnelWait}) # @UndefinedVariable if forwardThread.status == 2: raise Exception('Unable to open tunnel')