-
Notifications
You must be signed in to change notification settings - Fork 23.9k
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
[NEW] module api for specifying alternate password hashing algorithms #8329
Comments
I'm not the biggest fan of building the callbacks you outlined. I think it's sort trying to optimize just this one use case, instead of building a good set of API interfaces around extending authentication. The current problems I am seeing:
Also, I agree about the lack of salting and hashing, it's not great what Redis currently supports. |
I feel the same as @madolson. Specifically regarding the hashing algorithm, I think the real issue here is not lack of flexibility but the use of SHA256 as it is. From a security standpoint, one would just expect a proper hash like bcrypt/scrypt/pbkdf2, but it was ruled out due to the performance impact on handling lots of incoming connections. One goal of such an API should be to offload this to some process outside of Redis. |
It seems to me that we need to preserve the external behaviors of the AUTH and HELLO commands while allowing them to use different authentication methods (either internally or by means of some process outside of Redis) so that the most that a client can observe is an increase in latency for the AUTH and HELLO commands. Both authCommand and helloCommand call ACLAuthenticateUser which in turn calls ACLCheckUserCredentials, which does the heavy lifting, which consists of hashing the password and checking the result against all of the hashes on record for the user. This makes me think that we should extend ACLCheckUserCredentials to support hooks that allow the definition of alternate authentication methods. We could do this in a way that allows the new authentication methods to block the client and make requests to external authentication services. |
Here are some high level design thoughts. Please let me know what you think. The current ACL code is built around two key functions:
If we only wanted to support alternate internal hashing methods such as PBKDF2, hooks that allowed a module to define the following 3 functions should be enough.
To support external authentication such as LDAP the module could set the In this case the Module API might look roughly like this:
Extra features might be considered:
|
@daniel-house Sorry for ignoring you for so long, this has been rattling in the back of my head and I do think we need to address it. I still want to hesitate on having a first class AUTH hook, but instead what I want to do is suggest the following:
For your specific flow, I would expect the module to do the following things:
I know I haven't really addressed that there isn't native support for passwords, but I think the above illustrates how it might work alright. The only missing link I see is ACL LIST and ACL GETUSER are still not supported great. @yossigo Would also love your thoughts on this as well. I sort of want to try to prototype this, as I think the intercepting could solve some other problems as well. |
Interceptors would be a major advancement for module writers and they deserve to be added to #8157. They would have so much power and flexibility, and such a wide range of applicability that I would vote to add them sooner than nearly any other enhancement. It may be possible to use interceptors to enable alternate security solutions such as PBKDF2, but it seems like a LOT of very detailed effort that would have to be repeated by every organization that wanted to strengthen Redis security. If we do go this route we should consider publishing a configurable security module using the interceptors as an example and as proof that the interceptors are sufficient. Additionally, such a module would provide a place for community review and rapid dissemination of security patches. |
Just as a proof of concept, I think interceptors can work. I built a simple POC using this existing module filters, madolson@e3a1bc5, and it seems to cover the AUTH case just fine. |
@daniel-house @madolson Apologies for taking so long, was pretty swamped as well lately. This is a great showcase of why command filtering is so powerful (but maybe I'm biased), but this approach also has a few downsides:
It's tempting to say that adding a few API functions is a more viable option - but I don't see how this API can be so simple if we also consider the need to handle Having a reference implementation / skeleton / first-party module that does this in a generic manner and can be extended makes sense. |
I think we should supoort auth module, that can be realized by developers who use redis for special scene. |
If someone has time, building a reference implementation would be helpful. I think we can investigate adding some hooks that help tactically make the experience more straightforward to implement. |
Duplicate of or replaced by #11256 (close this one?) |
I agree let's close this one. @daniel-house Do you want to check out the new issue and comment if it solves your use case? |
Problem:
New Feature:
A module API that will allow the password hashing algorithm to be replaced by passing a set of function pointers.
It should take full advantage of the existing ACL and should not require defining new commands such as HELLOACL.AUTH.
Changing the hashing algorithm should be transparent to the client.
Alternatives:
Looked at RedisModule_AuthenticateClientWithACLUser and related functions. Normally these don't get called until after the existing hashing algorithm is used at
redis/src/acl.c
Line 1125 in 9cb9f98
Looked at adding a new command such as HELLOACL.AUTH. This would require that clients change their method of authenticating.
Looked at renaming the AUTH command so that it could be intercepted by a new implementation in a module. This would force the implementer to deal with issues that are unrelated to the hashing algorithm, such as checking the DISABLED and NOPASS flags. https://github.com/RedisLabsModules/pam_auth/blob/master/pam_auth.c overrides the AUTH command and we can see that it becomes responsible for generating appropriate responses to the client.
The text was updated successfully, but these errors were encountered: