class documentation

class SSHUserAuthServer(service.SSHService): (source)

View In Hierarchy

A service implementing the server side of the 'ssh-userauth' service. It is used to authenticate the user on the other side as being able to access this server.
Method auth​_password Password authentication. Payload:: string password
Method auth​_publickey No summary
Method service​Started No summary
Method service​Stopped Called when the userauth service is stopped. Cancel the login timeout if it's still going.
Method ssh_​USERAUTH_​REQUEST No summary
Method timeout​Authentication Called when the user has timed out on authentication. Disconnect with a DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE message.
Method try​Auth Try to authenticate the user with the given method. Dispatches to a auth_* method.
Instance Variable attempts​Before​Disconnect the number of failed login attempts we allow before disconnecting.
Instance Variable authenticated​With a list of authentication methods that have already been used.
Instance Variable clock an object with a callLater method. Stubbed out for testing.
Instance Variable interface​To​Method a dict mapping credential interfaces to authentication methods. The server checks to see which of the cred interfaces have checkers and tells the client that those methods are valid for authentication.
Instance Variable login​Attempts the number of login attempts that have been made
Instance Variable login​Timeout the number of seconds we wait before disconnecting the user for taking too long to authenticate
Instance Variable method the current authentication method
Instance Variable name the name of this service: 'ssh-userauth'
Instance Variable next​Service the service the user wants started after authentication has been completed.
Instance Variable password​Delay the number of seconds to delay when the user gives an incorrect password
Instance Variable portal the twisted.cred.portal.Portal we are using for authentication
Instance Variable supported​Authentications A list of the supported authentication methods.
Instance Variable user the last username the client tried to authenticate with
Method _cb​Finished​Auth The callback when user has successfully been authenticated. For a description of the arguments, see twisted.cred.portal.Portal.login. We start the service requested by the user.
Method _eb​Bad​Auth No summary
Method _eb​Check​Key Called back if the user did not sent a signature. If reason is error.ValidPublicKey then this key is valid for the user to authenticate with. Send MSG_USERAUTH_PK_OK.
Method _eb​Maybe​Bad​Auth An intermediate errback. If the reason is error.NotEnoughAuthentication, we send a MSG_USERAUTH_FAILURE, but with the partial success indicator set.
Method _eb​Password If the password is invalid, wait before sending the failure in order to delay brute-force password guessing.
Class Variable _log Undocumented
Instance Variable _cancel​Login​Timeout Undocumented

Inherited from SSHService:

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
def auth_password(self, packet): (source)

Password authentication. Payload:

    string password

Make a UsernamePassword credential and verify it with our portal.

def auth_publickey(self, packet): (source)

Public key authentication. Payload:

    byte has signature
    string algorithm name
    string key blob
    [string signature] (if has signature is True)

Create a SSHPublicKey credential and verify it using our portal.

def serviceStarted(self): (source)
Called when the userauth service is started. Set up instance variables, check if we should allow password authentication (only allow if the outgoing connection is encrypted) and set up a login timeout.
def serviceStopped(self): (source)
Called when the userauth service is stopped. Cancel the login timeout if it's still going.
def ssh_USERAUTH_REQUEST(self, packet): (source)

The client has requested authentication. Payload:

    string user
    string next service
    string method
    <authentication specific data>
Parameters
packet:bytesUndocumented
def timeoutAuthentication(self): (source)
Called when the user has timed out on authentication. Disconnect with a DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE message.
def tryAuth(self, kind, user, data): (source)
Try to authenticate the user with the given method. Dispatches to a auth_* method.
Parameters
kind:bytesthe authentication method to try.
user:bytesthe username the client is authenticating with.
data:bytesauthentication specific data sent by the client.
Returns
defer.DeferredA Deferred called back if the method succeeded, or erred back if it failed.
attemptsBeforeDisconnect: int = (source)
the number of failed login attempts we allow before disconnecting.
authenticatedWith: list = (source)
a list of authentication methods that have already been used.
clock = (source)
an object with a callLater method. Stubbed out for testing.
interfaceToMethod: dict = (source)
a dict mapping credential interfaces to authentication methods. The server checks to see which of the cred interfaces have checkers and tells the client that those methods are valid for authentication.
loginAttempts: int = (source)
the number of login attempts that have been made
loginTimeout: int = (source)
the number of seconds we wait before disconnecting the user for taking too long to authenticate
method: bytes = (source)
the current authentication method
the name of this service: 'ssh-userauth'
nextService: bytes = (source)
the service the user wants started after authentication has been completed.
passwordDelay: int = (source)
the number of seconds to delay when the user gives an incorrect password
the twisted.cred.portal.Portal we are using for authentication
supportedAuthentications: list of bytes = (source)
A list of the supported authentication methods.
the last username the client tried to authenticate with
def _cbFinishedAuth(self, result): (source)
The callback when user has successfully been authenticated. For a description of the arguments, see twisted.cred.portal.Portal.login. We start the service requested by the user.
def _ebBadAuth(self, reason): (source)
The final errback in the authentication chain. If the reason is error.IgnoreAuthentication, we simply return; the authentication method has sent its own response. Otherwise, send a failure message and (if the method is not 'none') increment the number of login attempts.
Parameters
reason:twisted.python.failure.FailureUndocumented
def _ebCheckKey(self, reason, packet): (source)
Called back if the user did not sent a signature. If reason is error.ValidPublicKey then this key is valid for the user to authenticate with. Send MSG_USERAUTH_PK_OK.
def _ebMaybeBadAuth(self, reason): (source)
An intermediate errback. If the reason is error.NotEnoughAuthentication, we send a MSG_USERAUTH_FAILURE, but with the partial success indicator set.
Parameters
reason:twisted.python.failure.FailureUndocumented
def _ebPassword(self, f): (source)
If the password is invalid, wait before sending the failure in order to delay brute-force password guessing.
_cancelLoginTimeout = (source)

Undocumented