-
Notifications
You must be signed in to change notification settings - Fork 9.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
proposal for v3 auth #4475
Comments
Correct me if I'm wrong, I think this will partially solve the current performance issue with etcd auth mentioned here #3223 If it doesn't, then what is the plan to solve this issue for v3? |
It will be almost the same, just at gRPC layer. |
@xiang90 I have a question about non quorum read in v2 protocol. Will it provided in v3? It is important for auth, because the non quorum read allows stale read result but improve performance. It is hard to integrate such a functionality with auth. Because auth information should also be stored in the raft storage and checking the information in consistent manner will sacrifices the benefit of the stale read. IIUC, the lease mechanism can provide consistent and low cost read in v3. Therefore non quorum read will not be required. It is an important point of the new auth mechanism so I want to confirm it first. |
@mitake v3 enabled q-read by default. https://github.com/coreos/etcd/blob/master/etcdserver/etcdserverpb/rpc.proto#L121-L126 |
@xiang90 I didn't notice the flag, thanks! Because of the reason I described in the above, it is difficult for non quorum read to coexist with the auth mechanism. For simplicity, rejecting non quorum read when auth is enabled would be safer. Is it acceptable? |
As we discussed:
What you mentioned might make sense, but it is not what we want to ensure with from the very beginning. If you have a specific use case that requires it, please share it with us. Then we can reconsider it. |
Should these restriction of operation be introduced in v3, too? I thought
means the inconsistent state isn't allowed in v3. Am I misunderstanding? |
@mitake to be clear, does this describe the auth problem?
|
@heyitsanthony yes. I'm thinking about the case you described. |
@mitake OK, is there a threat that's handled with consistent auth? I don't think it fixes stale reads. For example, B can still set up a proxy that watches on "k" which would serve a stale "k" even after the access denial goes through. |
@heyitsanthony of course proxies will introduce a chance of inconsistency. But I don't understand how proxy will interact with other features in v3 protocol (it will be redesigned for v3, right? #4318). I was thinking that lease and watch provide consistent client side caching for improving read performance. Therefore I still don't understand the benefit of serializable range in v3. So I'd like to separate it from the auth problem at first. Of course I might be missing something. I'm happy if you could point out my misunderstanding kindly :) |
@mitake I was talking about a rogue proxy with B's credentials which ignores auth. My point is that any data available prior to the denial revision is already as good as leaked to the client; read consistency with auth can't take it back. |
@heyitsanthony OK, I understand your point, thanks for your explanation. It seems reasonable because newly created values (after enabling auth) cannot be read without auth. The commit message of auth enabling must be received by followers' state machine before arrival of the newly created values (I needed a time for understanding it, sorry!). I have a next question (sorry for frequent questions): if v3 auth provides per connection auth (as described in the first message of this issue), the inconsistent state would be matter because even once a connection is authorized, it will be invalid after auth configuration change. How should we provide the efficient auth mechanism? I'm thinking that using authentication mechanism of gRPC (as current implementation does) and letting messages from clientv3 have permission information (user ID, password) would be the simplest way. Permission check is done at every read write request processing by etcd servers. Is it ok, @xiang90 ? |
@xiang90 @heyitsanthony I'm writing a design doc for the v3 auth and ACL here: https://docs.google.com/document/d/1Zs5lc4H8kHr4sgoniKlL6YRsLKFNy8m-1pyGhkCmmO4/edit?usp=sharing I'm really glad if you can review and comment on it. |
@mitake took a look, left some comments. Thanks for taking the time to write the doc. |
@xiang90 @heyitsanthony thanks for your comments on the doc. It seems that the consensus on the design is almost achieved. I'd like to have a clear consensus on this point:
Is this ok for you? |
@mitake Authentication per connection. Re-Authentication when the password of a user is changed. |
@xiang90 yes, I agree with your points. How do you think about the design of the permission check? |
@xiang90 @heyitsanthony updated the doc for a plan of implementation. Could you take a look? |
@xiang90 listed RPCs in the doc. Could you review? Can I start implementation? |
@mitake RPC looks good. Let's write the proto and send a pull request? |
@xiang90 thanks, I'll send a PR later. |
It seems to me that it's only possible to set a plaintext passwords via API v2. Is that correct? If so, I propose to allow setting passwords using hash. |
@rominf Even in v2 API, passwords are stored in etcd store after hashing. Do you want to hash passwords in client side? |
@mitake Yes, I do. I'm talking about changing: Change password
to Change password
|
@rominf I understand. @xiang90 @heyitsanthony how do you think about the idea of client side password hashing? I think it is reasonable. |
@mitake I'm not sure if it really improves security; the hashed password can still be used in a replay attack unless the server provides a nonce for the hash salt. |
What's the purpose of nested dictionary for permissions? Why:
but not:
? |
@xiang90 @heyitsanthony I'd like to use JWT (https://jwt.io/) for the token of v3 auth. JWT seems to be a simple and mature token format. In addition, it enables verifying tokens based with the RSA key mechanism. So it would be friendly for the new proxy of v3 API. Proxies will be able to verify requests from clients, it would be a great help for reducing read traffic. I'd like to have a consensus about using JWT (it will introduce a new vendor, I'm considering to use it https://github.com/dgrijalva/jwt-go). Can I hear your opinion? |
@mitake What do you want to put inside JWT? What benefits JWT will bring us in our use case besides proxy (Proxy should either terminate TLS/Auth or just be transparent in my opinion)? I would image a simple obscure random token will do the work. |
@xiang90 The main benefits from JWT are like below:
|
As long as the token space and sign key space are the same, I feel the problem is pretty much equivalent unless when you have a significant amount of tokens compared to the token space . A client can guess a token, and a client can guess a sign key too.
This is the benefit I could see since JTW actually provides since it contains the auth info and the info verifiable by both parities. However, the proxy issue you mentioned is different from what we are trying to solve right now. Token Invalidation can be complicated. I feel we should first finish the simplest solution. Then we can explore more about a better token mechanism. |
JWT's token space is limited with RSA based sign. So guessing it is harder than just a random number.
JWT allows tokens to have various metadata. So we can let the a token to have a revision of storage when its client was authorized. We can check the authentication is obsolete or not based on the numbers. It doesn't require a heavy invalidation mechanism.
Actually I want to use JWT for simplifying |
What does JWT provide use than a obscure token right now?
I feel it should be just a getToken method that randomly generate a fixed length token. It wont take a lot of effort and it allows us to evaluate what the token should be in the future aside from the auth implementation. |
I mean the attacker can guess the private key of the RSA anyway. I do not feel there is a big win. A long enough true random token would be equally safe.
By invalidation, I mean at proxy side. If we do not want the token to have any meaningful information to be validated against, then we do not need JTW. |
OK, then I'll implement the simple methodology first. Anyway, it would be useful for easy trial that doesn't require public/private keys. But,
I don't think this is a realistic assumption. It would mean public key encryption methodologies cannot be used. And the random number methodologies always have a problem of exhausting entropy in machines. |
@mitake ACLs seem to be a part of the v3 auth design (they're already documented as a feature on the etcd home page!), but I don't think they're yet implemented -- correct me if I'm wrong. Is there a timeline for that part of the implementation? We'd really like to make use of path-based restrictions on users. Edit: #2384 seems to indicate that there is some support for keyspace restrictions. Are ACLs fully implemented, or just keyspace restrictions per user? Apologies for my misunderstanding. |
Hi @aarondav , thanks for your interest. As you found, the feature is already implemented in v2 API. We are working on auth and ACL in v3 API. v2 auth is already implemented and ready for using (it is contained in v2.3.0 release). Just curious: will you use etcd in Spark? |
Ahh, gotcha! Great, didn't realize that distinction between the v2 and v3 APIs. We are actually using etcd via flannel in Kubernetes, and are experimenting with an architecture with multiple isolated networks sharing the same etcd, which requires that each network has access to only its sub-tree of etcd. |
@aarondav I see, thanks. Flannel seems to be using v2 API, so you can use the feature with etcd v2.3.0 or newer. |
@mitake Anything left here for 3.0? Or we can close it? |
@xiang90 yes, though there are still remaining tasks e.g. jwt token and handling revision, the basic functionalities are already implemented. I agree to closing it. |
@mitake Probably create issues for the things we want to do for the next steps: jwt + revision in token. |
New issues related to auth v3:
|
We have a role based auth system for v2. We are pretty happy about its simplicity and flexibility.
For v3, we will probably adopt the similar role based system. But we need to solve a few things:
/cc @mitake
The text was updated successfully, but these errors were encountered: