* Updated linux agents to include "udsvapp"

* Fixed reloading of master key, to do it "less sensitive" to database connection errros
* Removed nonsense info log from storage
* Added "customCmd" for UDS vApp on linux
This commit is contained in:
Adolfo Gómez García 2017-12-14 15:17:46 +01:00
parent 81dd4e3b8c
commit d8db218c6d
10 changed files with 39 additions and 24 deletions

View File

@ -69,12 +69,14 @@ install-udsactor:
cp scripts/udsactor $(BINDIR)
cp scripts/UDSActorConfig-pkexec $(SBINDIR)
cp scripts/UDSActorTool-startup $(BINDIR)
cp scripts/udsvapp ${BINDIR}
# Policy to run as administrator
cp policy/org.openuds.pkexec.UDSActorConfig.policy $(POLKITDIR)
# Fix permissions
chmod 755 $(BINDIR)/udsactor
chmod 755 $(BINDIR)/udsvapp
chmod 755 $(BINDIR)/UDSActorTool-startup
chmod 755 $(SBINDIR)/UDSActorConfig-pkexec
chmod 755 $(LIBDIR)/UDSActorConfig.py
@ -93,4 +95,4 @@ endif
uninstall:
rm -rf $(LIBDIR)
# rm -f $(BINDIR)/udsactor
rm -rf $(CFGDIR)
rm -rf $(CFGDIR)

5
actors/linux/scripts/udsvapp Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
/usr/bin/udsactor login "$USER"
$@
/usr/bin/udsactor logout "$USER"

View File

@ -60,6 +60,7 @@ This package provides the required components to allow this machine to work on a
/etc/init.d/udsactor
/usr/bin/UDSActorTool-startup
/usr/bin/udsactor
/usr/bin/udsvapp
/usr/bin/UDSActorTool
/usr/sbin/UDSActorConfig
/usr/sbin/UDSActorConfig-pkexec

View File

@ -45,7 +45,6 @@ from uds.REST import Handler
from uds.REST import RequestError
from uds.models import UserService
import datetime
import six
@ -53,7 +52,6 @@ import logging
logger = logging.getLogger(__name__)
# Actor key, configurable in Security Section of administration interface
actorKey = Config.Config.section(Config.SECURITY_SECTION).value('Master Key',
cryptoManager().uuid(datetime.datetime.now()).replace('-', ''),
@ -100,8 +98,8 @@ class Actor(Handler):
'''
# Ensures that key is first parameter
# Here, path will be .../actor/ACTION/KEY (probably /rest/actor/KEY/...)
logger.debug('{} == {}'.format(self._params.get('key'), actorKey.get(True)))
if self._params.get('key') != actorKey.get(True):
# logger.debug('{} == {}'.format(self._params.get('key'), actorKey.get()))
if self._params.get('key') != actorKey.get():
return Actor.result(_('Invalid key'), error=ERR_INVALID_KEY)
return None

View File

@ -34,7 +34,6 @@ from __future__ import unicode_literals
from django.utils.translation import ugettext as _
from uds.models import Service, UserService, Tag
from uds.core.services import Service as coreService
@ -93,7 +92,7 @@ class Services(DetailHandler): # pylint: disable=too-many-public-methods
'type': item.data_type,
'type_name': _(itemType.name()),
'deployed_services_count': item.deployedServices.count(),
'user_services_count': UserService.objects.filter(deployed_service__service=item).exclude(state__in=(State.REMOVED, State.ERROR)).count(),
'user_services_count': UserService.objects.filter(deployed_service__service=item).exclude(state__in=State.INFO_STATES).count(),
'maintenance_mode': item.provider.maintenance_mode,
'permission': perm
}

View File

@ -129,7 +129,7 @@ class ServicesPools(ModelHandler):
'cache_l1_srvs': item.cache_l1_srvs,
'cache_l2_srvs': item.cache_l2_srvs,
'max_srvs': item.max_srvs,
'user_services_count': item.userServices.count(),
'user_services_count': item.userServices.exclude(state__in=State.INFO_STATES).count(),
'user_services_in_preparation': item.userServices.filter(state=State.PREPARING).count(),
'restrained': item.isRestrained(),
'show_transports': item.show_transports,

View File

@ -150,7 +150,6 @@ class Storage(object):
@staticmethod
def delete(owner=None):
logger.info("Deleting storage items")
if owner is None:
objects = dbStorage.objects.all() # @UndefinedVariable
else:

View File

@ -47,14 +47,14 @@ import six
import os
import logging
__updated__ = '2017-10-09'
__updated__ = '2017-12-14'
logger = logging.getLogger(__name__)
READY_CACHE_TIMEOUT = 30
SSH_KEY_LENGTH = 1024
class BaseX2GOTransport(Transport):
'''
Provides access via RDP to service.
@ -88,11 +88,18 @@ class BaseX2GOTransport(Transport):
# {'id': 'UNITY', 'text': 'Unity (see docs)'},
{'id': 'gnome-session-cinnamon', 'text': 'Cinnamon 1.4 (see docs)'},
{'id': 'gnome-session-cinnamon2d', 'text': 'Cinnamon 2.2 (see docs)'},
{'id': '/usr/bin/udsvapp', 'text': 'UDS vAPP'},
{'id': 'UDSVAPP', 'text': 'UDS vAPP'},
], tab=gui.PARAMETERS_TAB)
sound = gui.CheckBoxField(
customCmd = gui.TextField(
order=12,
label=_('vAPP'),
tooltip=_('If UDS vAPP is selected as "Desktop", the FULL PATH of the app to be executed. If UDS vAPP is not selected, this field will be ignored.'),
tab=gui.PARAMETERS_TAB
)
sound = gui.CheckBoxField(
order=13,
label=_('Enable sound'),
tooltip=_('If checked, sound will be available'),
defvalue=gui.TRUE,
@ -100,7 +107,7 @@ class BaseX2GOTransport(Transport):
)
exports = gui.CheckBoxField(
order=13,
order=14,
label=_('Redirect root folder'),
tooltip=_('If checked, user home folder will be redirected'),
defvalue=gui.FALSE,
@ -109,7 +116,7 @@ class BaseX2GOTransport(Transport):
speed = gui.ChoiceField(
label=_('Speed'),
order=14,
order=15,
tooltip=_('Connection speed'),
defvalue='3',
values=[
@ -154,8 +161,6 @@ class BaseX2GOTransport(Transport):
length=1, defvalue='6', minValue=1, maxValue=9, required=True,
tab=gui.ADVANCED_TAB)
def isAvailableFor(self, userService, ip):
'''
Checks if the transport is available for the requested destination ip

View File

@ -41,12 +41,11 @@ from uds.models import TicketStore
from .BaseX2GOTransport import BaseX2GOTransport
from . import x2gofile
import logging
import random
import string
__updated__ = '2017-01-30'
__updated__ = '2017-12-14'
logger = logging.getLogger(__name__)
@ -66,6 +65,7 @@ class TX2GOTransport(BaseX2GOTransport):
fixedName = BaseX2GOTransport.fixedName
# fullScreen = BaseX2GOTransport.fullScreen
desktopType = BaseX2GOTransport.desktopType
customCmd = BaseX2GOTransport.customCmd
sound = BaseX2GOTransport.sound
exports = BaseX2GOTransport.exports
speed = BaseX2GOTransport.speed
@ -75,7 +75,6 @@ class TX2GOTransport(BaseX2GOTransport):
pack = BaseX2GOTransport.pack
quality = BaseX2GOTransport.quality
def initialize(self, values):
if values is not None:
if values['tunnelServer'].count(':') != 1:
@ -91,7 +90,9 @@ class TX2GOTransport(BaseX2GOTransport):
width, height = CommonPrefs.getWidthHeight(prefs)
logger.debug('')
desktop = self.desktopType.value
if desktop == "UDSVAPP":
desktop = "/usr/bin/udsvapp " + self.customCmd.value
xf = x2gofile.getTemplate(
speed=self.speed.value,
@ -99,7 +100,7 @@ class TX2GOTransport(BaseX2GOTransport):
quality=self.quality.value,
sound=self.sound.isTrue(),
soundSystem=self.sound.value,
windowManager=self.desktopType.value,
windowManager=desktop,
exports=self.exports.isTrue(),
width=width,
height=height,

View File

@ -40,7 +40,7 @@ from . import x2gofile
import logging
__updated__ = '2017-01-30'
__updated__ = '2017-12-14'
logger = logging.getLogger(__name__)
@ -57,6 +57,7 @@ class X2GOTransport(BaseX2GOTransport):
fixedName = BaseX2GOTransport.fixedName
# fullScreen = BaseX2GOTransport.fullScreen
desktopType = BaseX2GOTransport.desktopType
customCmd = BaseX2GOTransport.customCmd
sound = BaseX2GOTransport.sound
exports = BaseX2GOTransport.exports
speed = BaseX2GOTransport.speed
@ -75,13 +76,17 @@ class X2GOTransport(BaseX2GOTransport):
width, height = CommonPrefs.getWidthHeight(prefs)
desktop = self.desktopType.value
if desktop == "UDSVAPP":
desktop = "/usr/bin/udsvapp " + self.customCmd.value
xf = x2gofile.getTemplate(
speed=self.speed.value,
pack=self.pack.value,
quality=self.quality.value,
sound=self.sound.isTrue(),
soundSystem=self.sound.value,
windowManager=self.desktopType.value,
windowManager=desktop,
exports=self.exports.isTrue(),
width=width,
height=height,