1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-11 05:17:55 +03:00

Done transports migration to new model

This commit is contained in:
Adolfo Gómez García 2023-08-08 16:52:21 +02:00
parent f8fb32342f
commit 0d6ec1c779
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
23 changed files with 448 additions and 617 deletions

View File

@ -28,7 +28,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
UDS managers (downloads, users preferences, publications, ...)
UDS managers (downloads, users publications, ...)
Author: Adolfo Gómez, dkmaster at dkmon dot com
"""

View File

@ -35,4 +35,5 @@ from . import connections
from . import events
from . import services
from . import servers
from . import permissions
from . import permissions
# Preferences must be include explicitly, as it is not a "normal use" type

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2019 Virtual Cable S.L.
# Copyright (c) 2023 Virtual Cable S.L.U.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
@ -28,14 +27,12 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
Author: Adolfo Gómez, dkmaster at dkmon dot com
"""
# This module is deprecated and probably will be removed soon
import logging
import typing
logger = logging.getLogger(__name__)
class CommonPrefs:
SZ_PREF = 'screenSize'

View File

@ -36,12 +36,19 @@ from uds import models
from uds.core import types, ui
# ******************************************************
# Tunnel related common use fields and related functions
# ******************************************************
# Tunnel server field
def tunnelField() -> ui.gui.ChoiceField:
def tunnelServerValues() -> typing.List[ui.gui.ChoiceType]:
return [
ui.gui.choiceItem(v.uuid, f'{v.name} ({v.pretty_host})')
for v in models.RegisteredServerGroup.objects.filter(kind=types.servers.ServerType.TUNNEL).all()
]
return ui.gui.ChoiceField(
label=_('Tunnel server'),
order=1,
@ -51,8 +58,40 @@ def tunnelField() -> ui.gui.ChoiceField:
tab=ui.gui.Tab.TUNNEL,
)
def getTunnelFromField(fld: ui.gui.ChoiceField) -> models.RegisteredServerGroup:
try:
return models.RegisteredServerGroup.objects.get(uuid=fld.value)
except Exception:
return models.RegisteredServerGroup()
# Ticket validity time field (for http related tunnels)
def tunnelTicketValidityField() -> ui.gui.NumericField:
return ui.gui.NumericField(
length=3,
label=_('Ticket Validity'),
defvalue='60',
order=90,
tooltip=_(
'Allowed time, in seconds, for HTML5 client to reload data from UDS Broker. The default value of 60 is recommended.'
),
required=True,
minValue=60,
tab=ui.gui.Tab.ADVANCED,
)
# Tunnel wait time (for uds client related tunnels)
def tunnelTunnelWait(order: int = 2) -> ui.gui.NumericField:
return ui.gui.NumericField(
length=3,
label=_('Tunnel wait time'),
defvalue='30',
minValue=5,
maxValue=3600 * 24,
order=order,
tooltip=_('Maximum time, in seconds, to wait before disable new connections on client tunnel listener'),
required=True,
tab=ui.gui.Tab.TUNNEL,
)

View File

@ -29,9 +29,9 @@
Author: Adolfo Gómez, dkmaster at dkmon dot com
"""
import typing
from . import html5rdp, html5rds, html5ssh, html5vnc, nicedcv, rdp, rds, nomachine
from . import html5rdp, html5rds, html5ssh, html5vnc, nicedcv, rdp, rds, nomachine, spice, x2go
ALL: typing.Final = (html5rdp, html5rds, html5ssh, html5vnc, nicedcv, rdp, rds, nomachine)
ALL: typing.Final = (html5rdp, html5rds, html5ssh, html5vnc, nicedcv, rdp, rds, nomachine, spice, x2go)
def migrate(apps, schema_editor):
for i in ALL:

View File

@ -9,7 +9,7 @@ if typing.TYPE_CHECKING:
logger = logging.getLogger(__name__)
def tunnel_transport(apps, TransportType: typing.Type, serverAttr: str, name: str, comments: str, is_html_server: bool = False) -> None:
def tunnel_transport(apps, TransportType: typing.Type, serverAttr: str, is_html_server: bool = False) -> None:
"""
Migrates an old tunnel transport to a new one (with tunnelServer)
"""
@ -21,20 +21,19 @@ def tunnel_transport(apps, TransportType: typing.Type, serverAttr: str, name: st
# from uds.models import Transport, RegisteredServerGroup, RegisteredServer
for t in Transport.objects.filter(data_type=TransportType.typeType):
print(t)
# Extranct data
obj = TransportType(Environment(t.uuid), None)
obj.deserialize(t.data)
server = getattr(obj, serverAttr).value.strip()
# Guacamole server is https://<host>:<port>
server = getattr(obj, serverAttr).value
print(obj, server, is_html_server)
if is_html_server:
if not server.startswith('https://'):
# Skip if not https found
logger.error('Skipping %s transport %s as it does not starts with https://', TransportType.__name__, t.name)
continue
host, port = (server+':443').split('https://')[1].split(':')[:2]
else:
else: # Other servers are <host>:<port>
host, port = (server+':443').split(':')[:2]
# If no host or port, skip
if not host or not port:
@ -48,12 +47,16 @@ def tunnel_transport(apps, TransportType: typing.Type, serverAttr: str, name: st
logger.info('Creating new tunnel server for %s: %s:%s', TransportType.__name__, host, port)
# Create a new one, adding all tunnel servers to it
tunnel = RegisteredServerGroup.objects.create(
name=f'{name} on {host}:{port}',
comments=f'{comments or name} (migration)',
name=f'Tunnel on {host}:{port}',
comments=f'Migrated from {t.name}',
host=host,
port=port,
kind=servers.ServerType.TUNNEL,
)
else:
# Append transport name to comments
tunnel.comments = f'{tunnel.comments}, {t.name}'[:255]
tunnel.save(update_fields=['comments'])
tunnel.servers.set(RegisteredServer.objects.filter(kind=servers.ServerType.TUNNEL))
# Set tunnel server on transport
logger.info('Setting tunnel server %s on transport %s', tunnel.name, t.name)
@ -76,7 +79,6 @@ def tunnel_transport_back(apps, TransportType: typing.Type, serverAttr: str, is_
# from uds.models import Transport, RegisteredServerGroup
for t in Transport.objects.filter(data_type=TransportType.typeType):
print(t)
# Extranct data
obj = TransportType(Environment(t.uuid), None)
obj.deserialize(t.data)
@ -88,10 +90,9 @@ def tunnel_transport_back(apps, TransportType: typing.Type, serverAttr: str, is_
server.value = f'https://{tunnelServer.host}:{tunnelServer.port}'
else:
server.value = f'{tunnelServer.host}:{tunnelServer.port}'
print(obj, server)
# Save transport
t.data = obj.serialize()
t.save(update_fields=['data'])
except Exception as e: # nosec: ignore this
print(e)
logger.exception('Exception found while migrating BACK HTML5RDP transports')
logger.error('Exception found while migrating HTML5RDP transports: %s', e)

View File

@ -3,12 +3,12 @@
# Copyright (c) 2023 Virtual Cable S.L.U.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# Redistribution and use in source and binary forms, with or without modification
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# * Redistributions of source code must retain the above copyright notice
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# * Redistributions in binary form must reproduce the above copyright notice
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L.U. nor the names of its contributors
@ -22,7 +22,7 @@
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@ -33,7 +33,7 @@ import logging
from uds.core.ui import gui
from uds.core import transports
from . import migrator
from . import _migrator
logger = logging.getLogger(__name__)
@ -60,40 +60,22 @@ class HTML5RDPTransport(transports.Transport):
wallpaper = gui.CheckBoxField()
desktopComp = gui.CheckBoxField()
smooth = gui.CheckBoxField()
enableAudio = gui.CheckBoxField(
defvalue=gui.TRUE,
)
enableAudio = gui.CheckBoxField(defvalue=gui.TRUE)
enableAudioInput = gui.CheckBoxField()
enablePrinting = gui.CheckBoxField()
enableFileSharing = gui.ChoiceField(
defvalue='false',
)
enableClipboard = gui.ChoiceField(
defvalue='enabled',
)
enableFileSharing = gui.ChoiceField(defvalue='false')
enableClipboard = gui.ChoiceField(defvalue='enabled')
serverLayout = gui.ChoiceField(
defvalue='-',
)
serverLayout = gui.ChoiceField(defvalue='-')
ticketValidity = gui.NumericField(
defvalue='60',
)
ticketValidity = gui.NumericField(defvalue='60')
forceNewWindow = gui.ChoiceField(
defvalue=gui.FALSE,
)
security = gui.ChoiceField(
defvalue='any',
)
forceNewWindow = gui.ChoiceField(defvalue=gui.FALSE)
security = gui.ChoiceField(defvalue='any')
rdpPort = gui.NumericField(
defvalue='3389',
)
rdpPort = gui.NumericField(defvalue='3389')
customGEPath = gui.TextField(
defvalue='/',
)
customGEPath = gui.TextField(defvalue='/')
# This value is the new "tunnel server"
# Old guacamoleserver value will be stored also on database, but will be ignored
@ -101,7 +83,8 @@ class HTML5RDPTransport(transports.Transport):
def migrate(apps, schema_editor) -> None:
migrator.tunnel_transport(apps, HTML5RDPTransport, 'guacamoleServer', 'HTML5 RDP', 'Tunnel for HTML RDP', is_html_server=True)
_migrator.tunnel_transport(apps, HTML5RDPTransport, 'guacamoleServer', is_html_server=True)
def rollback(apps, schema_editor) -> None:
migrator.tunnel_transport_back(apps, HTML5RDPTransport, 'guacamoleServer', is_html_server=True)
_migrator.tunnel_transport_back(apps, HTML5RDPTransport, 'guacamoleServer', is_html_server=True)

View File

@ -3,12 +3,12 @@
# Copyright (c) 2023 Virtual Cable S.L.U.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# Redistribution and use in source and binary forms, with or without modification
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# * Redistributions of source code must retain the above copyright notice
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# * Redistributions in binary form must reproduce the above copyright notice
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L.U. nor the names of its contributors
@ -22,7 +22,7 @@
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@ -33,7 +33,7 @@ import logging
from uds.core.ui import gui
from uds.core import transports
from . import migrator
from . import _migrator
logger = logging.getLogger(__name__)
@ -48,9 +48,7 @@ class HTML5RDSTransport(transports.Transport):
typeName = 'RDS'
typeType = 'HTML5RDSTransport'
guacamoleServer = gui.TextField(
defvalue='https://',
)
guacamoleServer = gui.TextField(defvalue='https://')
useGlyptodonTunnel = gui.CheckBoxField()
useEmptyCreds = gui.CheckBoxField()
withoutDomain = gui.CheckBoxField()
@ -58,58 +56,28 @@ class HTML5RDSTransport(transports.Transport):
wallpaper = gui.CheckBoxField()
desktopComp = gui.CheckBoxField()
smooth = gui.CheckBoxField()
enableAudio = gui.CheckBoxField(
defvalue=gui.TRUE,
)
enableAudio = gui.CheckBoxField(defvalue=gui.TRUE)
enableAudioInput = gui.CheckBoxField()
enablePrinting = gui.CheckBoxField()
enableFileSharing = gui.ChoiceField(
defvalue='false',
)
enableClipboard = gui.ChoiceField(
defvalue='enabled',
)
serverLayout = gui.ChoiceField(
defvalue='-',
)
ticketValidity = gui.NumericField(
defvalue='60',
)
enableFileSharing = gui.ChoiceField(defvalue='false')
enableClipboard = gui.ChoiceField(defvalue='enabled')
serverLayout = gui.ChoiceField(defvalue='-')
ticketValidity = gui.NumericField(defvalue='60')
forceNewWindow = gui.ChoiceField(
defvalue=gui.FALSE,
)
security = gui.ChoiceField(
defvalue='any',
)
rdpPort = gui.NumericField(
defvalue='3389',
)
forceNewWindow = gui.ChoiceField(defvalue=gui.FALSE)
security = gui.ChoiceField(defvalue='any')
rdpPort = gui.NumericField(defvalue='3389')
customGEPath = gui.TextField(
defvalue='/',
)
customGEPath = gui.TextField(defvalue='/')
# Load balancing info
loadBalancingInfo = gui.TextField(
defvalue='',
)
loadBalancingInfo = gui.TextField(defvalue='')
gatewayHostname = gui.TextField(
defvalue='',
)
gatewayPort = gui.NumericField(
defvalue='443',
)
gatewayUsername = gui.TextField(
defvalue='',
)
gatewayPassword = gui.PasswordField(
defvalue='',
)
gatewayDomain = gui.TextField(
defvalue='',
)
gatewayHostname = gui.TextField(defvalue='')
gatewayPort = gui.NumericField(defvalue='443')
gatewayUsername = gui.TextField(defvalue='')
gatewayPassword = gui.PasswordField(defvalue='')
gatewayDomain = gui.TextField(defvalue='')
# This value is the new "tunnel server"
# Old guacamoleserver value will be stored also on database, but will be ignored
@ -117,7 +85,8 @@ class HTML5RDSTransport(transports.Transport):
def migrate(apps, schema_editor) -> None:
migrator.tunnel_transport(apps, HTML5RDSTransport, 'guacamoleServer', 'HTML5 RDS', 'Tunnel for HTML RDS', is_html_server=True)
_migrator.tunnel_transport(apps, HTML5RDSTransport, 'guacamoleServer', is_html_server=True)
def rollback(apps, schema_editor) -> None:
migrator.tunnel_transport_back(apps, HTML5RDSTransport , 'guacamoleServer', is_html_server=True)
_migrator.tunnel_transport_back(apps, HTML5RDSTransport, 'guacamoleServer', is_html_server=True)

View File

@ -33,7 +33,7 @@ import logging
from uds.core.ui import gui
from uds.core import transports
from . import migrator
from . import _migrator
logger = logging.getLogger(__name__)
@ -43,37 +43,18 @@ class HTML5SSHTransport(transports.Transport):
Provides access via SSH to service.
"""
typeName = 'HTML5 SSH migration'
typeType = 'HTML5SSHTransport'
guacamoleServer = gui.TextField(
defvalue='https://',
)
username = gui.TextField(
)
sshCommand = gui.TextField(
)
enableFileSharing = gui.ChoiceField(
defvalue='false',
)
fileSharingRoot = gui.TextField(
)
sshPort = gui.NumericField(
defvalue='22',
)
sshHostKey = gui.TextField(
)
serverKeepAlive = gui.NumericField(
defvalue='30',
)
ticketValidity = gui.NumericField(
defvalue='60',
)
forceNewWindow = gui.ChoiceField(
defvalue=gui.FALSE,
)
guacamoleServer = gui.TextField(defvalue='https://')
username = gui.TextField()
sshCommand = gui.TextField()
enableFileSharing = gui.ChoiceField(defvalue='false')
fileSharingRoot = gui.TextField()
sshPort = gui.NumericField(defvalue='22')
sshHostKey = gui.TextField()
serverKeepAlive = gui.NumericField(defvalue='30')
ticketValidity = gui.NumericField(defvalue='60')
forceNewWindow = gui.ChoiceField(defvalue=gui.FALSE)
# This value is the new "tunnel server"
# Old guacamoleserver value will be stored also on database, but will be ignored
@ -81,7 +62,8 @@ class HTML5SSHTransport(transports.Transport):
def migrate(apps, schema_editor) -> None:
migrator.tunnel_transport(apps, HTML5SSHTransport, 'guacamoleServer', 'HTML5 SSH', 'Tunnel for HTML SSH', is_html_server=True)
_migrator.tunnel_transport(apps, HTML5SSHTransport, 'guacamoleServer', is_html_server=True)
def rollback(apps, schema_editor) -> None:
migrator.tunnel_transport_back(apps, HTML5SSHTransport , 'guacamoleServer', is_html_server=True)
_migrator.tunnel_transport_back(apps, HTML5SSHTransport, 'guacamoleServer', is_html_server=True)

