jasmin icon indicating copy to clipboard operation
jasmin copied to clipboard

Redis AUTH error when receiving multi-part sms

Open lauer opened this issue 3 years ago • 7 comments

I get this error in /var/www/jasmin/message.log when receiving a large sms with multi parts.

2022-02-10 12:24:10 CRITICAL 1 Got an unknown exception (<class 'txredisapi.ResponseError'>): NOAUTH Authentication required.

There are no problems when the sms can be in one part. The /var/log/jenkins/redis-client.log shows it tried to write to the redis.

2022-02-10 12:24:10 DEBUG    1 Executing redis command: ('HSET', "longDeliverSm:..
2022-02-10 12:24:11 DEBUG    1 Executing redis command: ('HSET', "longDeliverSm:...
2022-02-10 12:24:11 DEBUG    1 Executing redis command: ('HSET', "longDeliverSm:...
2022-02-10 12:24:11 DEBUG    1 Executing redis command: ('HSET', "longDeliverSm:...
2022-02-10 12:24:12 DEBUG    1 Executing redis command: ('HSET', "longDeliverSm:...

And it does not seem like it has stored the value. (which make sense with the error)

The password set in [redis-client] works fine when testing from the server

lauer avatar Feb 10 '22 12:02 lauer

I have fixed the issue in my setup

https://github.com/jookies/jasmin/blob/16c54261a6a1a82db64311ee2a235f6c966c14ab/jasmin/redis/client.py#L42

If I add the configured password to my Redis server here the connection is established correctly.

redis.RedisFactory.__init__(self, uuid, dbid, poolsize, isLazy, handler, password=config.password)

I am not a python programmer, so I would have a hard time making a nice pull request, but maybe someone else can? I guess there should be some checks before this assignment.

lauer avatar Feb 11 '22 08:02 lauer

Hi @lauer, witch version of Python / Jasmin are you using? We've an error "NOAUTH Authentication required." if we use a redis password. The error doesn't get logged and can be found with the command "systemctl status jasmind" but is real. Not exactly your issue but I tried your solution and I've got the error: "Cannot start RedisClient: init() got an unexpected keyword argument 'password'". I tried also to remove "password=" leaving "config.password" as 7th param but I got "Cannot start RedisClient: init() takes at most 6 arguments (7 given)" so... if your client is working with 7 partameters, it should be a different version... (I'm using jasmin 0.9.31 with python 2.7)

magojr avatar Feb 11 '22 09:02 magojr

We are using Jasmin 0.10.9 and python 3.10. But I guess the version of txredisapi~=1.4.7 is more important because that is the Redis client used here.

lauer avatar Feb 11 '22 11:02 lauer

@magojr You can also try if the module works with password params in a simple script like this

#!/usr/bin/env python
# coding: utf-8

import txredisapi as redis

from twisted.internet import defer
from twisted.internet import reactor


@defer.inlineCallbacks
def main():
    rc = yield redis.Connection('redis', 6379, password='yourpassword')
    print(rc)

    yield rc.set("foo", "bar")
    v = yield rc.get("foo")
    print("foo:", repr(v))

    yield rc.disconnect()

if __name__ == "__main__":
    main().addCallback(lambda ign: reactor.stop())
    reactor.run()

lauer avatar Feb 11 '22 13:02 lauer

Thank you, I tried it but, as expected, it's not working on my version; error: "got an unexpected keyword argument 'password'" The txredisapi included in my Jasmin package is v.1.0 so it doesn't support that parameter. But only an auth call after the connection...

Thank you anyway.

magojr avatar Feb 14 '22 11:02 magojr

Thanks to @paradiseng, he pushed a pr (#1027) to fix this, will be released in jasmin 0.10.10

farirat avatar Feb 23 '22 23:02 farirat

Stale issue detected, remove stale label or comment or this will be closed soon.

github-actions[bot] avatar Feb 24 '24 01:02 github-actions[bot]

This issue was closed because it has been stalled more than a year with no activity.

github-actions[bot] avatar Apr 09 '24 02:04 github-actions[bot]