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

some cleanups

This commit is contained in:
Adolfo Gómez García 2015-04-23 06:32:03 +02:00
parent e651d3348d
commit ef302205bc
12 changed files with 18 additions and 321 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
VERSION=1.7.0
VERSION=1.7.5
RELEASE=1
top=`pwd`
@ -11,6 +11,7 @@ cat udsactor-template.spec |
# Now fix dependencies for opensuse
cat udsactor-template.spec |
sed -e s/"version 1.7.0"/"version ${VERSION}"/g |
sed -e s/"name udsactor"/"name udsactor-opensuse"/g |
sed -e s/"PyQt4"/"python-qt4"/g |
sed -e s/"libXScrnSaver"/"libXss1"/g > udsactor-opensuse-$VERSION.spec
@ -27,4 +28,4 @@ for pkg in udsactor-$VERSION.spec udsactor-opensuse-$VERSION.spec; do
rpmbuild -v -bb --clean --buildroot=$top/rpm/BUILD/$pkg-root --target noarch $pkg 2>&1
done
#rm udsactor-$VERSION
#rm udsactor-$VERSION

View File

@ -1,3 +1,9 @@
udsactor (1.7.5) stable; urgency=medium
* Upgrade for 1.7.5
-- Adolfo Gómez García <agomez@virtualcable.es> Thu, 23 Apr 2015 06:08:53 +0200
udsactor (1.7.0) stable; urgency=medium
* Initial release.

View File

@ -1,3 +1,3 @@
udsactor_1.7.0_all.deb admin optional
udsactor-xrdp_1.7.0_all.deb x11 optional
udsactor-nx_1.7.0_all.deb x11 optional
udsactor_1.7.5_all.deb admin optional
udsactor-xrdp_1.7.5_all.deb x11 optional
udsactor-nx_1.7.5_all.deb x11 optional

View File

@ -14,12 +14,13 @@ cat udsclient-template.spec |
# Now fix dependencies for opensuse
cat udsclient-template.spec |
sed -e s/"version 1.7.0"/"version ${VERSION}"/g |
sed -e s/"name udsclient"/"name udsclient-opensuse"/g |
sed -e s/"PyQt4"/"python-qt4"/g |
sed -e s/"libXScrnSaver"/"libXss1"/g > udsclient-opensuse-$VERSION.spec
# Right now, udsactor-xrdp-1.7.0.spec is not needed
# Right now, udsactor-xrdp-.spec is not needed
for pkg in udsclient-$VERSION.spec udsclient-opensuse-$VERSION.spec; do
rm -rf rpm

View File

@ -1,3 +1,4 @@
/log/
/static/
.coverage
/uds/static/clients/

View File

