1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Merged & fixed 2.2 changes

This commit is contained in:
Adolfo Gómez García 2017-08-02 16:29:47 +02:00
commit b5887ad1df
13 changed files with 72 additions and 30 deletions

View File

@ -1,3 +1,9 @@
udsclient (2.2.0) stable; urgency=medium
* Updated release
-- Adolfo Gómez García <agomez@virtualcable.es> Thu, 27 Aug 2017 14:18:18 +0200
udsclient (2.1.0) stable; urgency=medium udsclient (2.1.0) stable; urgency=medium
* Updated release * Updated release

View File

@ -1,2 +1,2 @@
udsclient_2.1.0_all.deb admin optional udsclient_2.2.0_all.deb admin optional
udsclient_2.1.0_amd64.buildinfo admin optional udsclient_2.2.0_amd64.buildinfo admin optional

View File

@ -49,7 +49,8 @@ import six
from UDSWindow import Ui_MainWindow from UDSWindow import Ui_MainWindow
OLD_METHOD_VERSION = '2.1.0' # Server before this version uses "unsigned" scripts
OLD_METHOD_VERSION = '2.4.0'
class RetryException(Exception): class RetryException(Exception):
pass pass
@ -269,7 +270,6 @@ def approveHost(host, parentWindow=None):
settings.endGroup() settings.endGroup()
return approved return approved
if __name__ == "__main__": if __name__ == "__main__":
logger.debug('Initializing connector') logger.debug('Initializing connector')
# Initialize app # Initialize app

View File

@ -74,14 +74,13 @@ def approveHost(host):
except Exception: except Exception:
logger.warn('Got exception writing to {}'.format(hostsFile)) logger.warn('Got exception writing to {}'.format(hostsFile))
return approved return approved
def getWithRetry(rest, url): def getWithRetry(rest, url, params=None):
while True: while True:
try: try:
res = rest.get(url) res = rest.get(url, params)
return res return res
except RetryException as e: except RetryException as e:
if ui.question('Service not available', '{}\nPlease, wait a minute and press "OK" to retry, or CANCEL to abort') is True: if ui.question('Service not available', '{}\nPlease, wait a minute and press "OK" to retry, or CANCEL to abort') is True:
@ -125,16 +124,38 @@ if __name__ == "__main__":
try: try:
res = getWithRetry(rest, '') res = getWithRetry(rest, '')
logger.debug('Got information {}'.format(res))
if res['requiredVersion'] > VERSION: if res['requiredVersion'] > VERSION:
ui.message("New UDS Client available", "A new uds version is needed in order to access this version of UDS. A browser will be openend for this download.") ui.message("New UDS Client available", "A new uds version is needed in order to access this version of UDS. A browser will be opened for this download.")
webbrowser.open(res['downloadUrl']) webbrowser.open(res['downloadUrl'])
sys.exit(1) sys.exit(1)
# Now get ticket
res = getWithRetry(rest, '/{}/{}'.format(ticket, scrambler), params={'hostname': tools.getHostName(), 'version': VERSION}) res = getWithRetry(rest, '/{}/{}'.format(ticket, scrambler), params={'hostname': tools.getHostName(), 'version': VERSION})
script = res.decode('base64').decode('bz2')
logger.debug('Script: {}'.format(script))
six.exec_(script, globals(), {'parent': None})
except Exception as e: except Exception as e:
error = 'ERROR: {}'.format(e) error = 'ERROR: {}'.format(e)
logger.error(error) logger.error(error)
ui.message('Error', error) ui.message('Error', error)
sys.exit(2) sys.exit(2)
# Finalize
try:
tools.waitForTasks()
except Exception:
pass
try:
tools.unlinkFiles()
except Exception:
pass
try:
tools.execBeforeExit()
except Exception:
pass

View File

@ -37,7 +37,7 @@ from . import VERSION
import json import json
import six import six
import urllib import osDetector
from .log import logger from .log import logger
@ -55,16 +55,17 @@ class RestRequest(object):
self.host = host self.host = host
self.ssl = ssl self.ssl = ssl
self.restApiUrl = RestRequest('{}://{}/rest/client'.format(['http', 'https'][ssl], host)) self.restApiUrl = '{}://{}/rest/client'.format(['http', 'https'][ssl], host)
def get(self, url, params=None): def get(self, url, params=None):
url = self.restApiUrl + url url = self.restApiUrl + url
if params is not None: if params is not None:
url += '?' + '&'.join('{}={}'.format(k, urllib.quote(six.text_type(v).encode('utf8'))) for k, v in params.iteritems()) url += '?' + '&'.join('{}={}'.format(k, six.moves.urllib.parse.quote(six.text_type(v).encode('utf8'))) for k, v in params.iteritems()) # @UndefinedVariable
logger.debug('Requesting {}'.format(url)) logger.debug('Requesting {}'.format(url))
try: try:
r = requests.get(url, headers={'Content-type': 'application/json'}) r = requests.get(url, headers={'Content-type': 'application/json', 'User-Agent': osDetector.getOs() + " - UDS Connector " + VERSION })
except requests.exceptions.ConnectionError as e: except requests.exceptions.ConnectionError as e:
raise Exception('Error connecting to UDS Server at {}'.format(self.restApiUrl[0:-11])) raise Exception('Error connecting to UDS Server at {}'.format(self.restApiUrl[0:-11]))

View File

@ -34,7 +34,7 @@ from __future__ import unicode_literals
try: try:
import gtkui as theUI import gtkui as theUI
except Exception: except Exception:
import consoleui as theUI import consoleui as theUI # @Reimport
def message(title, message): def message(title, message):
theUI.message(title, message) theUI.message(title, message)

View File

