1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-25 06:03:51 +03:00

added upload/download to ssh

This commit is contained in:
Adolfo Gómez García 2023-03-16 16:24:09 +01:00
parent 6bb4c3bd5e
commit 5da71a4f6e
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23

View File

@ -95,6 +95,7 @@ class HTML5SSHTransport(transports.Transport):
sshPrivateKey = gui.TextField( sshPrivateKey = gui.TextField(
label=_('SSH Private Key'), label=_('SSH Private Key'),
order=22, order=22,
multiline=4,
tooltip=_( tooltip=_(
'Private key for SSH authentication. If not provided, password authentication is used.' 'Private key for SSH authentication. If not provided, password authentication is used.'
), ),
@ -117,18 +118,39 @@ class HTML5SSHTransport(transports.Transport):
), ),
tab=gui.PARAMETERS_TAB, tab=gui.PARAMETERS_TAB,
) )
enableFileSharing = gui.ChoiceField(
label=_('File Sharing'),
order=31,
tooltip=_('File upload/download redirection policy'),
defvalue='false',
values=[
{'id': 'false', 'text': _('Disable file sharing')},
{'id': 'down', 'text': _('Allow download only')},
{'id': 'up', 'text': _('Allow upload only')},
{'id': 'true', 'text': _('Enable file sharing')},
],
tab=gui.PARAMETERS_TAB,
)
fileSharingRoot = gui.TextField(
label=_('File Sharing Root'),
order=32,
tooltip=_(
'Root path for file sharing. If not provided, root directory will be used.'
),
tab=gui.PARAMETERS_TAB,
)
sshPort = gui.NumericField( sshPort = gui.NumericField(
length=40, length=40,
label=_('SSH Server port'), label=_('SSH Server port'),
defvalue='22', defvalue='22',
order=22, order=33,
tooltip=_('Port of the SSH server.'), tooltip=_('Port of the SSH server.'),
required=True, required=True,
tab=gui.PARAMETERS_TAB, tab=gui.PARAMETERS_TAB,
) )
sshHostKey = gui.TextField( sshHostKey = gui.TextField(
label=_('SSH Host Key'), label=_('SSH Host Key'),
order=41, order=34,
tooltip=_( tooltip=_(
'Host key of the SSH server. If not provided, no verification of host identity is done.' 'Host key of the SSH server. If not provided, no verification of host identity is done.'
), ),
@ -138,7 +160,7 @@ class HTML5SSHTransport(transports.Transport):
length=3, length=3,
label=_('Server Keep Alive'), label=_('Server Keep Alive'),
defvalue='30', defvalue='30',
order=42, order=35,
tooltip=_( tooltip=_(
'Time in seconds between keep alive messages sent to server. If not provided, no keep alive messages are sent.' 'Time in seconds between keep alive messages sent to server. If not provided, no keep alive messages are sent.'
), ),
@ -240,6 +262,19 @@ class HTML5SSHTransport(transports.Transport):
if i[1].value.strip(): if i[1].value.strip():
params[i[0]] = i[1].value.strip() params[i[0]] = i[1].value.strip()
# Filesharing using guacamole sftp
if self.enableFileSharing.value != 'false':
params['enable-sftp'] = 'true'
if self.fileSharingRoot.value.strip():
params['sftp-root-directory'] = self.fileSharingRoot.value.strip()
if self.enableFileSharing.value not in ('down', 'true'):
params['sftp-disable-download'] = 'true'
if self.enableFileSharing.value not in ('up', 'true'):
params['sftp-disable-upload'] = 'true'
logger.debug('SSH Params: %s', params) logger.debug('SSH Params: %s', params)
scrambler = cryptoManager().randomString(32) scrambler = cryptoManager().randomString(32)