1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

spice support for proxy overriding

This commit is contained in:
Adolfo Gómez García 2023-02-14 14:25:54 +01:00
parent a07f76f540
commit e5e204fca0
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
3 changed files with 7 additions and 4 deletions

View File

@ -68,6 +68,7 @@ class SPICETransport(BaseSpiceTransport):
autoNewUsbShare = BaseSpiceTransport.autoNewUsbShare
smartCardRedirect = BaseSpiceTransport.smartCardRedirect
sslConnection = BaseSpiceTransport.SSLConnection
overridedProxy = BaseSpiceTransport.overridedProxy
def getUDSTransportScript(
self,
@ -99,7 +100,7 @@ class SPICETransport(BaseSpiceTransport):
con['cert_subject'],
fullscreen=self.fullScreen.isTrue(),
)
r.proxy = con.get('proxy', None)
r.proxy = self.overridedProxy.value.strip() or con.get('proxy', None)
r.usb_auto_share = self.usbShare.isTrue()
r.new_usb_auto_share = self.autoNewUsbShare.isTrue()

View File

@ -123,11 +123,11 @@ class BaseSpiceTransport(transports.Transport):
overridedProxy = gui.TextField(
order=10,
label=_('Proxy'),
tooltip=_('If not empty, this proxy will be used to connect to the service'),
label=_('Override Proxy'),
tooltip=_('If not empty, this proxy will be used to connect to the service instead of the one provided by the hypervisor. Format: http://host:port'),
required=False,
tab=gui.Tab.ADVANCED,
pattern=''
pattern=gui.TextField.PatternTypes.URL,
)
def isAvailableFor(self, userService: 'models.UserService', ip: str) -> bool:

View File

@ -103,6 +103,7 @@ class TSPICETransport(BaseSpiceTransport):
autoNewUsbShare = BaseSpiceTransport.autoNewUsbShare
smartCardRedirect = BaseSpiceTransport.smartCardRedirect
sslConnection = BaseSpiceTransport.SSLConnection
overridedProxy = BaseSpiceTransport.overridedProxy
def initialize(self, values: 'Module.ValuesType'):
if values:
@ -153,6 +154,7 @@ class TSPICETransport(BaseSpiceTransport):
fullscreen=self.fullScreen.isTrue(),
)
else:
con['proxy'] = self.overridedProxy.value.strip() or con['proxy']
# extract host and port from proxy url
host, port = con['proxy'].split('://')[1].split(':')[0:2]
ticket = TicketStore.create_for_tunnel(