Package x2go :: Module sshproxy :: Class X2goSSHProxy
[frames] | no frames]

Class X2goSSHProxy

source code

            object --+    
                     |    
    paramiko.SSHClient --+
                         |
        object --+       |
                 |       |
threading._Verbose --+   |
                     |   |
      threading.Thread --+
                         |
                        X2goSSHProxy

X2goSSHProxy can be used to proxy X2Go connections through a firewall via SSH.

Instance Methods
 
__init__(self, hostname=None, port=22, username=None, password=None, key_filename=None, local_host='localhost', local_port=22022, remote_host='localhost', remote_port=22, known_hosts=None, add_to_known_hosts=False, pkey=None, sshproxy_host=None, sshproxy_port=22, sshproxy_user=None, sshproxy_password=None, sshproxy_key_filename=None, sshproxy_pkey=None, sshproxy_tunnel=None, ssh_rootdir='/home/buildd/.ssh', session_instance=None, logger=None, loglevel=56)
Initialize an X2goSSHProxy instance.
source code
 
check_host(self)
Wraps around a Paramiko/SSH host key check.
source code
 
run(self)
Start the SSH proxying tunnel...
source code
int
get_local_proxy_port(self)
Retrieve the local IP socket port this SSH proxying tunnel is (about to) bind/bound to.
source code
 
stop_thread(self)
Tear down the SSH proxying tunnel.
source code
 
__del__(self)
Class desctructor.
source code

Inherited from paramiko.SSHClient: close, connect, exec_command, get_host_keys, get_transport, invoke_shell, load_host_keys, load_system_host_keys, open_sftp, save_host_keys, set_log_channel, set_missing_host_key_policy

Inherited from threading.Thread: __repr__, getName, isAlive, isDaemon, is_alive, join, setDaemon, setName, start

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  fw_tunnel = None
Properties

Inherited from threading.Thread: daemon, ident, name

Inherited from object: __class__

Method Details

__init__(self, hostname=None, port=22, username=None, password=None, key_filename=None, local_host='localhost', local_port=22022, remote_host='localhost', remote_port=22, known_hosts=None, add_to_known_hosts=False, pkey=None, sshproxy_host=None, sshproxy_port=22, sshproxy_user=None, sshproxy_password=None, sshproxy_key_filename=None, sshproxy_pkey=None, sshproxy_tunnel=None, ssh_rootdir='/home/buildd/.ssh', session_instance=None, logger=None, loglevel=56)
(Constructor)

source code 

Initialize an X2goSSHProxy instance. Use an instance of this class to tunnel X2Go requests through a proxying SSH server (i.e. to subLANs that are separated by firewalls or to private IP subLANs that are NATted behind routers).

Parameters:
  • username (str) - login user name to be used on the SSH proxy host
  • password (str) - user's password on the SSH proxy host, with private key authentication it will be used to unlock the key (if needed)
  • key_filename (str) - name of a SSH private key file
  • pkey (RSA/DSA key instance) - a private DSA/RSA key object (as provided by Paramiko/SSH)
  • local_host (str) - bind SSH tunnel to the local_host IP socket address (default: localhost)
  • local_port (int) - IP socket port to bind the SSH tunnel to (default; 22022)
  • remote_host (str) - remote endpoint of the SSH proxying/forwarding tunnel (default: localhost)
  • remote_port (int) - remote endpoint's IP socket port for listening SSH daemon (default: 22)
  • known_hosts (str) - full path to a custom known_hosts file
  • add_to_known_hosts (bool) - automatically add host keys of unknown SSH hosts to the known_hosts file
  • hostname (str) - alias for local_host
  • port (int) - alias for local_port
  • sshproxy_host (str) - alias for remote_host
  • sshproxy_port (int) - alias for remote_port
  • sshproxy_user (str) - alias for username
  • sshproxy_password (str) - alias for password
  • sshproxy_key_filename (str) - alias for key_filename
  • sshproxy_pkey (RSA/DSA key instance (Paramiko)) - alias for pkey
  • sshproxy_tunnel (str) - a string of the format <local_host>:<local_port>:<remote_host>:<remote_port> which will override---if used---the options: local_host, local_port, remote_host and remote_port
  • ssh_rootdir (str) - local user's SSH base directory (default: ~/.ssh)
  • session_instance (X2goSession instance) - the X2goSession instance that builds up this SSH proxying tunnel
  • logger (X2goLogger instance) - you can pass an X2goLogger object to the X2goSSHProxy constructor
  • loglevel (int) - if no X2goLogger object has been supplied a new one will be constructed with the given loglevel
Raises:
Overrides: object.__init__

run(self)

source code 

Start the SSH proxying tunnel...

Raises:
  • X2goSSHProxyException - if the SSH proxy could not retrieve an SSH transport for proxying a X2Go server-client connection
Overrides: threading.Thread.run

get_local_proxy_port(self)

source code 

Retrieve the local IP socket port this SSH proxying tunnel is (about to) bind/bound to.

Returns: int
local IP socket port