forked from shaba/openuds
advancing on x2go support
This commit is contained in:
parent
00798e5927
commit
c7dc1e8b81
@ -12,3 +12,4 @@ python-ldap
|
||||
MySQL-python
|
||||
reportlab
|
||||
bitarray
|
||||
paramiko
|
||||
|
@ -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,
|
||||
@ -40,16 +40,18 @@ from uds.core.util import OsDetector
|
||||
|
||||
# This transport is specific for oVirt, so we need to point to it
|
||||
|
||||
import logging
|
||||
import paramiko
|
||||
import six
|
||||
import os
|
||||
import logging
|
||||
|
||||
__updated__ = '2016-09-07'
|
||||
__updated__ = '2016-10-19'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
READY_CACHE_TIMEOUT = 30
|
||||
|
||||
SSH_KEY_LENGTH = 1024
|
||||
|
||||
class BaseX2GOTransport(Transport):
|
||||
'''
|
||||
@ -78,13 +80,33 @@ class BaseX2GOTransport(Transport):
|
||||
tooltip=_('If not empty, this password will be always used as credential'),
|
||||
tab=gui.CREDENTIALS_TAB
|
||||
)
|
||||
|
||||
fullScreen = gui.CheckBoxField(
|
||||
order=5,
|
||||
order=10,
|
||||
label=_('Show fullscreen'),
|
||||
tooltip=_('If checked, viewer will be shown on fullscreen mode-'),
|
||||
tab=gui.PARAMETERS_TAB
|
||||
)
|
||||
|
||||
desktopType = gui.ChoiceField(label=_('Desktop'), order=11, tooltip=_('Desktop session'),
|
||||
values=[
|
||||
{'id': 'XFCE', 'text': 'Xfce'},
|
||||
{'id': 'MATE', 'text': 'Mate'},
|
||||
{'id': 'LXDE', 'text': 'Lxde'},
|
||||
{'id': 'GNOME', 'text': 'Gnome (see docs)'},
|
||||
{'id': 'KDE', 'text': 'Kde (see docs)'},
|
||||
# {'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)'},
|
||||
], tab=gui.PARAMETERS_TAB)
|
||||
|
||||
keyboardLayout = gui.TextField(label=_('Keyboard'), order=12, tooltip=_('Keyboard layout (es, us, fr, ...). Empty value means autodetect.'),
|
||||
default='',
|
||||
tab=gui.ADVANCED_TAB
|
||||
)
|
||||
|
||||
|
||||
|
||||
def isAvailableFor(self, userService, ip):
|
||||
'''
|
||||
Checks if the transport is available for the requested destination ip
|
||||
@ -116,6 +138,28 @@ class BaseX2GOTransport(Transport):
|
||||
def getConnectionInfo(self, service, user, password):
|
||||
return self.processUserPassword(service, user, password)
|
||||
|
||||
def genKeyPairForSsh(self):
|
||||
'''
|
||||
Generates a key pair for use with x2go
|
||||
The private part is used by client
|
||||
the public part must be "appended" to authorized_keys if it is not already added.
|
||||
If .ssh folder does not exists, it must be created
|
||||
if authorized_keys does not exists, it must be created
|
||||
On key adition, we can look for every key that has a "UDS@X2GOCLIENT" as comment, so we can remove them before adding new ones
|
||||
|
||||
Windows (tested):
|
||||
C:\Program Files (x86)\x2goclient>x2goclient.exe --session-conf=c:/temp/sessions --session=UDS/test-session --close-disconnect --hide --no-menu
|
||||
Linux (tested):
|
||||
HOME=[temporal folder, where we create a .x2goclient folder and a sessions inside] pyhoca-cli -P UDS/test-session
|
||||
'''
|
||||
key = paramiko.RSAKey.generate(SSH_KEY_LENGTH)
|
||||
privFile = six.StringIO()
|
||||
key.write_private_key(privFile)
|
||||
priv = privFile.getvalue()
|
||||
|
||||
pub = 'ssh-rsa {} UDS@X2GOCLIENT'.format(key.get_base64())
|
||||
return (priv, pub)
|
||||
|
||||
def getScript(self, script):
|
||||
with open(os.path.join(os.path.dirname(__file__), script)) as f:
|
||||
data = f.read()
|
||||
|
@ -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,
|
||||
@ -46,7 +46,7 @@ import logging
|
||||
import random
|
||||
import string
|
||||
|
||||
__updated__ = '2016-10-14'
|
||||
__updated__ = '2016-10-19'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -64,6 +64,12 @@ class TX2GOTransport(BaseX2GOTransport):
|
||||
|
||||
tunnelServer = gui.TextField(label=_('Tunnel server'), order=1, tooltip=_('IP or Hostname of tunnel server sent to client device ("public" ip) and port. (use HOST:PORT format)'), tab=gui.TUNNEL_TAB)
|
||||
|
||||
useEmptyCreds = BaseX2GOTransport.useEmptyCreds
|
||||
fixedName = BaseX2GOTransport.fixedName
|
||||
fixedPassword = BaseX2GOTransport.fixedPassword
|
||||
fullScreen = BaseX2GOTransport.fullScreen
|
||||
desktopType = BaseX2GOTransport.desktopType
|
||||
|
||||
|
||||
def initialize(self, values):
|
||||
if values is not None:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#
|
||||
# Copyright (c) 2012 Virtual Cable S.L.
|
||||
# Copyright (c) 2016 Virtual Cable S.L.
|
||||
# All rights reservem.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
@ -38,7 +38,7 @@ from .BaseX2GOTransport import BaseX2GOTransport
|
||||
|
||||
import logging
|
||||
|
||||
__updated__ = '2016-09-07'
|
||||
__updated__ = '2016-10-19'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -52,9 +52,11 @@ class X2GOTransport(BaseX2GOTransport):
|
||||
typeType = 'X2GOTransport'
|
||||
typeDescription = _('X2Go Transport for direct connection (EXPERIMENTAL)')
|
||||
|
||||
# useEmptyCreds = BaseSpiceTransport.useEmptyCreds
|
||||
# fixedName = BaseSpiceTransport.fixedName
|
||||
# fixedPassword = BaseSpiceTransport.fixedPassword
|
||||
useEmptyCreds = BaseX2GOTransport.useEmptyCreds
|
||||
fixedName = BaseX2GOTransport.fixedName
|
||||
fixedPassword = BaseX2GOTransport.fixedPassword
|
||||
fullScreen = BaseX2GOTransport.fullScreen
|
||||
desktopType = BaseX2GOTransport.desktopType
|
||||
|
||||
def getUDSTransportScript(self, userService, transport, ip, os, user, password, request):
|
||||
pass
|
||||
|
@ -16,6 +16,8 @@ if executable is None:
|
||||
</p>
|
||||
''')
|
||||
|
||||
rsaPubKey = '''{m.rsa_key}'''
|
||||
|
||||
theFile = '''{m.r.as_file}'''
|
||||
|
||||
filename = tools.saveTempFile(theFile)
|
||||
|
Loading…
x
Reference in New Issue
Block a user