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
* Updated release

View File

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

View File

@ -49,7 +49,8 @@ import six
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):
pass
@ -269,7 +270,6 @@ def approveHost(host, parentWindow=None):
settings.endGroup()
return approved
if __name__ == "__main__":
logger.debug('Initializing connector')
# Initialize app

View File

@ -74,14 +74,13 @@ def approveHost(host):
except Exception:
logger.warn('Got exception writing to {}'.format(hostsFile))
return approved
def getWithRetry(rest, url):
def getWithRetry(rest, url, params=None):
while True:
try:
res = rest.get(url)
res = rest.get(url, params)
return res
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:
@ -125,16 +124,38 @@ if __name__ == "__main__":
try:
res = getWithRetry(rest, '')
logger.debug('Got information {}'.format(res))
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'])
sys.exit(1)
# Now get ticket
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:
error = 'ERROR: {}'.format(e)
logger.error(error)
ui.message('Error', error)
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 six
import urllib
import osDetector
from .log import logger
@ -55,16 +55,17 @@ class RestRequest(object):
self.host = host
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):
url = self.restApiUrl + url
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))
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:
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:
import gtkui as theUI
except Exception:
import consoleui as theUI
import consoleui as theUI # @Reimport
def message(title, message):
theUI.message(title, message)

View File

@ -31,11 +31,19 @@
'''
from __future__ import unicode_literals
import sys
import time
from uds.log import logger
counter = 0
def message(title, message):
sys.stderr.write("** {} **\n {}\n".format(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

View File

@ -1,10 +1,11 @@
Steps:
1.- Copy the folder "udsclient" to /build/packages inside the thinstation build environment
2.- enter the chroot of thinstation
3.- go to the udsclient folder (/build/packages/udsclient)
4.- Execute "build.sh"
5.- Edit the file /build/build.conf, and add this line:
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.- Copy the folder "udsclient" to /build/packages inside the thinstation build environment
3.- enter the chroot of thinstation
4.- go to the udsclient folder (/build/packages/udsclient)
5.- Execute "build.sh"
6.- Edit the file /build/build.conf, and add this line:
package udsclient
6.- Execute the build process
7.- Execute the build process
Ready!!!

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Virtual Cable S.L.
# Copyright (c) 2016 Virtual Cable S.L.
# All rights reserved.
#
# 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
'''
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
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)
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)
# 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,
label=_('Layout'),
tooltip=_('Keyboards Layout of server'),
@ -188,8 +188,8 @@ class HTML5RDPTransport(Transport):
'create-drive-path': 'true'
}
# if self.enableFileSharing.isTrue():
# params['enable-drive'] = 'true'
if self.enableFileSharing.isTrue():
params['enable-drive'] = 'true'
if self.serverLayout.value != '-':
params['server-layout'] = self.serverLayout.value

View File

@ -40,7 +40,7 @@ from uds.core.util import OsDetector
import six
import os
__updated__ = '2017-07-06'
__updated__ = '2017-07-26'
class RDPFile(object):
@ -95,7 +95,7 @@ class RDPFile(object):
Parameters for xfreerdp >= 1.1.0 with self rdp description
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, ''):
params.append('/smartcard:{}'.format(self.smartcardString))

View File

@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
READY_CACHE_TIMEOUT = 30
__updated__ = '2017-06-05'
__updated__ = '2017-08-02'
class RDPTransport(BaseRDPTransport):
@ -134,10 +134,11 @@ class RDPTransport(BaseRDPTransport):
OsDetector.Linux: 'linux',
OsDetector.Macintosh: 'macosx'
}.get(os['OS'])
}.get(m.os)
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 = {
'password': password,

View File

@ -11,9 +11,12 @@ from uds import tools # @UnresolvedImport
import six
theFile = '''{m.r.as_file}'''
# 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'
cord = "/Applications/CoRD.app/Contents/MacOS/CoRD"