View File

@ -33,7 +33,7 @@ import logging
from uds.core.ui import gui
from uds.core import transports
from . import migrator
from . import _migrator
logger = logging.getLogger(__name__)
@ -47,30 +47,17 @@ class HTML5VNCTransport(transports.Transport):
typeName = 'HTML5 VNC Experimental'
typeType = 'HTML5VNCTransport'
guacamoleServer = gui.TextField(
defvalue='https://',
)
guacamoleServer = gui.TextField(defvalue='https://')
username = gui.TextField()
password = gui.PasswordField()
vncPort = gui.NumericField(
defvalue='5900',
)
colorDepth = gui.ChoiceField(
defvalue='-',
)
vncPort = gui.NumericField(defvalue='5900')
colorDepth = gui.ChoiceField(defvalue='-')
swapRedBlue = gui.CheckBoxField()
cursor = gui.CheckBoxField()
readOnly = gui.CheckBoxField()
ticketValidity = gui.NumericField(
defvalue='60',
)
forceNewWindow = gui.ChoiceField(
defvalue=gui.FALSE,
)
ticketValidity = gui.NumericField(defvalue='60')
forceNewWindow = gui.ChoiceField(defvalue=gui.FALSE)
# This value is the new "tunnel server"
# Old guacamoleserver value will be stored also on database, but will be ignored
@ -78,10 +65,8 @@ class HTML5VNCTransport(transports.Transport):
def migrate(apps, schema_editor) -> None:
migrator.tunnel_transport(
apps, HTML5VNCTransport, 'guacamoleServer', 'HTML5 VNC', 'Tunnel for HTML VNC', is_html_server=True
)
_migrator.tunnel_transport(apps, HTML5VNCTransport, 'guacamoleServer', is_html_server=True)
def rollback(apps, schema_editor) -> None:
migrator.tunnel_transport_back(apps, HTML5VNCTransport, 'guacamoleServer', is_html_server=True)
_migrator.tunnel_transport_back(apps, HTML5VNCTransport, 'guacamoleServer', is_html_server=True)

View File

@ -33,7 +33,7 @@ import logging
from uds.core.ui import gui
from uds.core import transports
from . import migrator
from . import _migrator
logger = logging.getLogger(__name__)
@ -50,9 +50,7 @@ class NICEDCVTunnelTransport(transports.Transport):
tunnelServer = gui.TextField()
tunnelWait = gui.NumericField(defvalue='60')
verifyCertificate = gui.CheckBoxField(defvalue=gui.TRUE)
useEmptyCreds = gui.CheckBoxField()
fixedName = gui.TextField()
fixedPassword = gui.PasswordField()
@ -68,10 +66,8 @@ class NICEDCVTunnelTransport(transports.Transport):
def migrate(apps, schema_editor) -> None:
migrator.tunnel_transport(
apps, NICEDCVTunnelTransport, 'tunnelServer', 'NICE DCV', 'Tunnel for NICE DCV', is_html_server=False
)
_migrator.tunnel_transport(apps, NICEDCVTunnelTransport, 'tunnelServer', is_html_server=False)
def rollback(apps, schema_editor) -> None:
migrator.tunnel_transport_back(apps, NICEDCVTunnelTransport, 'tunnelServer', is_html_server=False)
_migrator.tunnel_transport_back(apps, NICEDCVTunnelTransport, 'tunnelServer', is_html_server=False)

View File

@ -33,7 +33,7 @@ import logging
from uds.core.ui import gui
from uds.core import transports
from . import migrator
from . import _migrator
logger = logging.getLogger(__name__)
@ -45,16 +45,11 @@ class TSNoMachineTransport(transports.Transport):
This transport can use an domain. If username processed by authenticator contains '@', it will split it and left-@-part will be username, and right password
"""
isBase = False
typeType = 'TSNoMachineTransport'
tunnelServer = gui.TextField()
tunnelWait = gui.NumericField(defvalue='30')
verifyCertificate = gui.CheckBoxField(defvalue=gui.FALSE)
useEmptyCreds = gui.CheckBoxField()
fixedName = gui.TextField()
fixedPassword = gui.PasswordField()
@ -67,10 +62,8 @@ class TSNoMachineTransport(transports.Transport):
def migrate(apps, schema_editor) -> None:
migrator.tunnel_transport(
apps, TSNoMachineTransport, 'tunnelServer', 'NoMachine', 'Tunnel for NoMachine', is_html_server=False
)
_migrator.tunnel_transport(apps, TSNoMachineTransport, 'tunnelServer', is_html_server=False)
def rollback(apps, schema_editor) -> None:
migrator.tunnel_transport_back(apps, TSNoMachineTransport, 'tunnelServer', is_html_server=False)
_migrator.tunnel_transport_back(apps, TSNoMachineTransport, 'tunnelServer', is_html_server=False)

View File

@ -3,12 +3,12 @@
# Copyright (c) 2023 Virtual Cable S.L.U.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# Redistribution and use in source and binary forms, with or without modification
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# * Redistributions of source code must retain the above copyright notice
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# * Redistributions in binary form must reproduce the above copyright notice
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L.U. nor the names of its contributors
@ -22,7 +22,7 @@
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@ -33,7 +33,7 @@ import logging
from uds.core.ui import gui
from uds.core import transports
from . import migrator
from . import _migrator
logger = logging.getLogger(__name__)
@ -44,106 +44,44 @@ class TRDPTransport(transports.Transport):
Provides access via RDP to service.
This transport can use an domain. If username processed by authenticator contains '@', it will split it and left-@-part will be username, and right password
"""
typeType = 'TSRDPTransport'
tunnelServer = gui.TextField(
)
tunnelWait = gui.NumericField(
defvalue='60',
)
verifyCertificate = gui.CheckBoxField(
defvalue=gui.FALSE,
)
useEmptyCreds = gui.CheckBoxField(
)
fixedName = gui.TextField(
)
fixedPassword = gui.PasswordField(
)
withoutDomain = gui.CheckBoxField(
)
fixedDomain = gui.TextField(
)
allowSmartcards = gui.CheckBoxField(
)
allowPrinters = gui.CheckBoxField(
)
allowDrives = gui.ChoiceField(
defvalue='false',
)
enforceDrives = gui.TextField(
)
allowSerials = gui.CheckBoxField(
)
allowClipboard = gui.CheckBoxField(
defvalue=gui.TRUE,
)
allowAudio = gui.CheckBoxField(
defvalue=gui.TRUE,
)
allowWebcam = gui.CheckBoxField(
defvalue=gui.FALSE,
)
usbRedirection = gui.ChoiceField(
defvalue='false',
)
credssp = gui.CheckBoxField(
defvalue=gui.TRUE,
)
rdpPort = gui.NumericField(
defvalue='3389',
)
screenSize = gui.ChoiceField(
defvalue='-1x-1',
)
colorDepth = gui.ChoiceField(
defvalue='24',
)
wallpaper = gui.CheckBoxField(
)
multimon = gui.CheckBoxField(
)
aero = gui.CheckBoxField(
)
smooth = gui.CheckBoxField(
defvalue=gui.TRUE,
)
showConnectionBar = gui.CheckBoxField(
defvalue=gui.TRUE,
)
multimedia = gui.CheckBoxField(
)
alsa = gui.CheckBoxField(
)
printerString = gui.TextField(
)
smartcardString = gui.TextField(
)
customParameters = gui.TextField(
)
allowMacMSRDC = gui.CheckBoxField(
defvalue=gui.FALSE,
)
customParametersMAC = gui.TextField(
)
customParametersWindows = gui.TextField(
)
optimizeTeams = gui.CheckBoxField(
)
tunnelServer = gui.TextField()
tunnelWait = gui.NumericField(defvalue='60')
verifyCertificate = gui.CheckBoxField(defvalue=gui.FALSE)
useEmptyCreds = gui.CheckBoxField()
fixedName = gui.TextField()
fixedPassword = gui.PasswordField()
withoutDomain = gui.CheckBoxField()
fixedDomain = gui.TextField()
allowSmartcards = gui.CheckBoxField()
allowPrinters = gui.CheckBoxField()
allowDrives = gui.ChoiceField(defvalue='false')
enforceDrives = gui.TextField()
allowSerials = gui.CheckBoxField()
allowClipboard = gui.CheckBoxField(defvalue=gui.TRUE)
allowAudio = gui.CheckBoxField(defvalue=gui.TRUE)
allowWebcam = gui.CheckBoxField(defvalue=gui.FALSE)
usbRedirection = gui.ChoiceField(defvalue='false')
credssp = gui.CheckBoxField(defvalue=gui.TRUE)
rdpPort = gui.NumericField(defvalue='3389')
screenSize = gui.ChoiceField(defvalue='-1x-1')
colorDepth = gui.ChoiceField(defvalue='24')
wallpaper = gui.CheckBoxField()
multimon = gui.CheckBoxField()
aero = gui.CheckBoxField()
smooth = gui.CheckBoxField(defvalue=gui.TRUE)
showConnectionBar = gui.CheckBoxField(defvalue=gui.TRUE)
multimedia = gui.CheckBoxField()
alsa = gui.CheckBoxField()
printerString = gui.TextField()
smartcardString = gui.TextField()
customParameters = gui.TextField()
allowMacMSRDC = gui.CheckBoxField(defvalue=gui.FALSE)
customParametersMAC = gui.TextField()
customParametersWindows = gui.TextField()
optimizeTeams = gui.CheckBoxField()
# This value is the new "tunnel server"
# Old guacamoleserver value will be stored also on database, but will be ignored
@ -151,10 +89,8 @@ class TRDPTransport(transports.Transport):
def migrate(apps, schema_editor) -> None:
migrator.tunnel_transport(
apps, TRDPTransport, 'tunnelServer', 'RDP', 'Tunnel for RDP', is_html_server=False
)
_migrator.tunnel_transport(apps, TRDPTransport, 'tunnelServer', is_html_server=False)
def rollback(apps, schema_editor) -> None:
migrator.tunnel_transport_back(apps, TRDPTransport, 'tunnelServer', is_html_server=False)
_migrator.tunnel_transport_back(apps, TRDPTransport, 'tunnelServer', is_html_server=False)

View File

@ -33,7 +33,7 @@ import logging
from uds.core.ui import gui
from uds.core import transports
from . import migrator
from . import _migrator
logger = logging.getLogger(__name__)
@ -54,47 +54,25 @@ class TRDSTransport(transports.Transport):
fixedDomain = gui.TextField()
allowSmartcards = gui.CheckBoxField()
allowPrinters = gui.CheckBoxField()
allowDrives = gui.ChoiceField(
defvalue='false',
)
allowDrives = gui.ChoiceField(defvalue='false')
enforceDrives = gui.TextField()
allowSerials = gui.CheckBoxField()
allowClipboard = gui.CheckBoxField(
defvalue=gui.TRUE,
)
allowAudio = gui.CheckBoxField(
defvalue=gui.TRUE,
)
allowWebcam = gui.CheckBoxField(
defvalue=gui.FALSE,
)
credssp = gui.CheckBoxField(
defvalue=gui.TRUE,
)
rdpPort = gui.NumericField(
defvalue='3389',
)
allowClipboard = gui.CheckBoxField(defvalue=gui.TRUE)
allowAudio = gui.CheckBoxField(defvalue=gui.TRUE)
allowWebcam = gui.CheckBoxField(defvalue=gui.FALSE)
credssp = gui.CheckBoxField(defvalue=gui.TRUE)
rdpPort = gui.NumericField(defvalue='3389')
colorDepth = gui.ChoiceField()
smooth = gui.CheckBoxField(
defvalue=gui.TRUE,
)
windowState = gui.ChoiceField(
defvalue='normal',
)
executeAsShell = gui.CheckBoxField(
defvalue=gui.TRUE,
)
smooth = gui.CheckBoxField(defvalue=gui.TRUE)
windowState = gui.ChoiceField(defvalue='normal')
executeAsShell = gui.CheckBoxField(defvalue=gui.TRUE)
multimedia = gui.CheckBoxField()
alsa = gui.CheckBoxField()
printerString = gui.TextField()
smartcardString = gui.TextField()
customParameters = gui.TextField()
customParametersWindows = gui.TextField()
optimizeTeams = gui.CheckBoxField()
# This value is the new "tunnel server"
# Old guacamoleserver value will be stored also on database, but will be ignored
@ -102,10 +80,8 @@ class TRDSTransport(transports.Transport):
def migrate(apps, schema_editor) -> None:
migrator.tunnel_transport(
apps, TRDSTransport, 'tunnelServer', 'RDS', 'Tunnel for RDS', is_html_server=False
)
_migrator.tunnel_transport(apps, TRDSTransport, 'tunnelServer', is_html_server=False)
def rollback(apps, schema_editor) -> None:
migrator.tunnel_transport_back(apps, TRDSTransport, 'tunnelServer', is_html_server=False)
_migrator.tunnel_transport_back(apps, TRDSTransport, 'tunnelServer', is_html_server=False)

View File