@ -86,9 +86,9 @@ class Connection(Handler):
# Skip maintenance services...
trans = []
for t in svr.transports.all().order_by('priority'):
typeTrans = t.getType()
if t.validForIp(self._request.ip) and t.getType().providesConnetionInfo():
trans.append({'id': t.uuid, 'name': t.name, 'needsJava': t.getType().needsJava})
trans.append({'id': t.uuid, 'name': t.name})
services.append({'id': 'A' + svr.uuid,
'name': svr['name'],
'transports': trans,
@ -102,8 +102,7 @@ class Connection(Handler):
trans = []
for t in svr.transports.all().order_by('priority'):
if t.validForIp(self._request.ip) and t.getType().providesConnetionInfo():
typeTrans = t.getType()
trans.append({'id': t.uuid, 'name': t.name, 'needsJava': typeTrans.needsJava})
trans.append({'id': t.uuid, 'name': t.name})
# Locate if user service has any already assigned user service for this
ads = UserServiceManager.manager().getExistingAssignationForUser(svr, self._user)

View File

@ -1,2 +0,0 @@
UDSClient.dmg
UDSClientSetup.exe

View File

@ -1,100 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Virtual Cable S.L.
# 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. 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
'''
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from uds.core.util import OsDetector
from uds.core.util.Config import Config
import logging, os, sys
logger = logging.getLogger(__name__)
def simpleScrambler(data):
'''
Simple scrambler so password are not seen at source page
'''
res = []
n = ord('M')
pos = 0
for c in data:
res.append(chr(ord(c) ^ n))
n = n ^ pos
pos = pos + 1
return "".join(res).encode('hex')
def generateHtmlForNX(transport, idUserService, idTransport, ip, os, user, password, extra):
isMac = os['OS'] == OsDetector.Macintosh
applet = reverse('uds.web.views.transcomp', kwargs={ 'idTransport' : idTransport, 'componentId' : '1' })
# Gets the codebase, simply remove last char from applet
codebase = applet[:-1]
# We generate the "data" parameter
data = simpleScrambler('\t'.join([
'user:' + user,
'pass:' + password,
'ip:' + ip,
'port:' + extra['port'],
'session:' + extra['session'],
'connection:' + extra['connection'],
'cacheDisk:' + extra['cacheDisk'],
'cacheMem:' + extra['cacheMem'],
'width:' + str(extra['width']),
'height:' + str(extra['height']),
'is:' + idUserService
]
))
if isMac is True:
msg = '<p>' + _('In order to use this transport, you need to install first OpenNX Client for mac') + '</p>'
msg += '<p>' + _('You can oibtain it from ') + '<a href="{0}">'.format(Config.section('NX').value('downloadUrlMACOS').get()) + _('OpenNx Website') + '</a></p>'
else:
msg = '<p>' + _('In order to use this transport, you need to install first Nomachine Nx Client version 3.5.x') + '</p>'
msg += '<p>' + _('you can obtain it for your platform from') + '<a href="{0}">'.format(Config.section('NX').value('downloadUrl').get()) + _('nochamine web site') + '</a></p>'
res = '<div idTransport="applet"><applet code="NxTransportApplet.class" codebase="%s" archive="%s" width="140" height="22"><param name="data" value="%s"/><param name="permissions" value="all-permissions"/></applet></div>' % (codebase, '1', data)
res += '<div>' + msg + '</div>'
return res
def getHtmlComponent(module, componentId):
comps = {
'1': ['nxtransport.jar', 'application/java-archive']
}
if componentId not in comps:
return ['text/plain', 'no component']
fname = os.path.dirname(sys.modules[module].__file__) + '/applet/' + comps[componentId][0]
logger.debug('Loading component {0} from {1}'.format(componentId, fname))
with open(fname, 'rb') as f:
data = f.read()
return [comps[componentId][1], data]

View File

@ -1,164 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Virtual Cable S.L.
# 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. 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.
'''
Created on Jul 29, 2011
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''
from django.utils.translation import ugettext_noop as _
from uds.core.managers.UserPrefsManager import CommonPrefs
from uds.core.ui.UserInterface import gui
from uds.core.transports.BaseTransport import Transport
from uds.core.transports import protocols
from uds.core.util import connection
import logging
logger = logging.getLogger(__name__)
READY_CACHE_TIMEOUT = 30
class X2GOTransport(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
'''
typeName = _('X2GO Transport (direct)')
typeType = 'X2GOTransport'
typeDescription = _('X2GO Transport for direct connection')
iconFile = 'x2go.png'
protocol = protocols.NX
useEmptyCreds = gui.CheckBoxField(label=_('Empty creds'), order=1, tooltip=_('If checked, the credentials used to connect will be emtpy'))
fixedName = gui.TextField(label=_('Username'), order=2, tooltip=_('If not empty, this username will be always used as credential'))
fixedPassword = gui.PasswordField(label=_('Password'), order=3, tooltip=_('If not empty, this password will be always used as credential'))
listenPort = gui.NumericField(label=_('Listening port'), length=5, order=4, tooltip=_('Listening port of NX (ssh) at client machine'), defvalue='22')
connection = gui.ChoiceField(label=_('Connection'), order=6, tooltip=_('Connection speed for this transport (quality)'),
values=[
{'id': 'modem', 'text': 'modem'},
{'id': 'isdn', 'text': 'isdn'},
{'id': 'adsl', 'text': 'adsl'},
{'id': 'wan', 'text': 'wan'},
{'id': 'lan', 'text': 'lan'}
])
session = gui.ChoiceField(label=_('Session'), order=7, tooltip=_('Desktop session'),
values=[
{'id': 'gnome', 'text': 'gnome'},
{'id': 'kde', 'text': 'kde'},
{'id': 'cde', 'text': 'cde'},
])
cacheDisk = gui.ChoiceField(label=_('Disk Cache'), order=8, tooltip=_('Cache size en Mb stored at disk'),
values=[
{'id': '0', 'text': '0 Mb'},
{'id': '32', 'text': '32 Mb'},
{'id': '64', 'text': '64 Mb'},
{'id': '128', 'text': '128 Mb'},
{'id': '256', 'text': '256 Mb'},
{'id': '512', 'text': '512 Mb'},
])
cacheMem = gui.ChoiceField(label=_('Memory Cache'), order=9, tooltip=_('Cache size en Mb kept at memory'),
values=[
{'id': '4', 'text': '4 Mb'},
{'id': '8', 'text': '8 Mb'},
{'id': '16', 'text': '16 Mb'},
{'id': '32', 'text': '32 Mb'},
{'id': '64', 'text': '64 Mb'},
{'id': '128', 'text': '128 Mb'},
])
def initialize(self, values):
if values is None:
return
# Just pass over in fact
def isAvailableFor(self, ip):
'''
Checks if the transport is available for the requested destination ip
Override this in yours transports
'''
logger.debug('Checking availability for {0}'.format(ip))
ready = self.cache().get(ip)
if ready is None:
# Check again for readyness
if connection.testServer(ip, self.listenPort.value) is True:
self.cache().put(ip, 'Y', READY_CACHE_TIMEOUT)
return True
else:
self.cache().put(ip, 'N', READY_CACHE_TIMEOUT)
return ready == 'Y'
def getUDSTransportScript(self, userService, transport, ip, os, user, password, request):
logger.debug('Getting X2Go Transport info')
prefs = user.prefs('nx')
username = user.getUsernameForAuth()
proc = username.split('@')
username = proc[0]
if self.fixedName.value != '':
username = self.fixedName.value
if self.fixedPassword.value != '':
password = self.fixedPassword.value
if self.useEmptyCreds.isTrue():
username, password = '', ''
# We have the credentials right now, let os manager
width, height = CommonPrefs.getWidthHeight(prefs)
# Fix username/password acording to os manager
username, password = userService.processUserPassword(username, password)
# data
data = {
'username': username,
'password': password,
'width': width,
'height': height,
'port': self.listenPort.value,
'connection': self.connection.value,
'session': self.session.value,
'cacheDisk': self.cacheDisk.value,
'cacheMem': self.cacheMem.value
}
return '''
from PyQt4 import QtCore, QtGui
import six
from uds import osDetector
data = {data}
osname = {os}
QtGui.QMessageBox.critical(parent, 'Notice ' + osDetector.getOs(), six.text_type(data), QtGui.QMessageBox.Ok)
'''.format(data=data, os=os)

View File

@ -1,45 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Virtual Cable S.L.
# 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. 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
'''
from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs
from uds.core.managers.DownloadsManager import DownloadsManager
from uds.core.util.Config import Config
from .X2GOTransport import X2GOTransport
from django.utils.translation import ugettext_noop as _
import os.path
Config.section('X2GO').value('downloadUrl', 'http://wiki.x2go.org/doku.php/doc:installation:x2goclient').get()
UserPrefsManager.manager().registerPrefs('nx', _('NX Protocol'), [CommonPrefs.screenSizePref])

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB