Crash when unknown packet comes too early
Closed this issue · 3 comments
GoogleCodeExporter commented
When an unknown packet arrives before the client logged in, the current honssh
crashes, because the session-log is not available:
2014-03-02 06:46:52+0100 [Uninitialized] New client connection
2014-03-02 06:46:52+0100 [HonsshClientTransport,client] kex alg, key alg:
diffie-hellman-group-exchange-sha1 ssh-rsa
2014-03-02 06:46:52+0100 [HonsshClientTransport,client] outgoing: aes256-ctr
hmac-sha1 none
2014-03-02 06:46:52+0100 [HonsshClientTransport,client] incoming: aes256-ctr
hmac-sha1 none
2014-03-02 06:46:52+0100 [HonsshClientTransport,client] REVERSE
2014-03-02 06:46:52+0100 [HonsshClientTransport,client] NEW KEYS
2014-03-02 06:46:52+0100 [HonsshClientTransport,client] Client Connection
Secured
2014-03-02 06:46:53+0100 [HonsshServerTransport,8,183.44.100.88] kex alg, key
alg: diffie-hellman-group1-sha1 ssh-rsa
2014-03-02 06:46:53+0100 [HonsshServerTransport,8,183.44.100.88] outgoing:
aes256-ctr hmac-sha1 none
2014-03-02 06:46:53+0100 [HonsshServerTransport,8,183.44.100.88] incoming:
aes256-ctr hmac-sha1 none
2014-03-02 06:46:53+0100 [HonsshServerTransport,8,183.44.100.88] NEW KEYS
2014-03-02 06:46:53+0100 [HonsshServerTransport,8,183.44.100.88] SERVER:
MessageNum: 5 Encrypted '\x00\x00\x00\x0cssh-userauth'
2014-03-02 06:46:53+0100 [HonsshClientTransport,client] CLIENT: MessageNum: 6
Encrypted '\x00\x00\x00\x0cssh-userauth'
2014-03-02 06:46:53+0100 [HonsshServerTransport,8,183.44.100.88] SERVER:
MessageNum: 50 Encrypted
'\x00\x00\x00\x04root\x00\x00\x00\x0essh-connection\x00\x00\x00\x04none'
2014-03-02 06:46:53+0100 [HonsshClientTransport,client] CLIENT: MessageNum: 51
Encrypted '\x00\x00\x00\x12publickey,password\x00'
2014-03-02 06:46:54+0100 [HonsshServerTransport,8,183.44.100.88] SERVER:
MessageNum: 50 Encrypted
'\x00\x00\x00\x04root\x00\x00\x00\x0essh-connection\x00\x00\x00\x08password\x00\
x00\x00\x00\x06123456'
2014-03-02 06:46:54+0100 [HonsshServerTransport,8,183.44.100.88] Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 88, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 73, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 215, in doRead
return self._dataReceived(data)
File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 221, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/usr/lib/python2.7/dist-packages/twisted/conch/ssh/transport.py", line 438, in dataReceived
self.dispatchMessage(messageNum, packet[1:])
File "/home/hooster/honssh/honssh/server.py", line 187, in dispatchMessage
txtlog.log(self.txtlog_file, "Unknown SSH Packet detected - Please raise a HonSSH issue on google code with the details: %s - %s" % (str(messageNum), repr(payload)))
File "/home/hooster/honssh/honssh/txtlog.py", line 40, in log
f = file(logfile, 'a')
exceptions.IOError: [Errno 2] No such file or directory: 'sessions/183.44.100.88/20140302_064652.log'
2014-03-02 06:46:54+0100 [HonsshServerTransport,8,183.44.100.88] connection lost
Original issue reported on code.google.com by flofriha...@gmail.com
on 2 Mar 2014 at 11:02
GoogleCodeExporter commented
Ah, of course. Whoops.
Original comment by tnn...@googlemail.com
on 2 Mar 2014 at 11:32
- Changed state: Accepted
GoogleCodeExporter commented
Original comment by tnn...@googlemail.com
on 2 Mar 2014 at 12:12
- Changed state: Started
GoogleCodeExporter commented
Should be fixed in the latest commit.
We now create the log file before trying to write to it :D
Original comment by tnn...@googlemail.com
on 2 Mar 2014 at 12:30
- Changed state: Fixed