Jump to >

This documentation covers the in-development release of Review Board. You can see the latest stable docs or all previous versions.


class SSHStorage(namespace=None)[source]

Bases: object


x.__init__(…) initializes x; see help(type(x)) for signature


Reads the user key.

This will return an instance of paramiko.PKey representing the user key, if one exists. Otherwise, it will return None.


Writes a user key.

The user key will be stored, and can be accessed later by read_user_key.

This will raise UnsupportedSSHKeyError if key isn’t a paramiko.RSAKey or paramiko.DSSKey.

It may also raise paramiko.SSHException for key-related errors.


Deletes a user key.

The user key, if it exists, will be removed from storage.

If no user key exists, this will do nothing.


Reads a list of authorized keys.

The authorized keys are returned as a list of raw key data, which can then be converted into classes as needed.


Reads a list of known host keys.

This known host keys are returned as a list of raw key data, which can then be converted into classes as needed.

add_host_key(hostname, key)[source]

Adds a known key for a given host.

This will store a mapping of the key and hostname so that future access to the server will know the host is legitimate.

replace_host_key(hostname, old_key, new_key)[source]

Replaces a host key in the known hosts list with another.

This is used for replacing host keys that have changed.

class FileSSHStorage(namespace=None)[source]

Bases: reviewboard.ssh.storage.SSHStorage

DEFAULT_KEY_FILES = ((<class 'paramiko.rsakey.RSAKey'>, u'id_rsa'), (<class 'paramiko.dsskey.DSSKey'>, u'id_dsa'))[source]
SSH_DIRS = (u'.ssh', u'ssh')[source]
add_host_key(hostname, key)[source]
replace_host_key(hostname, old_key, new_key)[source]

Returns the path to the known host keys file.


Returns the path to the SSH directory on the system.

By default, this will attempt to find either a .ssh or ssh directory. If ssh_dir_name is specified, the search will be skipped, and we’ll use that name instead.


Ensures the existance of the .ssh directory.

If the directory doesn’t exist, it will be created. The full path to the directory will be returned.

Callers are expected to handle any exceptions. This may raise IOError for any problems in creating the directory.


Set the SSH storage backend to use for SSH.

This will store the backend in the database and make it available immediately for SSH sessions.

New in version 3.0.18.

Parameters:storage_backend (unicode) – The class path for the storage backend to set. This can be None to unset the storage backend, using the defaults instead.

Return the SSH storage backend used for SSH.

This will return the version stored in the site configuration. It does not consider any legacy methods of storing the backend.

New in version 3.0.18.

Returns:The class path for the configured storage backend. This may be None.
Return type:unicode