@ -31,11 +31,19 @@
''' '''
from __future__ import unicode_literals from __future__ import unicode_literals
import sys import sys
import time
from uds.log import logger from uds.log import logger
counter = 0
def message(title, message): def message(title, message):
sys.stderr.write("** {} **\n {}\n".format(title, message)) sys.stderr.write("** {} **\n {}\n".format(title, message))
def question(title, message): def question(title, message):
sys.stderr.write("** {} **\n{}\nReturned YES\n".format(title, message)) global counter
if counter > 100: # 5 minutes
return False
counter += 1
sys.stderr.write("** {} **\n{}\nReturning YES in 3 seconds. (counter is {})\n".format(title, message, counter))
time.sleep(3) # Wait 3 seconds before returning
return True return True

View File

@ -1,10 +1,11 @@
Steps: Steps:
1.- Copy the folder "udsclient" to /build/packages inside the thinstation build environment 1.- If building from repository, full copy (recursive) the "src" folder of "udsclient/thin" inside the "udsclient" folder. If building from the .tar.gz, simply ignor4e this step
2.- enter the chroot of thinstation 2.- Copy the folder "udsclient" to /build/packages inside the thinstation build environment
3.- go to the udsclient folder (/build/packages/udsclient) 3.- enter the chroot of thinstation
4.- Execute "build.sh" 4.- go to the udsclient folder (/build/packages/udsclient)
5.- Edit the file /build/build.conf, and add this line: 5.- Execute "build.sh"
6.- Edit the file /build/build.conf, and add this line:
package udsclient package udsclient
6.- Execute the build process 7.- Execute the build process
Ready!!! Ready!!!

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (c) 2012 Virtual Cable S.L. # Copyright (c) 2016 Virtual Cable S.L.
# All rights reserved. # 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,
@ -30,6 +30,7 @@
''' '''
@author: Adolfo Gómez, dkmaster at dkmon dot com @author: Adolfo Gómez, dkmaster at dkmon dot com
''' '''
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from uds.core import services from uds.core import services

View File

@ -78,7 +78,7 @@ class HTML5RDPTransport(Transport):
smooth = gui.CheckBoxField(label=_('Font Smoothing'), order=23, tooltip=_('If checked, fonts smoothing will be allowed (windows clients only)'), 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=24, tooltip=_('If checked, the audio will be redirected to client (if client browser supports it)'), tab=gui.PARAMETERS_TAB) 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) 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)
# enableFileSharing = 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) enableFileSharing = 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, serverLayout = gui.ChoiceField(order=26,
label=_('Layout'), label=_('Layout'),
tooltip=_('Keyboards Layout of server'), tooltip=_('Keyboards Layout of server'),
@ -188,8 +188,8 @@ class HTML5RDPTransport(Transport):
'create-drive-path': 'true' 'create-drive-path': 'true'
} }
# if self.enableFileSharing.isTrue(): if self.enableFileSharing.isTrue():
# params['enable-drive'] = 'true' params['enable-drive'] = 'true'
if self.serverLayout.value != '-': if self.serverLayout.value != '-':
params['server-layout'] = self.serverLayout.value params['server-layout'] = self.serverLayout.value

View File

@ -40,7 +40,7 @@ from uds.core.util import OsDetector
import six import six
import os import os
__updated__ = '2017-07-06' __updated__ = '2017-07-26'
class RDPFile(object): class RDPFile(object):
@ -95,7 +95,7 @@ class RDPFile(object):
Parameters for xfreerdp >= 1.1.0 with self rdp description Parameters for xfreerdp >= 1.1.0 with self rdp description
Note that server is not added Note that server is not added
''' '''
params = ['/clipboard', '/t:UDS-Connection', '/cert-ignore', '/sec:rdp'] params = ['/clipboard', '/t:UDS-Connection', '/cert-ignore'] # , '/sec:rdp']
if self.redirectSmartcards and self.smartcardString not in (None, ''): if self.redirectSmartcards and self.smartcardString not in (None, ''):
params.append('/smartcard:{}'.format(self.smartcardString)) params.append('/smartcard:{}'.format(self.smartcardString))

View File

@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
READY_CACHE_TIMEOUT = 30 READY_CACHE_TIMEOUT = 30
__updated__ = '2017-06-05' __updated__ = '2017-08-02'
class RDPTransport(BaseRDPTransport): class RDPTransport(BaseRDPTransport):
@ -134,10 +134,11 @@ class RDPTransport(BaseRDPTransport):
OsDetector.Linux: 'linux', OsDetector.Linux: 'linux',
OsDetector.Macintosh: 'macosx' OsDetector.Macintosh: 'macosx'
}.get(os['OS']) }.get(m.os)
if os is None: if os is None:
return super(self.__class__, self).getUDSTransportScript(userService, transport, ip, os, user, password, request) logger.ERROR('Os not detected for RDP Transport: {}'.format(request.META.get('HTTP_USER_AGENT', 'Unknown')))
return super(RDPTransport, self).getUDSTransportScript(userService, transport, ip, os, user, password, request)
sp = { sp = {
'password': password, 'password': password,

View File

@ -11,9 +11,12 @@ from uds import tools # @UnresolvedImport
import six import six
theFile = '''{m.r.as_file}'''
# First, try to locate Remote Desktop Connection (version 2, from Microsoft website, not the app store one) # First, try to locate Remote Desktop Connection (version 2, from Microsoft website, not the app store one)
filename = tools.saveTempFile(theFile)
msrdc = '/Applications/Remote Desktop Connection.app/Contents/MacOS/Remote Desktop Connection' msrdc = '/Applications/Remote Desktop Connection.app/Contents/MacOS/Remote Desktop Connection'
cord = "/Applications/CoRD.app/Contents/MacOS/CoRD" cord = "/Applications/CoRD.app/Contents/MacOS/CoRD"