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

Merge remote-tracking branch 'origin/v2.1'

This commit is contained in:
Adolfo Gómez García 2017-06-06 13:09:46 +02:00
commit ca877e513f
14 changed files with 87 additions and 14 deletions

View File

@ -40,6 +40,7 @@ import win32event # @UnresolvedImport, pylint: disable=import-error
import win32com.client # @UnresolvedImport, @UnusedImport, pylint: disable=import-error
import pythoncom # @UnresolvedImport, pylint: disable=import-error
import servicemanager # @UnresolvedImport, pylint: disable=import-error
import subprocess
import os
from udsactor import operations
@ -56,6 +57,8 @@ from .SENS import SENSGUID_PUBLISHER
from .SENS import PROGID_EventSubscription
from .SENS import PROGID_EventSystem
POST_CMD = 'c:\\windows\post-uds.bat'
class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService):
'''
@ -296,6 +299,17 @@ class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService):
logger.debug('Registered SENS, running main loop')
# Execute script in c:\\windows\\post-uds.bat after interacting with broker, if no reboot is requested ofc
# This will be executed only when machine gets "ready"
try:
if os.path.isfile(POST_CMD):
subprocess.call([POST_CMD, ])
else:
logger.info('POST file not found & not executed')
except Exception as e:
# Ignore output of execution command
logger.error('Executing post command give')
# *********************
# * Main Service loop *
# *********************

View File

@ -117,7 +117,7 @@ if __name__ == "__main__":
ui.message('UDS Client', 'UDS Client Version {}'.format(VERSION))
sys.exit(1)
rest = RestRequest('{}://{}/rest/client'.format(['http', 'https'][ssl], host))
rest = RestRequest(host, ssl)
logger.debug('Setting request URL to {}'.format(rest.restApiUrl))
# Main requests part

View File

@ -50,9 +50,12 @@ class RestRequest(object):
restApiUrl = ''
def __init__(self, restURL): # parent not used
def __init__(self, host, ssl=True): # parent not used
super(RestRequest, self).__init__()
self.restApiUrl = restURL
self.host = host
self.ssl = ssl
self.restApiUrl = RestRequest('{}://{}/rest/client'.format(['http', 'https'][ssl], host))
def get(self, url, params=None):
url = self.restApiUrl + url

View File

@ -0,0 +1,4 @@
#!/bin/sh
cd /lib/UDSClient
exec python UDSClient.pyc $@

View File

@ -1,2 +1,2 @@
lib
src

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=UDSClient
Comment=UDS Helper
Keywords=uds;client;vdi;
Exec=/bin/udsclient %u
Icon=help-browser
StartupNotify=true
Terminal=false
Type=Application
Categories=Utility;
MimeType=x-scheme-handler/uds;x-scheme-handler/udss;

View File

@ -0,0 +1,4 @@
#!/bin/sh
cd /lib/UDSClient
exec python UDSClient.pyc $@

View File

@ -1,5 +1,13 @@
#!/bin/bash
#!/bin/sh
pip install paramiko requests six
rm -rf lib
mkdir -p lib/python2.7/site-packages
for a in requests paramiko pyasn1 cryptography packaging idna asn1crypto six enum ipaddress cffi ; do cp -r /usr/lib/python2.7/site-packages/$a* lib/python2.7/site-packages/; done
cp src/udsclient bin
chmod 755 bin/udsclient
mkdir lib/UDSClient
cp src/UDSClient.py lib/UDSClient
chmod 755 lib/UDSClient/UDSClient.py
cp -r src/uds lib/UDSClient
mkdir lib/applications
cp UDSClient.desktop lib/applications

View File

@ -76,9 +76,10 @@ class HTML5RDPTransport(Transport):
wallpaper = gui.CheckBoxField(label=_('Show wallpaper'), order=20, tooltip=_('If checked, the wallpaper and themes will be shown on machine (better user experience, more bandwidth)'), tab=gui.PARAMETERS_TAB)
desktopComp = gui.CheckBoxField(label=_('Allow Desk.Comp.'), order=22, tooltip=_('If checked, desktop composition will be allowed'), tab=gui.PARAMETERS_TAB)
smooth = gui.CheckBoxField(label=_('Font Smoothing'), order=23, tooltip=_('If checked, fonts smoothing will be allowed (windows clients only)'), tab=gui.PARAMETERS_TAB)
enableAudio = gui.CheckBoxField(label=_('Enable Audio'), order=7, tooltip=_('If checked, the audio will be redirected to client (if client browser supports it)'), tab=gui.PARAMETERS_TAB)
enablePrinting = gui.CheckBoxField(label=_('Enable Printing'), order=8, tooltip=_('If checked, the printing will be redirected to client (if client browser supports it)'), tab=gui.PARAMETERS_TAB)
serverLayout = gui.ChoiceField(order=9,
enableAudio = gui.CheckBoxField(label=_('Enable Audio'), order=24, tooltip=_('If checked, the audio will be redirected to client (if client browser supports it)'), tab=gui.PARAMETERS_TAB)
enablePrinting = gui.CheckBoxField(label=_('Enable Printing'), order=25, tooltip=_('If checked, the printing will be redirected to client (if client browser supports it)'), tab=gui.PARAMETERS_TAB)
# enableFileShare = gui.CheckBoxField(label=_('Enable File Sharing'), order=8, tooltip=_('If checked, the user will be able to upload/download files (if client browser supports it)'), tab=gui.PARAMETERS_TAB)
serverLayout = gui.ChoiceField(order=26,
label=_('Layout'),
tooltip=_('Keyboards Layout of server'),
required=True,
@ -93,6 +94,19 @@ class HTML5RDPTransport(Transport):
defvalue='-',
tab=gui.PARAMETERS_TAB
)
security = gui.ChoiceField(order=27,
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('rdp', _('RDP (Standard RDP encryption. Should be supported by all servers)')),
gui.choiceItem('nla', _('NLA (Network Layer authentication. Requires VALID username&password, or connection will fail)')),
gui.choiceItem('tls', _('TLS (Transport Security Layer encryption)')),
],
defvalue='any',
tab=gui.PARAMETERS_TAB
)
def initialize(self, values):
@ -168,9 +182,15 @@ class HTML5RDPTransport(Transport):
'hostname': ip,
'username': username,
'password': password,
'ignore-cert': 'true'
'ignore-cert': 'true',
'security': self.security.value,
'drive-path': '/share/{}'.format(user.uuid),
'create-drive-path': 'true'
}
# if self.enableFileSharing.isTrue():
# params['enable-drive'] = self.serverLayout.value
if self.serverLayout.value != '-':
params['server-layout'] = self.serverLayout.value

View File

@ -40,7 +40,7 @@ from uds.core.transports import protocols
import logging
import os
__updated__ = '2017-03-31'
__updated__ = '2017-06-05'
logger = logging.getLogger(__name__)
@ -74,6 +74,7 @@ class BaseRDPTransport(Transport):
alsa = gui.CheckBoxField(label=_('Use Alsa'), order=26, tooltip=_('If checked, Linux client will try to use ALSA, otherwise Pulse will be used'), tab='Linux Client')
printerString = gui.TextField(label=_('Printer string'), order=27, tooltip=_('If printer is checked, the printer string used with xfreerdp client'), tab='Linux Client')
smartcardString = gui.TextField(label=_('Smartcard string'), order=28, tooltip=_('If smartcard is checked, the smartcard string used with xfreerdp client'), tab='Linux Client')
customParameters = gui.TextField(label=_('Custom parameters'), order=29, tooltip=_('If not empty, extra parameter to include for Linux Client (for example /usb:id,dev:054c:0268, or aything compatible with your xfreerdp client)'), tab='Linux Client')
def isAvailableFor(self, userService, ip):
'''