@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2023 Virtual Cable S.L.U.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L.U. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
Author: Adolfo Gómez, dkmaster at dkmon dot com
"""
import logging
from uds.core.ui import gui
from uds.core import transports
from . import _migrator
logger = logging.getLogger(__name__)
# Copy for migration
class TSPICETransport(transports.Transport):
"""
Provides access via SPICE to service.
"""
typeType = 'TSSPICETransport'
tunnelServer = gui.TextField()
tunnelWait = gui.NumericField(defvalue='30')
verifyCertificate = gui.CheckBoxField()
serverCertificate = gui.TextField()
fullScreen = gui.CheckBoxField()
smartCardRedirect = gui.CheckBoxField(defvalue=gui.FALSE)
usbShare = gui.CheckBoxField(defvalue=gui.FALSE)
autoNewUsbShare = gui.CheckBoxField(defvalue=gui.FALSE)
SSLConnection = gui.CheckBoxField(defvalue=gui.TRUE)
overridedProxy = gui.TextField()
# This value is the new "tunnel server"
# Old guacamoleserver value will be stored also on database, but will be ignored
tunnel = gui.ChoiceField()
def migrate(apps, schema_editor) -> None:
_migrator.tunnel_transport(apps, TSPICETransport, 'tunnelServer', is_html_server=False)
def rollback(apps, schema_editor) -> None:
_migrator.tunnel_transport_back(apps, TSPICETransport, 'tunnelServer', is_html_server=False)

View File

@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2023 Virtual Cable S.L.U.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L.U. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
Author: Adolfo Gómez, dkmaster at dkmon dot com
"""
import logging
from uds.core.ui import gui
from uds.core.types.preferences import CommonPrefs
from uds.core import transports
from . import _migrator
logger = logging.getLogger(__name__)
# Copy for migration
class TX2GOTransport(transports.Transport):
"""
Provides access via X2GO to service.
This transport can use an domain. If username processed by authenticator contains '@', it will split it and left-@-part will be username, and right password
"""
typeType = 'TX2GOTransport'
tunnelServer = gui.TextField()
tunnelWait = gui.NumericField(defvalue='30')
verifyCertificate = gui.CheckBoxField(defvalue=gui.FALSE)
fixedName = gui.TextField()
screenSize = gui.ChoiceField(defvalue=CommonPrefs.SZ_FULLSCREEN)
desktopType = gui.ChoiceField()
customCmd = gui.TextField()
sound = gui.CheckBoxField(defvalue=gui.TRUE)
exports = gui.CheckBoxField(defvalue=gui.FALSE)
speed = gui.ChoiceField(defvalue='3')
soundType = gui.ChoiceField(defvalue='pulse')
keyboardLayout = gui.TextField(defvalue='')
pack = gui.TextField(defvalue='16m-jpeg')
quality = gui.NumericField(defvalue='6')
# This value is the new "tunnel server"
# Old guacamoleserver value will be stored also on database, but will be ignored
tunnel = gui.ChoiceField()
def migrate(apps, schema_editor) -> None:
_migrator.tunnel_transport(apps, TX2GOTransport, 'tunnelServer', is_html_server=False)
def rollback(apps, schema_editor) -> None:
_migrator.tunnel_transport_back(apps, TX2GOTransport, 'tunnelServer', is_html_server=False)

View File

