Package x2go :: Module sshproxy :: Class X2GoSSHProxy

[frames] | no frames]

# Class X2GoSSHProxy

source code

                             object --+
                                      |
    paramiko.util.ClosingContextManager --+
                                          |
                  paramiko.client.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, passphrase=None, force_password_auth=False, 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, look_for_keys=False, allow_agent=False, sshproxy_host=None, sshproxy_port=22, sshproxy_user=None, sshproxy_password=None, sshproxy_force_password_auth=False, sshproxy_key_filename=None, sshproxy_pkey=None, sshproxy_passphrase=None, sshproxy_look_for_keys=False, sshproxy_allow_agent=False, sshproxy_tunnel=None, ssh_rootdir=`'``/sbuild-nonexistent/.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

`str`

get_local_proxy_host(self) Retrieve the local IP socket address this SSH proxying tunnel is (about to) bind/bound to. | 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

`str`

get_remote_host(self) Retrieve the remote IP socket address at the remote end of the SSH proxying tunnel. | source code

`int`

get_remote_port(self) Retrieve the remote IP socket port of the target system's SSH daemon. | source code

stop_thread(self) Tear down the SSH proxying tunnel. | source code

__del__(self) Class desctructor. | source code

Inherited from `paramiko.client.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 `paramiko.util.ClosingContextManager`: `__enter__`, `__exit__`

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, passphrase=None, force_password_auth=False, 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, look_for_keys=False, allow_agent=False, sshproxy_host=None, sshproxy_port=22, sshproxy_user=None, sshproxy_password=None, sshproxy_force_password_auth=False, sshproxy_key_filename=None, sshproxy_pkey=None, sshproxy_passphrase=None, sshproxy_look_for_keys=False, sshproxy_allow_agent=False, sshproxy_tunnel=None, ssh_rootdir=`'``/sbuild-nonexistent/.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)
  - `passphrase` ({str}) - a passphrase to use for unlocking a private key in case the password is already needed for two-factor authentication
  - `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)
  - `force_password_auth` (`bool`) - enforce password authentication even if a key(file) is present
  - `look_for_keys` (`bool`) - look for key files with standard names and try those if any can be found
  - `allow_agent` (`bool`) - try authentication via a locally available SSH agent
  - `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 `hostname`
  - `sshproxy_port` (`int`) - alias for `post`
  - `sshproxy_user` (`str`) - alias for `username`
  - `sshproxy_password` (`str`) - alias for `password`
  - `sshproxy_passphrase` (`str`) - alias for `passphrase`
  - `sshproxy_key_filename` (`str`) - alias for `key_filename`
  - `sshproxy_pkey` (`RSA/DSA key instance` (Paramiko)) - alias for `pkey`
  - `sshproxy_force_password_auth` (`bool`) - alias for `force_password_auth`
  - `sshproxy_look_for_keys` (`bool`) - alias for `look_for_keys`
  - `sshproxy_allow_agent` (`bool`) - alias for `allow_agent`
  - `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:
  - `X2GoSSHProxyAuthenticationException` - if the SSH proxy caused a `paramiko.AuthenticationException`
  - `X2GoSSHProxyException` - if the SSH proxy caused a `paramiko.SSHException`
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_host(self)

source code

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

Returns: `str`
  local IP socket address

### 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

### get_remote_host(self)

source code

Retrieve the remote IP socket address at the remote end of the SSH proxying tunnel.

Returns: `str`
  remote IP socket address

### get_remote_port(self)

source code

Retrieve the remote IP socket port of the target system's SSH daemon.

Returns: `int`
  remote SSH port