jookies / jasmin

Jasmin - Open source SMS gateway
http://jasminsms.com
Other
1.04k stars 555 forks source link

Redis AUTH error when receiving multi-part sms #1025

Closed lauer closed 6 months ago

lauer commented 2 years ago

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 commented 2 years ago

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.

magojr commented 2 years ago

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)

lauer commented 2 years ago

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 commented 2 years ago

@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()
magojr commented 2 years ago

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.

farirat commented 2 years ago

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

github-actions[bot] commented 8 months ago

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

github-actions[bot] commented 6 months ago

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