Package Products :: Package DataCollector :: Module SshClient :: Class SshUserAuth |
[hide private]
[frames] | no frames]

# Class SshUserAuth

source code

               twisted.python.log.Logger --+
                                           |
        twisted.conch.ssh.service.SSHService --+
                                               |
    twisted.conch.ssh.userauth.SSHUserAuthClient --+
                                                   |
                                                  SshUserAuth

Class to gather credentials for use with our SSH connection, and use them to authenticate against the remote device.

Instance Methods | [hide private]
__init__(self, user, instance, factory) If no username is supplied, defaults to the user running this code (eg zenoss) | source code
Twisted deferred object |
getPassword(self, unused=None) Called from conch. | source code
getGenericAnswers(self, name, instruction, prompts) Called from conch. | source code
_getPassword(self) Get the password. | source code
_handleFailure(self, message, event_key=None) Handle a failure by logging a message and sending an event. | source code
_getKey(self) | source code
string |
getPublicKey(self) Return the SSH public key (using the zProperty zKeyPath) or None | source code
Twisted deferred object |
getPrivateKey(self) Return a deferred with the SSH private key (using the zProperty zKeyPath) | source code
`bool` |
auth_keyboard_interactive(self, *args, **kwargs) Try to authenticate with keyboard-interactive authentication. | source code
`defer.Deferred` or `None` |
ssh_USERAUTH_FAILURE(self, *args, **kwargs) We received a MSG_USERAUTH_FAILURE. | source code
ssh_USERAUTH_SUCCESS(self, *args, **kwargs) We received a MSG_USERAUTH_SUCCESS. | source code
serviceStopped(self, *args, **kwargs) called when the service is stopped, either by the connection ending or by another service being started | source code
Inherited from `twisted.conch.ssh.userauth.SSHUserAuthClient`: `askForAuth`, `auth_password`, `auth_publickey`, `serviceStarted`, `signData`, `ssh_USERAUTH_PK_OK`, `ssh_USERAUTH_PK_OK_keyboard_interactive`, `ssh_USERAUTH_PK_OK_password`, `ssh_USERAUTH_PK_OK_publickey`, `tryAuth` Inherited from `twisted.conch.ssh.userauth.SSHUserAuthClient` (private): `_cbGenericAnswers`, `_cbGetPublicKey`, `_cbPassword`, `_cbSignData`, `_cbSignedData`, `_cbUserauthFailure`, `_ebAuth`, `_setNewPass`, `_setOldPass` Inherited from `twisted.conch.ssh.service.SSHService`: `logPrefix`, `packetReceived`

Class Variables | [hide private]
Inherited from `twisted.conch.ssh.userauth.SSHUserAuthClient`: `protocolMessages` Inherited from `twisted.conch.ssh.service.SSHService`: `transport`

Instance Variables | [hide private]
Inherited from `twisted.conch.ssh.userauth.SSHUserAuthClient`: `authenticatedWith`, `instance`, `lastPublicKey`, `name`, `preferredOrder`, `triedPublicKeys`, `user`

Method Details | [hide private]

### __init__(self, user, instance, factory) (Constructor) | source code
If no username is supplied, defaults to the user running this code (eg zenoss) Parameters: `user` (string) - username `instance` (object) - instance object `factory` (Twisted factory object) - factory info Overrides: twisted.conch.ssh.userauth.SSHUserAuthClient.__init__

### getPassword(self, unused=None) | source code
Called from conch. Return a deferred object of success if there's a password or return fail (ie no zCommandPassword specified) Parameters: `unused` (string) - unused (unused) Returns: Twisted deferred object Twisted deferred object (defer.succeed or defer.fail) Overrides: twisted.conch.ssh.userauth.SSHUserAuthClient.getPassword

### getGenericAnswers(self, name, instruction, prompts) | source code
Called from conch. Returns a `Deferred` with the responses to the prompts. Parameters: `name` - The name of the authentication currently in progress. `instruction` - Describes what the authentication wants. `prompts` - A list of (prompt, echo) pairs, where prompt is a string to display and echo is a boolean indicating whether the user's response should be echoed as they type it. Overrides: twisted.conch.ssh.userauth.SSHUserAuthClient.getGenericAnswers

### _getPassword(self) | source code
Get the password. Raise an exception if it is not set.

### getPublicKey(self) | source code
Return the SSH public key (using the zProperty zKeyPath) or None Returns: string SSH public key Overrides: twisted.conch.ssh.userauth.SSHUserAuthClient.getPublicKey

### getPrivateKey(self) | source code
Return a deferred with the SSH private key (using the zProperty zKeyPath) Returns: Twisted deferred object Twisted deferred object (defer.succeed) Overrides: twisted.conch.ssh.userauth.SSHUserAuthClient.getPrivateKey

### auth_keyboard_interactive(self, *args, **kwargs) | source code
Try to authenticate with keyboard-interactive authentication. Send the request to the server and return True. Returns: `bool` Overrides: twisted.conch.ssh.userauth.SSHUserAuthClient.auth_keyboard_interactive (inherited documentation)

### ssh_USERAUTH_FAILURE(self, *args, **kwargs) | source code
We received a MSG_USERAUTH_FAILURE. Payload:
       string methods
       byte partial success
If partial success is `True`, then the previous method succeeded but is not sufficent for authentication. `methods` is a comma-separated list of accepted authentication methods. We sort the list of methods by their position in `self.preferredOrder`, removing methods that have already succeeded. We then call `self.tryAuth` with the most preferred method. Parameters: `packet` - the `MSG_USERAUTH_FAILURE` payload. Returns: `defer.Deferred` or `None` a `defer.Deferred` that will be callbacked with `None` as soon as all authentication methods have been tried, or `None` if no more authentication methods are available. Overrides: twisted.conch.ssh.userauth.SSHUserAuthClient.ssh_USERAUTH_FAILURE (inherited documentation)

### ssh_USERAUTH_SUCCESS(self, *args, **kwargs) | source code
We received a MSG_USERAUTH_SUCCESS. The server has accepted our authentication, so start the next service. Overrides: twisted.conch.ssh.userauth.SSHUserAuthClient.ssh_USERAUTH_SUCCESS (inherited documentation)

### serviceStopped(self, *args, **kwargs) | source code
called when the service is stopped, either by the connection ending or by another service being started Overrides: twisted.conch.ssh.service.SSHService.serviceStopped (inherited documentation)