View File

@ -40,7 +40,7 @@ from uds.core.util import OsDetector
import six
import os
__updated__ = '2017-03-20'
__updated__ = '2017-06-05'
class RDPFile(object):
@ -68,6 +68,7 @@ class RDPFile(object):
printerString = None
smartcardString = None
enablecredsspsupport = False
linuxCustomParameters = None
def __init__(self, fullScreen, width, height, bpp, target=OsDetector.Windows):
self.width = six.text_type(width)
@ -145,6 +146,9 @@ class RDPFile(object):
if self.domain != '':
params.append('/d:{}'.format(self.domain))
if self.linuxCustomParameters is not None and self.linuxCustomParameters.strip() != '':
params.append(self.linuxCustomParameters.strip())
return params
@property

View File

@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
READY_CACHE_TIMEOUT = 30
__updated__ = '2017-03-20'
__updated__ = '2017-06-05'
class RDPTransport(BaseRDPTransport):
@ -74,6 +74,7 @@ class RDPTransport(BaseRDPTransport):
alsa = BaseRDPTransport.alsa
printerString = BaseRDPTransport.printerString
smartcardString = BaseRDPTransport.smartcardString
customParameters = BaseRDPTransport.customParameters
def getUDSTransportScript(self, userService, transport, ip, os, user, password, request):
# We use helper to keep this clean
@ -103,6 +104,7 @@ class RDPTransport(BaseRDPTransport):
r.alsa = self.alsa.isTrue()
r.smartcardString = self.smartcardString.value
r.printerString = self.printerString.value
r.linuxCustomParameters = self.customParameters.value
# data
# data = {

View File

@ -48,7 +48,7 @@ import logging
import random
import string
__updated__ = '2017-03-20'
__updated__ = '2017-06-05'
logger = logging.getLogger(__name__)
@ -92,6 +92,7 @@ class TRDPTransport(BaseRDPTransport):
alsa = BaseRDPTransport.alsa
printerString = BaseRDPTransport.printerString
smartcardString = BaseRDPTransport.smartcardString
customParameters = BaseRDPTransport.customParameters
def initialize(self, values):
if values is not None:
@ -133,6 +134,7 @@ class TRDPTransport(BaseRDPTransport):
r.alsa = self.alsa.isTrue()
r.smartcardString = self.smartcardString.value
r.printerString = self.printerString.value
r.linuxCustomParameters = self.customParameters.value
# data
# data = {