twisted.conch.client.default.SSHUserAuthClient(userauth.SSHUserAuthClient)
class documentationtwisted.conch.client.default
(View In Hierarchy)
Method | __init__ | Undocumented |
Method | serviceStarted | called when the service is active on the transport. |
Method | serviceStopped | called when the service is stopped, either by the connection ending or by another service being started |
Method | getPassword | Return a Deferred that
will be called back with a password. prompt is a string to display for the
password, or None for a generic 'user@hostname's password: '. |
Method | getPublicKey | Get a public key from the key agent if possible, otherwise look in the next configured identity file for one. |
Method | signData | Extend the base signing behavior by using an SSH agent to sign the data, if one is available. |
Method | getPrivateKey | Try to load the private key from the last used file identified by
getPublicKey , potentially asking for the passphrase if the key
is encrypted. |
Method | getGenericAnswers | Returns a Deferred with
the responses to the promopts. |
Method | _setAgent | Undocumented |
Method | _ebSetAgent | Undocumented |
Method | _getPassword | Prompt for a password using getpass.getpass . |
Class Method | _openTty | Open /dev/tty as two streams one in read, one in write mode, and return them. |
Class Method | _replaceStdoutStdin | Contextmanager that replaces stdout and stdin with /dev/tty and resets them when it is done. |
Inherited from SSHUserAuthClient:
Instance Variable | name | the name of this service: 'ssh-userauth' (type: str ) |
Instance Variable | preferredOrder | a list of authentication methods that should be used first, in order of
preference, if supported by the server (type: list ) |
Instance Variable | user | the name of the user to authenticate as (type: bytes ) |
Instance Variable | instance | the service to start after authentication has finished (type: service.SSHService ) |
Instance Variable | authenticatedWith | a list of strings of authentication methods we've tried (type: list
of bytes ) |
Instance Variable | triedPublicKeys | a list of public key objects that we've tried to authenticate with (type: list
of Key ) |
Instance Variable | lastPublicKey | the last public key object we've tried to authenticate with (type: Key ) |
Method | askForAuth | Send a MSG_USERAUTH_REQUEST. |
Method | tryAuth | Dispatch to an authentication method. |
Method | ssh_USERAUTH_SUCCESS | We received a MSG_USERAUTH_SUCCESS. The server has accepted our authentication, so start the next service. |
Method | ssh_USERAUTH_FAILURE | We received a MSG_USERAUTH_FAILURE. Payload:: string methods byte partial success |
Method | ssh_USERAUTH_PK_OK | This message (number 60) can mean several different messages depending on the current authentication type. We dispatch to individual methods in order to handle this request. |
Method | ssh_USERAUTH_PK_OK_publickey | This is MSG_USERAUTH_PK. Our public key is valid, so we create a signature and try to authenticate with it. |
Method | ssh_USERAUTH_PK_OK_password | This is MSG_USERAUTH_PASSWD_CHANGEREQ. The password given has expired. We ask for an old password and a new password, then send both back to the server. |
Method | ssh_USERAUTH_PK_OK_keyboard_interactive | This is MSG_USERAUTH_INFO_RESPONSE. The server has sent us the questions it wants us to answer, so we ask the user and sent the responses. |
Method | auth_publickey | Try to authenticate with a public key. Ask the user for a public key; if the user has one, send the request to the server and return True. Otherwise, return False. |
Method | auth_password | Try to authenticate with a password. Ask the user for a password. If the user will return a password, return True. Otherwise, return False. |
Method | auth_keyboard_interactive | Try to authenticate with keyboard-interactive authentication. Send the request to the server and return True. |
Method | _ebAuth | Generic callback for a failed authentication attempt. Respond by asking for the list of accepted methods (the 'none' method) |
Method | _cbUserauthFailure | Undocumented |
Method | _cbSignedData | Called back out of self.signData with the signed data. Send the authentication request with the signature. |
Method | _setOldPass | Called back when we are choosing a new password. Simply store the old password for now. |
Method | _setNewPass | Called back when we are choosing a new password. Get the old password and send the authentication message with both. |
Method | _cbGenericAnswers | Called back when we are finished answering keyboard-interactive questions. Send the info back to the server in a MSG_USERAUTH_INFO_RESPONSE. |
Method | _cbGetPublicKey | Undocumented |
Method | _cbPassword | Called back when the user gives a password. Send the request to the server. |
Method | _cbSignData | Called back when the private key is returned. Sign the data and return the signature. |
Inherited from SSHService (via SSHUserAuthClient):
Method | logPrefix | Override this method to insert custom logging behavior. Its return value will be inserted in front of every line. It may be called more times than the number of output lines. |
Method | packetReceived | called when we receive a packet on the transport |
called when the service is stopped, either by the connection ending or by another service being started
Prompt for a password using getpass.getpass
.
Parameters | prompt | Written on tty to ask for the input. (type: str ) |
Returns | The input. (type: str ) |
Return a Deferred
that
will be called back with a password. prompt is a string to display for the
password, or None for a generic 'user@hostname's password: '.
Returns | (type: defer.Deferred ) |
Get a public key from the key agent if possible, otherwise look in the next configured identity file for one.
Extend the base signing behavior by using an SSH agent to sign the data, if one is available.
Try to load the private key from the last used file identified by
getPublicKey
, potentially asking for the passphrase if the key
is encrypted.
Returns a Deferred
with
the responses to the promopts.
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. |
Open /dev/tty as two streams one in read, one in write mode, and return them.
Returns | File objects for reading and writing to /dev/tty, corresponding to standard
input and standard output. (type: A tuple
of io.TextIOWrapper
on Python 3. A tuple
of binary files on Python 2.) |