@ -39,7 +39,7 @@ from django.utils.translation import gettext_noop as _
from uds import models
from uds.core import transports, types
from uds.core.managers.crypto import CryptoManager
from uds.core.ui import gui
from uds.core import ui
from uds.core.util import fields, os_detector
from uds.core.util.model import getSqlDatetime
@ -53,7 +53,6 @@ logger = logging.getLogger(__name__)
READY_CACHE_TIMEOUT = 30
class HTML5RDPTransport(transports.Transport):
"""
Provides access via RDP to service.
@ -72,91 +71,91 @@ class HTML5RDPTransport(transports.Transport):
tunnel = fields.tunnelField()
useGlyptodonTunnel = gui.CheckBoxField(
useGlyptodonTunnel = ui.gui.CheckBoxField(
label=_('Use Glyptodon Enterprise tunnel'),
order=2,
tooltip=_(
'If checked, UDS will use Glyptodon Enterprise Tunnel for HTML tunneling instead of UDS Tunnel'
),
tab=gui.Tab.TUNNEL,
tab=ui.gui.Tab.TUNNEL,
)
useEmptyCreds = gui.CheckBoxField(
useEmptyCreds = ui.gui.CheckBoxField(
label=_('Empty creds'),
order=3,
tooltip=_('If checked, the credentials used to connect will be emtpy'),
tab=gui.Tab.CREDENTIALS,
tab=ui.gui.Tab.CREDENTIALS,
)
fixedName = gui.TextField(
fixedName = ui.gui.TextField(
label=_('Username'),
order=4,
tooltip=_('If not empty, this username will be always used as credential'),
tab=gui.Tab.CREDENTIALS,
tab=ui.gui.Tab.CREDENTIALS,
)
fixedPassword = gui.PasswordField(
fixedPassword = ui.gui.PasswordField(
label=_('Password'),
order=5,
tooltip=_('If not empty, this password will be always used as credential'),
tab=gui.Tab.CREDENTIALS,
tab=ui.gui.Tab.CREDENTIALS,
)
withoutDomain = gui.CheckBoxField(
withoutDomain = ui.gui.CheckBoxField(
label=_('Without Domain'),
order=6,
tooltip=_(
'If checked, the domain part will always be emptied (to connecto to xrdp for example is needed)'
),
tab=gui.Tab.CREDENTIALS,
tab=ui.gui.Tab.CREDENTIALS,
)
fixedDomain = gui.TextField(
fixedDomain = ui.gui.TextField(
label=_('Domain'),
order=7,
tooltip=_('If not empty, this domain will be always used as credential (used as DOMAIN\\user)'),
tab=gui.Tab.CREDENTIALS,
tab=ui.gui.Tab.CREDENTIALS,
)
wallpaper = gui.CheckBoxField(
wallpaper = ui.gui.CheckBoxField(
label=_('Show wallpaper'),
order=18,
tooltip=_(
'If checked, the wallpaper and themes will be shown on machine (better user experience, more bandwidth)'
),
tab=gui.Tab.PARAMETERS,
tab=ui.gui.Tab.PARAMETERS,
)
desktopComp = gui.CheckBoxField(
desktopComp = ui.gui.CheckBoxField(
label=_('Allow Desk.Comp.'),
order=19,
tooltip=_('If checked, desktop composition will be allowed'),
tab=gui.Tab.PARAMETERS,
tab=ui.gui.Tab.PARAMETERS,
)
smooth = gui.CheckBoxField(
smooth = ui.gui.CheckBoxField(
label=_('Font Smoothing'),
order=20,
tooltip=_('If checked, fonts smoothing will be allowed (windows clients only)'),
tab=gui.Tab.PARAMETERS,
tab=ui.gui.Tab.PARAMETERS,
)
enableAudio = gui.CheckBoxField(
enableAudio = ui.gui.CheckBoxField(
label=_('Enable Audio'),
order=21,
tooltip=_('If checked, the audio will be redirected to remote session (if client browser supports it)'),
tab=gui.Tab.PARAMETERS,
defvalue=gui.TRUE,
tab=ui.gui.Tab.PARAMETERS,
defvalue=ui.gui.TRUE,
)
enableAudioInput = gui.CheckBoxField(
enableAudioInput = ui.gui.CheckBoxField(
label=_('Enable Microphone'),
order=22,
tooltip=_(
'If checked, the microphone will be redirected to remote session (if client browser supports it)'
),
tab=gui.Tab.PARAMETERS,
tab=ui.gui.Tab.PARAMETERS,
)
enablePrinting = gui.CheckBoxField(
enablePrinting = ui.gui.CheckBoxField(
label=_('Enable Printing'),
order=23,
tooltip=_(
'If checked, the printing will be redirected to remote session (if client browser supports it)'
),
tab=gui.Tab.PARAMETERS,
tab=ui.gui.Tab.PARAMETERS,
)
enableFileSharing = gui.ChoiceField(
enableFileSharing = ui.gui.ChoiceField(
label=_('File Sharing'),
order=24,
tooltip=_('File upload/download redirection policy'),
@ -167,9 +166,9 @@ class HTML5RDPTransport(transports.Transport):
{'id': 'up', 'text': _('Allow upload only')},
{'id': 'true', 'text': _('Enable file sharing')},
],
tab=gui.Tab.PARAMETERS,
tab=ui.gui.Tab.PARAMETERS,
)
enableClipboard = gui.ChoiceField(
enableClipboard = ui.gui.ChoiceField(
label=_('Clipboard'),
order=25,
tooltip=_('Clipboard redirection policy'),
@ -180,111 +179,100 @@ class HTML5RDPTransport(transports.Transport):
{'id': 'dis-paste', 'text': _('Disable paste to remote')},
{'id': 'enabled', 'text': _('Enable clipboard')},
],
tab=gui.Tab.PARAMETERS,
tab=ui.gui.Tab.PARAMETERS,
)
serverLayout = gui.ChoiceField(
serverLayout = ui.gui.ChoiceField(
order=26,
label=_('Layout'),
tooltip=_('Keyboards Layout of server'),
tooltip=_('Keyboard Layout of server'),
required=True,
values=[
gui.choiceItem('-', 'default'),
gui.choiceItem('en-us-qwerty', _('English (US) keyboard')),
gui.choiceItem('en-gb-qwerty', _('English (GB) keyboard')),
gui.choiceItem('es-es-qwerty', _('Spanish keyboard')),
gui.choiceItem('es-latam-qwerty', _('Latin American keyboard')),
gui.choiceItem('da-dk-querty', _('Danish keyboard')),
gui.choiceItem('de-de-qwertz', _('German keyboard (qwertz)')),
gui.choiceItem('fr-fr-azerty', _('French keyboard (azerty)')),
gui.choiceItem('fr-be-azerty', _('Belgian French keyboard (azerty)')),
gui.choiceItem('de-ch-qwertz', _('Swiss German keyboard (qwertz)')),
gui.choiceItem('fr-ch-qwertz', _('Swiss French keyboard (qwertz)')),
gui.choiceItem('hu-hu-qwerty', _('Hungarian keyboard')),
gui.choiceItem('it-it-qwerty', _('Italian keyboard')),
gui.choiceItem('ja-jp-qwerty', _('Japanese keyboard')),
gui.choiceItem('no-no-querty', _('Norwegian keyboard')),
gui.choiceItem('pt-br-qwerty', _('Portuguese Brazilian keyboard')),
gui.choiceItem('sv-se-qwerty', _('Swedish keyboard')),
gui.choiceItem('tr-tr-qwerty', _('Turkish keyboard')),
gui.choiceItem('failsafe', _('Failsafe')),
ui.gui.choiceItem('-', 'default'),
ui.gui.choiceItem('en-us-qwerty', _('English (US) keyboard')),
ui.gui.choiceItem('en-gb-qwerty', _('English (GB) keyboard')),
ui.gui.choiceItem('es-es-qwerty', _('Spanish keyboard')),
ui.gui.choiceItem('es-latam-qwerty', _('Latin American keyboard')),
ui.gui.choiceItem('da-dk-querty', _('Danish keyboard')),
ui.gui.choiceItem('de-de-qwertz', _('German keyboard (qwertz)')),
ui.gui.choiceItem('fr-fr-azerty', _('French keyboard (azerty)')),
ui.gui.choiceItem('fr-be-azerty', _('Belgian French keyboard (azerty)')),
ui.gui.choiceItem('de-ch-qwertz', _('Swiss German keyboard (qwertz)')),
ui.gui.choiceItem('fr-ch-qwertz', _('Swiss French keyboard (qwertz)')),
ui.gui.choiceItem('hu-hu-qwerty', _('Hungarian keyboard')),
ui.gui.choiceItem('it-it-qwerty', _('Italian keyboard')),
ui.gui.choiceItem('ja-jp-qwerty', _('Japanese keyboard')),
ui.gui.choiceItem('no-no-querty', _('Norwegian keyboard')),
ui.gui.choiceItem('pt-br-qwerty', _('Portuguese Brazilian keyboard')),
ui.gui.choiceItem('sv-se-qwerty', _('Swedish keyboard')),
ui.gui.choiceItem('tr-tr-qwerty', _('Turkish keyboard')),
ui.gui.choiceItem('failsafe', _('Failsafe')),
],
defvalue='-',
tab=gui.Tab.PARAMETERS,
tab=ui.gui.Tab.PARAMETERS,
)
ticketValidity = gui.NumericField(
length=3,
label=_('Ticket Validity'),
defvalue='60',
order=90,
tooltip=_(
'Allowed time, in seconds, for HTML5 client to reload data from UDS Broker. The default value of 60 is recommended.'
),
required=True,
minValue=60,
tab=gui.Tab.ADVANCED,
)
ticketValidity = fields.tunnelTicketValidityField()
forceNewWindow = gui.ChoiceField(
forceNewWindow = ui.gui.ChoiceField(
order=91,
label=_('Force new HTML Window'),
tooltip=_('Select windows behavior for new connections on HTML5'),
required=True,
values=[
gui.choiceItem(
gui.FALSE,
ui.gui.choiceItem(
ui.gui.FALSE,
_('Open every connection on the same window, but keeps UDS window.'),
),
gui.choiceItem(gui.TRUE, _('Force every connection to be opened on a new window.')),
gui.choiceItem(
ui.gui.choiceItem(ui.gui.TRUE, _('Force every connection to be opened on a new window.')),
ui.gui.choiceItem(
'overwrite',
_('Override UDS window and replace it with the connection.'),
),
],
defvalue=gui.FALSE,
tab=gui.Tab.ADVANCED,
defvalue=ui.gui.FALSE,
tab=ui.gui.Tab.ADVANCED,
)
security = gui.ChoiceField(
security = ui.gui.ChoiceField(
order=92,
label=_('Security'),
tooltip=_('Connection security mode for Guacamole RDP connection'),
required=True,
values=[
gui.choiceItem('any', _('Any (Allow the server to choose the type of auth)')),
gui.choiceItem(
ui.gui.choiceItem('any', _('Any (Allow the server to choose the type of auth)')),
ui.gui.choiceItem(
'rdp',
_('RDP (Standard RDP encryption. Should be supported by all servers)'),
),
gui.choiceItem(
ui.gui.choiceItem(
'nla',
_(
'NLA (Network Layer authentication. Requires VALID username&password, or connection will fail)'
),
),
gui.choiceItem(
ui.gui.choiceItem(
'nla-ext',
_(
'NLA extended (Network Layer authentication. Requires VALID username&password, or connection will fail)'
),
),
gui.choiceItem('tls', _('TLS (Transport Security Layer encryption)')),
ui.gui.choiceItem('tls', _('TLS (Transport Security Layer encryption)')),
],
defvalue='any',
tab=gui.Tab.ADVANCED,
tab=ui.gui.Tab.ADVANCED,
)
rdpPort = gui.NumericField(
rdpPort = ui.gui.NumericField(
order=93,
length=5, # That is, max allowed value is 65535
label=_('RDP Port'),
tooltip=_('Use this port as RDP port. Defaults to 3389.'),
required=True, #: Numeric fields have always a value, so this not really needed
defvalue='3389',
tab=gui.Tab.ADVANCED,
tab=ui.gui.Tab.ADVANCED,
)
customGEPath = gui.TextField(
customGEPath = ui.gui.TextField(
label=_('Glyptodon Enterprise context path'),
order=94,
tooltip=_(
@ -293,7 +281,7 @@ class HTML5RDPTransport(transports.Transport):
defvalue='/',
length=128,
required=False,
tab=gui.Tab.ADVANCED,
tab=ui.gui.Tab.ADVANCED,
)
def initialize(self, values: 'Module.ValuesType'):
@ -484,7 +472,7 @@ class HTML5RDPTransport(transports.Transport):
ticket = models.TicketStore.create(params, validity=self.ticketValidity.num())
onw = f'&o_n_w={transport.uuid}'
if self.forceNewWindow.value == gui.TRUE:
if self.forceNewWindow.value == ui.gui.TRUE:
onw = f'&o_n_w={userService.deployed_service.uuid}'
elif self.forceNewWindow.value == 'overwrite':
onw = '&o_s_w=yes'

View File

@ -41,6 +41,8 @@ from uds.core.managers.crypto import CryptoManager
from uds.core.ui import gui
from uds.core.util import fields, os_detector
from ..HTML5RDP.html5rdp import HTML5RDPTransport
# Not imported at runtime, just for type checking
if typing.TYPE_CHECKING:
from uds.core.module import Module
@ -70,14 +72,7 @@ class HTML5SSHTransport(transports.Transport):
tunnel = fields.tunnelField()
useGlyptodonTunnel = gui.CheckBoxField(
label=_('Use Glyptodon Enterprise tunnel'),
order=2,
tooltip=_(
'If checked, UDS will use Glyptodon Enterprise Tunnel for HTML tunneling instead of UDS Tunnel'
),
tab=gui.Tab.TUNNEL,
)
useGlyptodonTunnel = HTML5RDPTransport.useGlyptodonTunnel
username = gui.TextField(
label=_('Username'),
@ -85,7 +80,7 @@ class HTML5SSHTransport(transports.Transport):
tooltip=_('Username for SSH connection authentication.'),
tab=gui.Tab.CREDENTIALS,
)
# password = gui.PasswordField(
# label=_('Password'),
# order=21,
@ -118,19 +113,7 @@ class HTML5SSHTransport(transports.Transport):
),
tab=gui.Tab.PARAMETERS,
)
enableFileSharing = gui.ChoiceField(
label=_('File Sharing'),
order=31,
tooltip=_('File upload/download redirection policy'),
defvalue='false',
values=[
{'id': 'false', 'text': _('Disable file sharing')},
{'id': 'down', 'text': _('Allow download only')},
{'id': 'up', 'text': _('Allow upload only')},
{'id': 'true', 'text': _('Enable file sharing')},
],
tab=gui.Tab.PARAMETERS,
)
enableFileSharing = HTML5RDPTransport.enableFileSharing
fileSharingRoot = gui.TextField(
label=_('File Sharing Root'),
order=32,
@ -165,49 +148,10 @@ class HTML5SSHTransport(transports.Transport):
tab=gui.Tab.PARAMETERS,
)
ticketValidity = gui.NumericField(
length=3,
label=_('Ticket Validity'),
defvalue='60',
order=90,
tooltip=_(
'Allowed time, in seconds, for HTML5 client to reload data from UDS Broker. The default value of 60 is recommended.'
),
required=True,
minValue=60,
tab=gui.Tab.ADVANCED,
)
forceNewWindow = gui.ChoiceField(
order=91,
label=_('Force new HTML Window'),
tooltip=_('Select windows behavior for new connections on HTML5'),
required=True,
values=[
gui.choiceItem(
gui.FALSE,
_('Open every connection on the same window, but keeps UDS window.'),
),
gui.choiceItem(gui.TRUE, _('Force every connection to be opened on a new window.')),
gui.choiceItem(
'overwrite',
_('Override UDS window and replace it with the connection.'),
),
],
defvalue=gui.FALSE,
tab=gui.Tab.ADVANCED,
)
customGEPath = gui.TextField(
label=_('Glyptodon Enterprise context path'),
order=94,
tooltip=_(
'Customized path for Glyptodon Enterprise tunnel. (Only valid for Glyptodon Enterprise Tunnel)'
),
defvalue='/',
length=128,
required=False,
tab=gui.Tab.ADVANCED,
)
ticketValidity = fields.tunnelTicketValidityField()
forceNewWindow = HTML5RDPTransport.forceNewWindow
customGEPath = HTML5RDPTransport.customGEPath
def initialize(self, values: 'Module.ValuesType'):
if not values:
@ -291,6 +235,4 @@ class HTML5SSHTransport(transports.Transport):
path = path.rstrip('/')
tunnelServer = fields.getTunnelFromField(self.tunnel)
return str(
f'https://{tunnelServer.host}:{tunnelServer.port}{path}/#/?data={ticket}.{scrambler}{onw}'
)
return str(f'https://{tunnelServer.host}:{tunnelServer.port}{path}/#/?data={ticket}.{scrambler}{onw}')

View File

@ -41,6 +41,8 @@ from uds.core.managers.crypto import CryptoManager
from uds.core.ui import gui
from uds.core.util import fields, os_detector
from ..HTML5RDP.html5rdp import HTML5RDPTransport
# Not imported at runtime, just for type checking
if typing.TYPE_CHECKING:
from uds.core.module import Module
@ -71,14 +73,8 @@ class HTML5VNCTransport(transports.Transport):
tunnel = fields.tunnelField()
useGlyptodonTunnel = gui.CheckBoxField(
label=_('Use Glyptodon Enterprise tunnel'),
order=2,
tooltip=_(
'If checked, UDS will use Glyptodon Enterprise Tunnel for HTML tunneling instead of UDS Tunnel'
),
tab=gui.Tab.TUNNEL,
)
useGlyptodonTunnel = HTML5RDPTransport.useGlyptodonTunnel
username = gui.TextField(
label=_('Username'),
order=20,
@ -120,9 +116,7 @@ class HTML5VNCTransport(transports.Transport):
swapRedBlue = gui.CheckBoxField(
label=_('Swap red/blue'),
order=27,
tooltip=_(
'Use this if your colours seems incorrect (blue appears red, ..) to swap them.'
),
tooltip=_('Use this if your colours seems incorrect (blue appears red, ..) to swap them.'),
tab=gui.Tab.PARAMETERS,
)
cursor = gui.CheckBoxField(
@ -138,50 +132,10 @@ class HTML5VNCTransport(transports.Transport):
tab=gui.Tab.PARAMETERS,
)
ticketValidity = gui.NumericField(
length=3,
label=_('Ticket Validity'),
defvalue='60',
order=90,
tooltip=_(
'Allowed time, in seconds, for HTML5 client to reload data from UDS Broker. The default value of 60 is recommended.'
),
required=True,
minValue=60,
tab=gui.Tab.ADVANCED,
)
forceNewWindow = gui.ChoiceField(
order=91,
label=_('Force new HTML Window'),
tooltip=_('Select windows behavior for new connections on HTML5'),
required=True,
values=[
gui.choiceItem(
gui.FALSE,
_('Open every connection on the same window, but keeps UDS window.'),
),
gui.choiceItem(
gui.TRUE, _('Force every connection to be opened on a new window.')
),
gui.choiceItem(
'overwrite',
_('Override UDS window and replace it with the connection.'),
),
],
defvalue=gui.FALSE,
tab=gui.Tab.ADVANCED,
)
customGEPath = gui.TextField(
label=_('Glyptodon Enterprise context path'),
order=94,
tooltip=_(
'Customized path for Glyptodon Enterprise tunnel. (Only valid for Glyptodon Enterprise Tunnel)'
),
defvalue='/',
length=128,
required=False,
tab=gui.Tab.ADVANCED,
)
ticketValidity = fields.tunnelTicketValidityField()
forceNewWindow = HTML5RDPTransport.forceNewWindow
customGEPath = HTML5RDPTransport.customGEPath
def initialize(self, values: 'Module.ValuesType'):
if not values:
@ -254,6 +208,4 @@ class HTML5VNCTransport(transports.Transport):
path = path.rstrip('/')
tunnelServer = fields.getTunnelFromField(self.tunnel)
return str(
f'https://{tunnelServer.host}:{tunnelServer.port}{path}/#/?data={ticket}.{scrambler}{onw}'
)
return str(f'https://{tunnelServer.host}:{tunnelServer.port}{path}/#/?data={ticket}.{scrambler}{onw}')

View File

@ -67,28 +67,9 @@ class TRDPTransport(BaseRDPTransport):
typeDescription = _('RDP Protocol. Tunneled connection.')
group = transports.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.Tab.TUNNEL,
)
tunnel = fields.tunnelField()
tunnelWait = gui.NumericField(
length=3,
label=_('Tunnel wait time'),
defvalue='60',
minValue=5,
maxValue=65536,
order=2,
tooltip=_('Maximum time to wait before closing the tunnel listener'),
required=True,
tab=gui.Tab.TUNNEL,
)
tunnelWait = fields.tunnelTunnelWait()
verifyCertificate = gui.CheckBoxField(
label=_('Force SSL certificate verification'),
@ -132,7 +113,7 @@ class TRDPTransport(BaseRDPTransport):
customParameters = BaseRDPTransport.customParameters
customParametersMAC = BaseRDPTransport.customParametersMAC
customParametersWindows = BaseRDPTransport.customParametersWindows
optimizeTeams = BaseRDPTransport.optimizeTeams
# optimizeTeams = BaseRDPTransport.optimizeTeams
def initialize(self, values: 'Module.ValuesType'):
if values:

View File

@ -32,22 +32,22 @@
import logging
import typing
from django.utils.translation import gettext_noop as _
from uds.core import exceptions, transports
from uds.core.ui import gui
from uds.core import transports, exceptions
from uds.core.util import validators
from uds.core.util import fields, validators
from uds.models import TicketStore
from .spice_base import BaseSpiceTransport
from .remote_viewer_file import RemoteViewerFile
from .spice_base import BaseSpiceTransport
# Not imported at runtime, just for type checking
if typing.TYPE_CHECKING:
from uds import models
from uds.core.module import Module
from uds.core.util.request import ExtendedHttpRequestWithUser
from uds.core.util import os_detector
from uds.core.util.request import ExtendedHttpRequestWithUser
logger = logging.getLogger(__name__)
@ -65,26 +65,8 @@ class TSPICETransport(BaseSpiceTransport):
protocol = transports.protocols.SPICE
group: typing.ClassVar[str] = transports.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.Tab.TUNNEL,
)
tunnelWait = gui.NumericField(
length=3,
label=_('Tunnel wait time'),
defvalue='30',
minValue=5,
maxValue=65536,
order=2,
tooltip=_('Maximum time to wait before closing the tunnel listener'),
required=True,
tab=gui.Tab.TUNNEL,
)
tunnel = fields.tunnelField()
tunnelWait = fields.tunnelTunnelWait()
verifyCertificate = gui.CheckBoxField(
label=_('Force SSL certificate verification'),
@ -129,7 +111,8 @@ class TSPICETransport(BaseSpiceTransport):
_('No console connection data received'),
)
tunHost, tunPort = self.tunnelServer.value.split(':')
tunnelFields = fields.getTunnelFromField(self.tunnel)
tunHost, tunPort = tunnelFields.host, tunnelFields.port
# We MAY need two tickets, one for 'insecure' port an one for secure
ticket = ''

View File

@ -39,10 +39,10 @@ import paramiko
from django.utils.translation import gettext_noop as _, gettext_lazy
from uds.core.managers.user_service import UserServiceManager
from uds.core.managers.user_preferences import CommonPrefs
from uds.core.types.preferences import CommonPrefs
from uds.core.ui import gui
from uds.core import transports, types
from uds.core.util import os_detector as OsDetector
from uds.core.util import os_detector
from uds.core.util import connection
# Not imported at runtime, just for type checking
@ -65,7 +65,7 @@ class BaseX2GOTransport(transports.Transport):
iconFile = 'x2go.png'
protocol = transports.protocols.X2GO
supportedOss = (OsDetector.KnownOS.LINUX, OsDetector.KnownOS.WINDOWS)
supportedOss = (os_detector.KnownOS.LINUX, os_detector.KnownOS.WINDOWS)
fixedName = gui.TextField(
order=2,

View File

@ -33,20 +33,21 @@ import logging
import typing
from django.utils.translation import gettext_noop as _
from uds.core.ui import gui
from uds.core.util import os_detector as OsDetector
from uds.core.util import tools, validators
from uds.core import transports
from uds.core.ui import gui
from uds.core.util import fields, validators
from uds.models import TicketStore
from .x2go_base import BaseX2GOTransport
from . import x2go_file
from .x2go_base import BaseX2GOTransport
# Not imported at runtime, just for type checking
if typing.TYPE_CHECKING:
from uds import models
from uds.core.module import Module
from uds.core.util.request import ExtendedHttpRequestWithUser
from uds.core.util.os_detector import DetectedOsInfo
from uds.core.util.request import ExtendedHttpRequestWithUser
logger = logging.getLogger(__name__)
@ -57,6 +58,7 @@ class TX2GOTransport(BaseX2GOTransport):
Provides access via X2GO to service.
This transport can use an domain. If username processed by authenticator contains '@', it will split it and left-@-part will be username, and right password
"""
isBase = False
iconFile = 'x2go-tunnel.png'
@ -65,33 +67,13 @@ class TX2GOTransport(BaseX2GOTransport):
typeDescription = _('X2Go access (Experimental). Tunneled connection.')
group = transports.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.Tab.TUNNEL,
)
tunnelWait = gui.NumericField(
length=3,
label=_('Tunnel wait time'),
defvalue='30',
minValue=5,
maxValue=65536,
order=2,
tooltip=_('Maximum time to wait before closing the tunnel listener'),
required=True,
tab=gui.Tab.TUNNEL,
)
tunnel = fields.tunnelField()
tunnelWait = fields.tunnelTunnelWait()
verifyCertificate = gui.CheckBoxField(
label=_('Force SSL certificate verification'),
order=23,
tooltip=_(
'If enabled, the certificate of tunnel server will be verified (recommended).'
),
tooltip=_('If enabled, the certificate of tunnel server will be verified (recommended).'),
defvalue=gui.FALSE,
tab=gui.Tab.TUNNEL,
)
@ -123,7 +105,6 @@ class TX2GOTransport(BaseX2GOTransport):
password: str,
request: 'ExtendedHttpRequestWithUser',
) -> 'transports.TransportScript':
ci = self.getConnectionInfo(userService, user, password)
priv, pub = self.getAndPushKey(ci.username, userService)
@ -156,7 +137,8 @@ class TX2GOTransport(BaseX2GOTransport):
validity=self.tunnelWait.num() + 60, # Ticket overtime
)
tunHost, tunPort = self.tunnelServer.value.split(':')
tunnelFields = fields.getTunnelFromField(self.tunnel)
tunHost, tunPort = tunnelFields.host, tunnelFields.port
sp = {
'tunHost': tunHost,
@ -171,6 +153,4 @@ class TX2GOTransport(BaseX2GOTransport):
try:
return self.getScript(os.os.os_name(), 'tunnel', sp)
except Exception:
return super().getUDSTransportScript(
userService, transport, ip, os, user, password, request
)
return super().getUDSTransportScript(userService, transport, ip, os, user, password, request)