Search code examples
pythonsshtwisted

twisted conch, overriding authentication


I have been trying to override the default authentication scheme in a twisted conch module. Something that I thought I understood how to do. The script itself is the answer to this question. I am subclassing SSHUserAuthClient in the following way:

class ClientUserAuth(SSHUserAuthClient):
    def getPassword(self, prompt = None):
        return defer.succeed("*****")

and I am obviously replacing the SSHUserAuthClient call with a call to my class in the script. For reasons I can't understand the script is not executing the getPassword method in my class but the superclass getPassword method. Does anyone know what I am doing wrong? The only other change to the script I made is I added the following module import

from twisted.internet import defer

Thanks!

EDIT: Strangely the subclass method getPublicKey is being called correctly. It is just the getPassword method that is acting weird.


Solution

  • You're probably actually seeing keyboard-interactive authentication taking place. This is like password authentication, but separate. The reason you see different behavior between Linux and OS X is just that your Linux and OS X SSH servers are configured differently.

    Override getGenericAnswers to handle this one.