jquast / x84

A python telnet/ssh server for modern terminals. In spirit of classic software such as ami/x, teleguard, renegade, iniquity.
http://x84.readthedocs.org/
Other
373 stars 56 forks source link

SSH login throws exception in session.py #114

Closed ghost closed 10 years ago

ghost commented 10 years ago

Hello everyone, I just pulled all the recent changes today and was curious about the new SSH login mechanism. Unfortunately, there seems to be an issue within session.py. Here's the DEBUG log:

loading /home/x84/.x84/logging.ini Mon-09-01 11:56AM INFO telnet.py:1069 listening on 0.0.0.0:6023/tcp Mon-09-01 11:56AM DEBUG ssh.py:477 Loaded host key /home/x84/.x84/ssh_host_rsa_key Mon-09-01 11:56AM INFO ssh.py:491 listening on 0.0.0.0:6022/tcp Mon-09-01 11:56AM INFO client.py:45 new SshClient: 192.168.200.10:47494 Mon-09-01 11:56AM INFO engine.py:319 ssh connection from 192.168.200.10:47494 _Thread-1). Mon-09-01 11:56AM DEBUG transport.py:1269 starting thread (server mode): 0xb6f5246cL Mon-09-01 11:56AM INFO transport.py:1269 Connected (version 2.0, client OpenSSH_5.3) Mon-09-01 11:56AM DEBUG transport.py:1269 kex algos:[u'diffie-hellman-group-exchange-sha256', u'diffie-hellman-group-exchange-sha1', u'diffie-hellman-group14-sha1', u'diffie-hellman-group1-sha1'] server key:[u'ssh-rsa-cert-v01@openssh.com', u'ssh-dss-cert-v01@openssh.com', u'ssh-rsa-cert-v00@openssh.com', u'ssh-dss-cert-v00@openssh.com', u'ssh-rsa', u'ssh-dss'] client encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour', u'rijndael-cbc@lysator.liu.se'] server encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour', u'rijndael-cbc@lysator.liu.se'] client mac:[u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-md5-96'] server mac:[u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-md5-96'] client compress:[u'none', u'zlib@openssh.com', u'zlib'] server compress:[u'none', u'zlib@openssh.com', u'zlib'] client lang:[u''] server lang:[u''] kex follows?False Mon-09-01 11:56AM DEBUG transport.py:1269 Ciphers agreed: local=aes128-ctr, remote=aes128-ctr Mon-09-01 11:56AM DEBUG transport.py:1269 using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote aes128-ctr; mac: local hmac-md5, remote hmac-md5; compression: local none, remote none Mon-09-01 11:56AM DEBUG transport.py:1269 Switch to new keys ... Mon-09-01 11:56AM DEBUG transport.py:1269 Auth request (type=none) service=ssh-connection, username=megagumbo Mon-09-01 11:56AM INFO transport.py:1269 Auth rejected (none). Mon-09-01 11:56AM DEBUG transport.py:1269 Auth request (type=password) service=ssh-connection, username=megagumbo Mon-09-01 11:56AM INFO sqlitedict.py:96 opening Sqlite table 'unnamed' in /home/x84/.x84/data/userbase.sqlite3 Mon-09-01 11:56AM DEBUG sqlitedict.py:200 closing SqliteDict(/home/x84/.x84/data/userbase.sqlite3) Mon-09-01 11:56AM INFO sqlitedict.py:96 opening Sqlite table 'unnamed' in /home/x84/.x84/data/userbase.sqlite3 Mon-09-01 11:56AM DEBUG sqlitedict.py:200 closing SqliteDict(/home/x84/.x84/data/userbase.sqlite3) Mon-09-01 11:56AM DEBUG ssh.py:259 password accepted for user u'megagumbo'. Mon-09-01 11:56AM INFO transport.py:1269 Auth granted (password). Mon-09-01 11:56AM DEBUG channel.py:1068 [chan 1] Max packet in: 34816 bytes Mon-09-01 11:56AM DEBUG channel.py:1068 [chan 1] Max packet out: 16384 bytes Mon-09-01 11:56AM INFO transport.py:1269 Secsh channel 1 (session) opened. Mon-09-01 11:56AM DEBUG ssh.py:335 env request: [LANG] = de_DE.UTF-8 Mon-09-01 11:56AM DEBUG ssh.py:189 192.168.200.10:47494: waiting for shell request Mon-09-01 11:56AM DEBUG terminal.py:152 registered tty: ssh-192.168.200.10:47494 Mon-09-01 11:56AM DEBUG terminal.py:152 registered tty: ssh-192.168.200.10:47494 Mon-09-01 11:56AM INFO terminal.py:97 None[192.168.200.10:47494] terminal type is 'xterm' Mon-09-01 11:56AM INFO terminal.py:43 anonymous[192.168.200.10:47494] keyboard encoding is 'utf8' Mon-09-01 11:56AM DEBUG session.py:368 anonymous[192.168.200.10:47494] script_stack is [Script(name='matrix', args=(), kwargs={'username': u'megagumbo', 'new': False, 'anonymous': False})] Mon-09-01 11:56AM INFO session.py:644 anonymous[192.168.200.10:47494] runscript name=matrix Mon-09-01 11:56AM DEBUG session.py:323 anonymous[192.168.200.10:47494] sys.path[0] <- '/home/x84/src/x84/x84/default' Mon-09-01 11:56AM ERROR session.py:396 anonymous[192.168.200.10:47494] File "x84/bbs/session.py", line 370, in run Mon-09-01 11:56AM ERROR session.py:396 anonymous[192.168.200.10:47494] self.runscript(self._script_stack.pop()) Mon-09-01 11:56AM ERROR session.py:396 anonymous[192.168.200.10:47494] Mon-09-01 11:56AM ERROR session.py:396 anonymous[192.168.200.10:47494] File "x84/bbs/session.py", line 662, in runscript Mon-09-01 11:56AM ERROR session.py:396 anonymous[192.168.200.10:47494] value = module.main(_script.args, **script.kwargs) Mon-09-01 11:56AM ERROR session.py:396 anonymous[192.168.200.10:47494] Mon-09-01 11:56AM ERROR session.py:396 anonymous[192.168.200.10:47494] TypeError: main() takes no arguments (3 given) Mon-09-01 11:56AM ERROR session.py:351 anonymous[192.168.200.10:47494] stop after general exception in matrix Mon-09-01 11:56AM DEBUG session.py:403 anonymous[192.168.200.10:47494] End of script stack. Mon-09-01 11:56AM DEBUG channel.py:1068 [chan 1] EOF sent (1) Mon-09-01 11:56AM DEBUG ssh.py:53 192.168.200.10:47494: channel shutdown SshClient Mon-09-01 11:56AM DEBUG transport.py:1269 EOF in transport thread Mon-09-01 11:56AM DEBUG ssh.py:58 192.168.200.10:47494: transport shutdown SshClient Mon-09-01 11:56AM DEBUG terminal.py:172 unregistered tty: ssh-192.168.200.10:47494 Mon-09-01 11:56AM DEBUG ssh.py:53 192.168.200.10:47494: channel shutdown SshClient

jquast commented 10 years ago

from CHANGES

  - *new* option, 'script_ssh' in section 'matrix', points to a new
    login matrix script that takes new keyword arguments, 'anonymous',
    or 'new' as booleans True or False, or user keyword argument as
    string representing the (already authenticated) user handle.

I think you have this value as "matrix", change it to "matrix_ssh" and you should be good to go.

We had you manually change this earlier, because 'matrix_ssh.py' did not exist yet -- but it does now! And yes, it takes some new keyword arguments, so that you can ssh new@, anonymous@, etc.

jquast commented 10 years ago

also, I just pushed a large set of changes again :)

got some good momentum this weekend, hope to round out a lot of changes by the end of the weekend.

ghost commented 10 years ago

Confirmed, had to set option 'script_ssh' in matrix section. Should've looked at the CHANGES doc first. Will close this issue.