matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.81k stars 2.13k forks source link

Synapse borks on login #884

Closed killua-eu closed 8 years ago

killua-eu commented 8 years ago

Uh, sorry for all the new tickets, but i keep hitting walls today. I created the root user, but when authenticating (using the vector-web client), i get an error: There was a problem logging in. (HTTP 500). Corresponding log entry:

2016-06-19 21:22:48,886 - synapse.access.https.8448 - 59 - INFO - OPTIONS-7- 192.168.1.1 - 8448 - Received request: OPTIONS /_matrix/client/r0/login?
2016-06-19 21:22:48,887 - synapse.access.https.8448 - 91 - INFO - OPTIONS-7- 192.168.1.1 - 8448 - {None} Processed request: 1ms (4ms, 0ms) (0ms/0) 22B 200 "OPTIONS /_matrix/client/r0/login? HTTP/1.1" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
2016-06-19 21:22:48,955 - synapse.access.https.8448 - 59 - INFO - POST-8- 192.168.1.1 - 8448 - Received request: POST /_matrix/client/r0/login?
2016-06-19 21:22:48,957 - synapse.http.server - 135 - ERROR - POST-8- Failed handle request synapse.http.server._async_render on <synapse.rest.ClientRestResource object at 0x7f22deaabf50>: <SynapseRequest at 0x7f22de4e4d40 method=POST uri=/_matrix/client/r0/login? clientproto=HTTP/1.1 site=8448>
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/synapse/http/server.py", line 114, in wrapped_request_handler
    yield request_handler(self, request)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1126, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/python2.7/dist-packages/synapse/http/server.py", line 260, in _async_render
    callback_return = yield callback(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1126, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/python2.7/dist-packages/synapse/rest/client/v1/login.py", line 96, in on_POST
    result = yield self.do_password_login(login_submission)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1126, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/python2.7/dist-packages/synapse/rest/client/v1/login.py", line 150, in do_password_login
    password=login_submission["password"])
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1126, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/python2.7/dist-packages/synapse/handlers/auth.py", line 361, in login_with_password
    if not (yield self._check_password(user_id, password)):
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1126, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/python2.7/dist-packages/synapse/handlers/auth.py", line 439, in _check_password
    valid_local_password = yield self._check_local_password(user_id, password)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1128, in _inlineCallbacks
    result = g.send(result)
  File "/usr/lib/python2.7/dist-packages/synapse/handlers/auth.py", line 449, in _check_local_password
    defer.returnValue(self.validate_hash(password, password_hash))
  File "/usr/lib/python2.7/dist-packages/synapse/handlers/auth.py", line 629, in validate_hash
    return bcrypt.hashpw(password, stored_hash) == stored_hash
  File "/usr/lib/python2.7/dist-packages/bcrypt/__init__.py", line 57, in hashpw
    raise TypeError("Unicode-objects must be encoded before hashing")
TypeError: Unicode-objects must be encoded before hashing
2016-06-19 21:22:48,959 - synapse.access.https.8448 - 91 - INFO - POST-8- 192.168.1.1 - 8448 - {None} Processed request: 4ms (0ms, 0ms) (0ms/1) 67B 500 "POST /_matrix/client/r0/login? HTTP/1.1" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
2016-06-19 21:22:52,056 - synapse.handlers.presence - 286 - INFO - - Handling presence timeouts
2016-06-19 21:22:52,056 - synapse.util.metrics - 67 - WARNING - - Entered Measure without log context: presence_handle_timeouts
2016-06-19 21:22:52,057 - synapse.util.metrics - 67 - WARNING - - Entered Measure without log context: presence_update_states
ara4n commented 8 years ago

was this trying to use non-ascii characters in the password?

killua-eu commented 8 years ago

nope, plain good old ascii.

killua-eu commented 8 years ago

I set up an ansible playbook https://github.com/Vaizard/mage.matrix-stack to create a repeatable environment where this fails.

killua-eu commented 8 years ago

works with current version, thanks lots :)