-
-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.9.5 doesn't work without defining password for redis anymore #219
Comments
I'd like to add more details about the issue that @jab3z described above. If there are no username and password in a redis url, IMO, a way should be added to specify username as |
I'm on Ubuntu 22.04 with a clean install of redis 6.0.16 and defender at 0.9.5. I can set |
@erdos4d forgot to mention, |
Hello, I haven't debugged why and how the error occurs, simply found the faulty package, checked the release log to not have major changes and reverted to the old version. Tested only locally with Redis running on docker, but the following URLs were throwing the error when login into admin:
Let me know if you'd like me to raise a PR with the fix. BR, |
That error happend to me too and also only on the production server. What I did was:
That's it. To see blocked users/ips:
To quick check, for example, if the user "admin" is blocked:
To quick unblock user "admin":
|
I am getting this error with django-defender 0.9.6 and redis 4.3.5. My Django is 3.2.16. |
What do you have for defender settings? Specifically "DEFENDER_REDIS_URL" and "DEFENDER_REDIS_NAME" ? |
Also, what version of redis server are you using? |
Redis server v=5.0.3 Not necessarily relevant, but the other settings in base.py are: |
Additional details: And the system is on Alma 8. Python version is 3.6.8. |
Here is the full traceback. Dump happens right when the initial login form loads. Well before user enters anything into the credentials field. Environment: Request Method: GET Django Version: 3.2.16 Traceback (most recent call last): During handling of the above exception (wrong number of arguments for 'auth' command), another exception occurred: Exception Type: DataError at /login/ |
@pmulgaonkar any chance you can try this version out? I think it will fix your issue, but not 100% #227 |
Sorry. I don't understand. You want me to pull the file [defender/connection.py] and replace the one in my current build? --p |
Try with the 'connection.py' file that is in that PR/branch on your local build, using your current redis server. Ken |
Tried it. Error went away and login was permitted. However defender does not trigger even after multiple incorrect password attempts. |
I'm glad the error went away, but I'm confused as to why defender isn't working. Does it work fine with the older version 0.9.4? |
Will revert version and try again, but we have been using defender successfully for a long time with defender 0.6.0. Now going through the process of upgrading along with redis and django, and started with 0.9.6. But downgrading to 0.9.4 also does not not work. No redis error, but defender functionality (blocking) does not happen. Probably something in my code since we are using a custom login function that we had to modify while upgrading django. (Old system was still on django 1.11) Probably something we are doing wrong. Will test and report. |
* fixing issue #219 don't add Redis username by default
At first look, that looks fine to me. Not sure why that isn't working. |
My previous comment vanished. I systematically redid the code and now everything is working, but with 0.9.4. Thanks for all your help @kencochrane Really appreciate it. |
Great, my fix has been merged into the master branch. Feel free to try that version, hopefully that works for you. I'll cut a new release this weekend when I get a chance. |
@pmulgaonkar @jab3z I released 0.9.7 with the fix for using Redis 5 with no password; see if that works for you. |
am having the same problem here, redis server activates the localhost url even when i hardcode the redis url from a managed redis server |
What versions are you using? |
Am using
redis == 5.0.0
django-redis == 5.3.0
django-defender == 0.9.7
The managed redis works just fine but the moment I start implementing
Django defender functionalities then it stops working. Like it loads the
localhost redis url...
This is happening in production environment and even in development
environment the managed redis url does not load....
…On Mon, Nov 20, 2023, 20:41 Ken Cochrane ***@***.***> wrote:
What versions are you using?
—
Reply to this email directly, view it on GitHub
<#219 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4I6IMGEHAY7WIO7NGYGMBDYFOP4TAVCNFSM5YNQQL42U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBRHE3DCMJUG42Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Noted that I have not provided the redis name and password since the
managed redis server only gives you the redis url....
…On Mon, Nov 20, 2023, 21:14 Hope Sain ***@***.***> wrote:
Am using
redis == 5.0.0
django-redis == 5.3.0
django-defender == 0.9.7
The managed redis works just fine but the moment I start implementing
Django defender functionalities then it stops working. Like it loads the
localhost redis url...
This is happening in production environment and even in development
environment the managed redis url does not load....
On Mon, Nov 20, 2023, 20:41 Ken Cochrane ***@***.***> wrote:
> What versions are you using?
>
> —
> Reply to this email directly, view it on GitHub
> <#219 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/A4I6IMGEHAY7WIO7NGYGMBDYFOP4TAVCNFSM5YNQQL42U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBRHE3DCMJUG42Q>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
|
And you don’t see any errors or messages in the logs at all? do you see the same error when running the version that is on the master branch? |
The error message I see is that ConnectionError
Error 10061 connecting to localhost:6379. No connection could be made
because the target machine actively refused it.
This happens even when I use a managed redis url.
Like instead of using the managed redis url then it uses the localhost..
…On Mon, Nov 20, 2023, 21:26 Ken Cochrane ***@***.***> wrote:
And you don’t see any errors or messages in the logs at all?
do you see the same error when running the version that is on the master
branch?
—
Reply to this email directly, view it on GitHub
<#219 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4I6IMAFZA7MT5UX6HOXST3YFOVGHAVCNFSM5YNQQL42U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBRHE3DMOBZGQ2A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Ok, do you see that same error using the latest version on the master branch? |
Yes, am seeing the same error. even with the latest versions. and it is a stressful experience... |
Ok, does your managed URL have any special characters in it? Could you post the config that you are using (mask out any sensitive info) so we can try and duplicate what you are seeing. |
One more question, how are you installing the latest version on master? |
i do not get this but am using pip install ... the statement am not fully getting 'One more question, how are you installing the latest version on master?' as for the caches.. and the answer is yes the url has special characters, just to be precise am using render.com managed redis. you can try it out it is completely free.... |
So you did
|
Have you tried to set the |
setting the DEFENDER_REDIS_URL, was all i wanted and everything now works fine, if anything then i will let you know.. in your documentation explicitly outline that DEFENDER_REDIS_URL has to be for the managed url or they have to set it clearly in production otherwise it loads default redis localhost. this will raise errors.... |
Hello!
After upgrading to 0.9.5 if no password defined for redis url will throw an error:
redis.exceptions.DataError: Invalid input of type: 'NoneType'. Convert to a bytes, string, int or float first.
redis.exceptions.AuthenticationWrongNumberOfArgsError: wrong number of arguments for 'auth' command
On 0.9.4 works fine.
BR,
Dacian
The text was updated successfully, but these errors were encountered: