[Twisted-Python] ssh manhole
Phil Christensen
phil at bubblehouse.org
Sun Jan 1 22:54:16 MST 2006
On Jan 1, 2006, at 9:40 PM, Jean-Paul Calderone wrote:
> Okay. You just need to implement a checker for IUsernamePassword,
> then. Add this to a portal wrapped around a realm that knows about
> IConchUsers and you should be set, as far as authentication goes.
>
> Take a look at twisted/conch/manhole_ssh.py for an idea of what
> needs to happen to hook manhole up to a conch server.
that was amazingly easy...not that i should be surprised. however,
i'm running into one little snafu. my realm creates a TerminalUser
instance like this:
def _getSSHAvatar(self, avatarId):
comp = components.Componentized()
user = manhole_ssh.TerminalUser(comp, avatarId)
sess = manhole_ssh.TerminalSession(comp)
sess.transportFactory = manhole_ssh.TerminalSessionTransport
sess.chainedProtocolFactory = insults.ServerProtocol
comp.setComponent(conch_interfaces.IConchUser, user)
comp.setComponent(conch_interfaces.ISession, sess)
return user
and returns it from requestAvatar with:
return conch_interfaces.IConchUser, self._getSSHAvatar
(avatarId), lambda: None
however, shortly thereafter i an exception, attached below. also, i
did find this comment in manhole_ssh.TerminalSessionTransport that i
was a bit confused by:
# XXX TODO
# chainedProtocol is supposed to be an ITerminalTransport,
# maybe. That means perhaps its terminalProtocol attribute is
# an ITerminalProtocol, it could be. So calling terminalSize
# on that should do the right thing But it'd be nice to clean
# this bit up.
self.chainedProtocol.terminalProtocol.terminalSize(width,
height)
I am running the latest svn-trunk as of this email. Any help would be
appreciated.
-phil
00:41 EST [SSHServerTransport,0,127.0.0.1] kex alg, key alg: diffie-
hellman-group1-sha1 ssh-rsa
00:41 EST [SSHServerTransport,0,127.0.0.1] server->client: aes128-cbc
hmac-md5 none
00:41 EST [SSHServerTransport,0,127.0.0.1] client->server: aes128-cbc
hmac-md5 none
00:41 EST [SSHServerTransport,0,127.0.0.1] starting service ssh-userauth
00:41 EST [SSHService ssh-userauth on SSHServerTransport,0,127.0.0.1]
wizard trying auth none
00:41 EST [SSHService ssh-userauth on SSHServerTransport,0,127.0.0.1]
wizard trying auth password
00:41 EST [SSHService ssh-userauth on SSHServerTransport,0,127.0.0.1]
wizard authenticated with password
00:41 EST [SSHService ssh-userauth on SSHServerTransport,0,127.0.0.1]
starting service ssh-connection
00:41 EST [SSHService ssh-connection on SSHServerTransport,
0,127.0.0.1] got channel session request
00:41 EST [SSHChannel session (0) on SSHService ssh-connection on
SSHServerTransport,0,127.0.0.1] channel open
00:41 EST [SSHChannel session (0) on SSHService ssh-connection on
SSHServerTransport,0,127.0.0.1] pty request: ansi (48L, 80L, 480L, 672L)
00:41 EST [SSHChannel session (0) on SSHService ssh-connection on
SSHServerTransport,0,127.0.0.1] getting shell
00:41 EST [SSHChannel session (0) on SSHService ssh-connection on
SSHServerTransport,0,127.0.0.1] Traceback (most recent call last):
File "/[python home snipped]/twisted/python/log.py", line 38, in
callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/[python home snipped]/twisted/python/context.py", line 59,
in callWithContext
return self.currentContext().callWithContext(ctx, func, *args,
**kw)
File "/[python home snipped]/twisted/python/context.py", line 37,
in callWithContext
return func(*args,**kw)
File "/[python home snipped]/twisted/conch/ssh/channel.py", line
97, in requestReceived
return f(data)
--- <exception caught here> ---
File "/[python home snipped]/twisted/conch/ssh/session.py", line
52, in request_shell
self.session.openShell(pp)
File "/[python home snipped]/twisted/conch/manhole_ssh.py", line
75, in openShell
self.width, self.height)
File "/[python home snipped]/twisted/conch/manhole_ssh.py", line
60, in __init__
self.chainedProtocol.terminalProtocol.terminalSize(width, height)
exceptions.AttributeError: 'NoneType' object has no attribute
'terminalSize'
More information about the Twisted-Python
mailing list