tardis.apps.push_to package

Submodules

tardis.apps.push_to.apps module

class tardis.apps.push_to.apps.PushToConfig(app_name, app_module)

Bases: tardis.app_config.AbstractTardisAppConfig

name = 'tardis.apps.push_to'
verbose_name = 'Push To'

tardis.apps.push_to.exceptions module

exception tardis.apps.push_to.exceptions.NoSuitableCredential

Bases: exceptions.Exception

This exception is thrown when attempting to find a suitable credential for a remote host but none is found

tardis.apps.push_to.models module

class tardis.apps.push_to.models.Credential(*args, **kwargs)

Bases: tardis.apps.push_to.models.KeyPair

A credential that may contain a password and/or key. The auth method chosen depends on the credentials available, allowed auth methods, and priorities defined by the SSH client.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

static generate_keypair_credential(tardis_user, remote_user, remote_hosts, bit_length=2048)

Generates and saves an RSA key pair credential. Credentials returned by this method are intended to be registered on remote systems before being used. @type tardis_user: User @type remote_user: str @type bit_length: int @type remote_hosts: list[RemoteHost] :return: the generated credential :rtype: object

get_client_for_host(remote_host)

Attempts to establish a connection with the remote_host using this credential object. The remote_host may be any host, but only those in the remote_hosts field are expected to work. @type remote_host: .RemoteHost :return: a connected SSH client :rtype: SSHClient

static get_suitable_credential(tardis_user, remote_host, remote_user=None)
objects = <django.db.models.manager.Manager object>
remote_hosts
user
verify_remote_access(remote_host=None)

@type remote_host: RemoteHost

class tardis.apps.push_to.models.CredentialAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

form

alias of CredentialForm

media
class tardis.apps.push_to.models.CredentialForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None)

Bases: django.forms.models.ModelForm

class Meta
fields = '__all__'
model

alias of Credential

widgets = {'password': <django.forms.widgets.PasswordInput object>}
base_fields = OrderedDict([('key_type', <django.forms.fields.CharField object>), ('public_key', <django.forms.fields.CharField object>), ('private_key', <django.forms.fields.CharField object>), ('user', <django.forms.models.ModelChoiceField object>), ('remote_hosts', <django.forms.models.ModelMultipleChoiceField object>), ('remote_user', <django.forms.fields.CharField object>), ('password', <django.forms.fields.CharField object>)])
declared_fields = OrderedDict()
media
class tardis.apps.push_to.models.DBHostKeyPolicy

Bases: paramiko.client.MissingHostKeyPolicy

Host key verification policy based on the host key stored in the database.

missing_host_key(client, hostname, key)

@type key: PKey

class tardis.apps.push_to.models.KeyPair(*args, **kwargs)

Bases: django.db.models.base.Model

A key pair

class Meta
abstract = False
key
Returns:a subclass of PKey of the appropriate key type
Return type:PKey
Raises:ValidationError
save(*args, **kwargs)
class tardis.apps.push_to.models.OAuthSSHCertSigningService(*args, **kwargs)

Bases: django.db.models.base.Model

Connection parameters for an OAuth2 SSH certificate signing service. Supports certificate signing server available here: https://github.com/monash-merc/ssh-authz

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

allowed_groups
allowed_remote_hosts
allowed_users
static get_available_signing_services(user)

Gets all SSH cert signing services available for a given user :param User user: User :return: allowed signing services :rtype: User

static get_oauth_service(user, service_id)

@type user: User @type service_id: int

objects = <django.db.models.manager.Manager object>
class tardis.apps.push_to.models.RemoteHost(*args, **kwargs)

Bases: tardis.apps.push_to.models.KeyPair

A remote host that may be connected to via SSH

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

administrator
credential_set
oauthsshcertsigningservice_set
objects = <django.db.models.manager.Manager object>
class tardis.apps.push_to.models.RemoteHostAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

Hides the private key field, which is not necessary for host keys

fields = ['nickname', 'administrator', 'host_name', 'port', 'key_type', 'public_key', 'logo_img']
media

tardis.apps.push_to.oauth_tokens module

tardis.apps.push_to.oauth_tokens.get_token(request, oauth_service)

Returns the OAuth2 token from the current session :param Request request: django session object :param OAuthSSHCertSigningService oauth_service: an

OAuthSSHCertSigningService object
Returns:
Return type:string
tardis.apps.push_to.oauth_tokens.get_token_data(oauth_service, token)

Gets the OAuth2 user attributes using the supplied token :param OAuthSSHCertSigningService oauth_service: an

OAuthSSHCertSigningService object
Parameters:token (basestring) – an OAuth2 token
Returns:a json object of user attributes
Return type:dict
tardis.apps.push_to.oauth_tokens.set_token(request, oauth_service, token)

Stores the OAuth2 token in the current session :param Request request: django request object :param OAuthSSHCertSigningService oauth_service: an

OAuthSSHCertSigningService object
Parameters:token (basestring) – the OAuth2 token

tardis.apps.push_to.ssh_authz module

tardis.apps.push_to.ssh_authz.sign_certificate(credential, token, url)

An interface to the OAuth2 SSH certificate signing service @type credential: models.Credential

tardis.apps.push_to.tasks module

tardis.apps.push_to.urls module

tardis.apps.push_to.utils module

tardis.apps.push_to.utils.bytes_available(ssh_client, path)
tardis.apps.push_to.utils.can_copy(ssh_client, object_type, object_id, path)
tardis.apps.push_to.utils.get_default_push_location(sftp_client)
tardis.apps.push_to.utils.get_object_size(type, id)
tardis.apps.push_to.utils.is_directory(sftp_client, path)
tardis.apps.push_to.utils.list_subdirectories(sftp_client, path, show_hidden=False)
tardis.apps.push_to.utils.shell_escape(s)

tardis.apps.push_to.views module

Module contents