Provide ICredentialsChecker implementations to be used in Conch protocols.

Function verifyCryptedPassword Check that the password, when crypted, matches the stored crypted password.
Class UNIXPasswordDatabase A checker which validates users out of the UNIX password databases, or databases of a compatible format.
Class SSHPublicKeyDatabase Checker that authenticates SSH public keys, based on public keys listed in authorized_keys and authorized_keys2 files in user .ssh/ directories.
Class SSHProtocolChecker SSHProtocolChecker is a checker that requires multiple authentications to succeed. To add a checker, call my registerChecker method with the checker and the interface.
Interface IAuthorizedKeysDB An object that provides valid authorized ssh keys mapped to usernames.
Function readAuthorizedKeyFile Reads keys from an authorized keys file. Any non-comment line that cannot be parsed as a key will be ignored, although that particular line will be logged.
Class InMemorySSHKeyDB Object that provides SSH public keys based on a dictionary of usernames mapped to twisted.conch.ssh.keys.Keys.
Class UNIXAuthorizedKeysFiles No summary
Class SSHPublicKeyChecker Checker that authenticates SSH public keys, based on public keys listed in authorized_keys and authorized_keys2 files in user .ssh/ directories.
Function _pwdGetByName Look up a user in the /etc/passwd database using the pwd module. If the pwd module is not available, return None.
Function _shadowGetByName Look up a user in the /etc/shadow database using the spwd module. If it is not available, return None.
Function _keysFromFilepaths Helper function that turns an iterable of filepaths into a generator of keys. If any file cannot be read, a message is logged but it is otherwise ignored.
def verifyCryptedPassword(crypted, pw):

Check that the password, when crypted, matches the stored crypted password.

ParameterscryptedThe stored crypted password. (type: str)
pwThe password the user has given. (type: str)
Returns (type: bool)
def _pwdGetByName(username):

Look up a user in the /etc/passwd database using the pwd module. If the pwd module is not available, return None.

Parametersusernamethe username of the user to return the passwd database information for. (type: str)
def _shadowGetByName(username):

Look up a user in the /etc/shadow database using the spwd module. If it is not available, return None.

Parametersusernamethe username of the user to return the shadow database information for. (type: str)
def readAuthorizedKeyFile(fileobj, parseKey=keys.Key.fromString):

Reads keys from an authorized keys file. Any non-comment line that cannot be parsed as a key will be ignored, although that particular line will be logged.

Parametersfileobjsomething from which to read lines which can be parsed as keys (type: file-like object)
parseKeya callable that takes a string and returns a twisted.conch.ssh.keys.Key, mainly to be used for testing. The default is twisted.conch.ssh.keys.Key.fromString. (type: callable)
Returnsan iterable of twisted.conch.ssh.keys.Key (type: iterable)
Present Since15.0
def _keysFromFilepaths(filepaths, parseKey):

Helper function that turns an iterable of filepaths into a generator of keys. If any file cannot be read, a message is logged but it is otherwise ignored.

Parametersfilepathsiterable of twisted.python.filepath.FilePath. (type: iterable)
parseKeya callable that takes a string and returns a twisted.conch.ssh.keys.Key (type: callable)
Returnsgenerator of twisted.conch.ssh.keys.Key (type: generator)
Present Since15.0
API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.