class documentation

class SSHUserAuthClient(userauth.SSHUserAuthClient): (source)

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method get​Generic​Answers Returns a Deferred with the responses to the promopts.
Method get​Password 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 get​Private​Key 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 get​Public​Key Get a public key from the key agent if possible, otherwise look in the next configured identity file for one.
Method service​Started called when the service is active on the transport.
Method service​Stopped called when the service is stopped, either by the connection ending or by another service being started
Method sign​Data Extend the base signing behavior by using an SSH agent to sign the data, if one is available.
Instance Variable key​Agent Undocumented
Instance Variable options Undocumented
Instance Variable used​Files Undocumented
Class Method _open​Tty Open /dev/tty as two streams one in read, one in write mode, and return them.
Class Method _replace​Stdout​Stdin Contextmanager that replaces stdout and stdin with /dev/tty and resets them when it is done.
Method _eb​Set​Agent Undocumented
Method _get​Password Prompt for a password using getpass.getpass.
Method _set​Agent Undocumented

Inherited from SSHUserAuthClient:

Method ask​For​Auth Send a MSG_USERAUTH_REQUEST.
Method auth​_keyboard​_interactive Try to authenticate with keyboard-interactive authentication. Send the request to the server and return True.
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​_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 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_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 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_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_​SUCCESS We received a MSG_USERAUTH_SUCCESS. The server has accepted our authentication, so start the next service.
Method try​Auth Dispatch to an authentication method.
Instance Variable authenticated​With a list of strings of authentication methods we've tried
Instance Variable instance the service to start after authentication has finished
Instance Variable last​Auth Undocumented
Instance Variable last​Public​Key the last public key object we've tried to authenticate with
Instance Variable name the name of this service: 'ssh-userauth'
Instance Variable preferred​Order a list of authentication methods that should be used first, in order of preference, if supported by the server
Instance Variable tried​Public​Keys a list of public key objects that we've tried to authenticate with
Instance Variable user the name of the user to authenticate as
Method _cb​Generic​Answers Called back when we are finished answering keyboard-interactive questions. Send the info back to the server in a MSG_USERAUTH_INFO_RESPONSE.
Method _cb​Get​Public​Key Undocumented
Method _cb​Password Called back when the user gives a password. Send the request to the server.
Method _cb​Sign​Data Called back when the private key is returned. Sign the data and return the signature.
Method _cb​Signed​Data Called back out of self.signData with the signed data. Send the authentication request with the signature.
Method _cb​Userauth​Failure Undocumented
Method _eb​Auth Generic callback for a failed authentication attempt. Respond by asking for the list of accepted methods (the 'none' method)
Method _set​New​Pass Called back when we are choosing a new password. Get the old password and send the authentication message with both.
Method _set​Old​Pass Called back when we are choosing a new password. Simply store the old password for now.
Instance Variable _new​Pass Undocumented
Instance Variable _old​Pass Undocumented

Inherited from SSHService (via SSHUserAuthClient):

Method log​Prefix Undocumented
Method packet​Received called when we receive a packet on the transport
Class Variable protocol​Messages Undocumented
Class Variable transport Undocumented
Class Variable _log Undocumented
def __init__(self, user, options, *args): (source)
def getGenericAnswers(self, name, instruction, prompts): (source)
Returns a Deferred with the responses to the promopts.
Parameters
nameThe name of the authentication currently in progress.
instructionDescribes what the authentication wants.
promptsA 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.
def getPassword(self, prompt=None): (source)
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: '.
Parameters
prompt:bytes/NoneUndocumented
Returns
defer.DeferredUndocumented
def getPrivateKey(self): (source)
Try to load the private key from the last used file identified by getPublicKey, potentially asking for the passphrase if the key is encrypted.
def getPublicKey(self): (source)
Get a public key from the key agent if possible, otherwise look in the next configured identity file for one.
def serviceStarted(self): (source)
called when the service is active on the transport.
def serviceStopped(self): (source)
called when the service is stopped, either by the connection ending or by another service being started
def signData(self, publicKey, signData): (source)
Extend the base signing behavior by using an SSH agent to sign the data, if one is available.
Parameters
public​Key:KeyUndocumented
sign​Data:bytesUndocumented
keyAgent = (source)

Undocumented

options = (source)

Undocumented

usedFiles: list = (source)

Undocumented

@classmethod
def _openTty(cls): (source)
Open /dev/tty as two streams one in read, one in write mode, and return them.
Returns
A tuple of io.TextIOWrapper on Python 3.File objects for reading and writing to /dev/tty, corresponding to standard input and standard output.
@classmethod
@contextlib.contextmanager
def _replaceStdoutStdin(cls): (source)
Contextmanager that replaces stdout and stdin with /dev/tty and resets them when it is done.
def _ebSetAgent(self, f): (source)

Undocumented

def _getPassword(self, prompt): (source)
Prompt for a password using getpass.getpass.
Parameters
prompt:strWritten on tty to ask for the input.
Returns
strThe input.
def _setAgent(self, a): (source)

Undocumented