x2go.forward module

Python Gevent based port forwarding server (openssh -L option) for the proxying of graphical X2Go elements.

class x2go.forward.X2GoFwServer(listener, remote_host, remote_port, ssh_transport, session_instance=None, session_name=None, subsystem=None, logger=None, loglevel=56)[source]

Bases: gevent.server.StreamServer

x2go.forward.X2GoFwServer implements a gevent’s StreamServer based Paramiko/SSH port forwarding server.

An x2go.forward.X2GoFwServer class object is used to tunnel graphical trafic through an external proxy command launched by a X2GoProxy* backend.

close_channel()[source]

Close an open channel again.

close_socket()[source]

Close the forwarding tunnel’s socket again.

start()[source]
stop()[source]

Stop the forwarding tunnel.

x2go_forward_tunnel_handle(fw_socket, address)[source]

Handle for SSH/Paramiko forwarding tunnel.

Parameters:
  • fw_socket (obj) – local end of the forwarding tunnel
  • address (tuple) – unused/ignored
x2go.forward.start_forward_tunnel(local_host='127.0.0.1', local_port=22022, remote_host='127.0.0.1', remote_port=22, ssh_transport=None, session_instance=None, session_name=None, subsystem=None, logger=None)[source]

Setup up a Paramiko/SSH port forwarding tunnel (like openssh -L option).

The tunnel is used to transport X2Go graphics data through a proxy application like nxproxy.

Parameters:
  • local_host (int) – local starting point of the forwarding tunnel (Default value = ‘127.0.0.1’)
  • local_port (int) – listen port of the local starting point (Default value = 22022)
  • remote_host (str) – from the endpoint of the tunnel, connect to host <remote_host>... (Default value = ‘127.0.0.1’)
  • remote_port (int) – on port <remote_port> (Default value = 22)
  • ssh_transport (obj) – the Paramiko/SSH transport (i.e. the X2Go session’s Paramiko/SSH transport object) (Default value = None)
  • session_instance (obj) – the x2go.session.X2GoSession instance that initiates this tunnel (Default value = None)
  • session_name (str) – the session name of the X2Go session this port forwarding server belongs to (Default value = None)
  • subsystem (str) – a custom string with a component name that tries to evoke a new tunnel setup (Default value = None)
  • logger (obj) – an X2GoLogger object (Default value = None)
Returns:

returns an x2go.forward.X2GoFwServer instance

Return type:

obj

x2go.forward.stop_forward_tunnel(fw_server)[source]

Tear down a given Paramiko/SSH port forwarding tunnel.

Parameters:fw_server (obj) – an x2go.forward.X2GoFwServer instance as returned by the L{start_forward_tunnel()} function