-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Proposal: Registry v2 authorization service #9081
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
Conversation
|
||
The Claim Set will also contain a private claim name unique to this authorization server specification: | ||
|
||
<dt>"scope"</dt> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dl
needs to be reopened here to get the right formatting.
4fffdb7
to
b6d962b
Compare
“By adding your own HTTP authorization requirements in a proxy placed You can make this as granular as you like in proxy-based auth, as long |
“{"typ":"JWT","alg":"ES256","kid":…}” Shouldn't these whitespace-less versions for signing also have their |
“Check that the JWT ID ( So we're going to need a new token for every registry request? There |
@wking you're right, I realize you can configure nginx to place the authenticated user's username in a header and do namespace authorization that way, and there's definitely a variety of other creative things you could. These schemes (including the one outlined here) would all require pluggable authentication and authorization layers in the registry itself to interpret the headers correctly and recognize what level of access is required for a given request. (unless you decide to put all of this logic in the proxy itself - I don't have any experience with proxy auth outside of TLS client certs and basic authentication but it sounds like you'd have to do something custom no matter what) For the JWT headers, yes, the original version of the key is what is signed. You can look at the JWT spec for more information: https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-30#section-7
So whitespace is allowed, I just removed them to make the token more compact. For your comment on using |
b6d962b
to
9b12471
Compare
rebased with a picture describing the proposed process and how it differs from the currently existing process involving an index service. |
On Tue, Nov 11, 2014 at 02:00:35PM -0800, Josh Hawn wrote:
With the reverse-proxy, http_auth_request approach the
I guess I just wanted to clarify that the signed data needs to be $ python -c "import json; print(json.dumps(json.loads('{"b": 1, "a": 2}')))" which would no longer validate.
Hmm, so “don't use these tokens to track state, come up with your own |
I'll clarify that to better express that we'd like a native authorization mechanism that's public key based with ACLs managed separately.
Yeah, I think it should be every actor's responsibility to make sure that communication channels are secure and that the token is not leaked to any other parties, but the token is significantly larger and its verification more computationally intensive than a simple shared secret/session string. So I may just be prematurely optimizing with this detail. As was suggested above though, I think it should be configureable on the registry server. |
9b12471
to
403d647
Compare
On Tue, Nov 11, 2014 at 02:44:21PM -0800, Josh Hawn wrote:
Works for me.
This works for me too, but I'd point out in the spec that the JWT ID |
403d647
to
e28cb89
Compare
thanks @wking I've just updated the document to clarify the motivation of using this auth mechanism:
And to clarify that single-use tokens (checking the
|
e28cb89
to
998b05b
Compare
3. The registry client makes a request to the authorization service for a signed JSON Web Token. | ||
4. The authorization service returns a token. | ||
5. The client retries the original request with the token embedded in the request header. | ||
6. The Registry authorizes the client and begins the push/pull session as ussual. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: ussual
998b05b
to
cba6c21
Compare
@jlhawn @dmcgowan can you help me understand how this relates to the libtrust server proposal? docker/libtrust#36 |
|
||
## How to authenticate | ||
|
||
Today, registry clients first contact the index to initiate a push or pull. For v2, clients should contact the registry first. If the registry server requires authentication it will return a `401 Unauthorized` response with a `WWW-Authenticate` header detailing how to authenticate to this registry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This proposal seems to step away from some of the earlier discussion about authorization and authentication that occurred in the early registry meetings on IRC, specifically about being more flexible to third party auth solutions. Is this proposal saying that only one type of authentication (JWT token auth integration with a docker auth server) is supported from the client? Or is this proposal spec'd just to that type?
If the latter, it would be good to highlight in this section that this is specifically identifying the JWT token flow and describe Basic / Negotiate (or link to a separate proposal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smarterclayton docker-archive/docker-registry#623 - basic authentication (implemented by a proxy design in front of the registry service) is validated and will be implemented - this proposal here only covers the alternative key-based, JWT support.
So, I believe this is in line with previous discussions on that subject:
- allow for third-party to plug themselves into a proxy talking basic auth with the engine
- support for a key based auth mechanism to be used at least by the Hub, and that could also be used by other people granted they would implement a matching auth service
You are right though, this should be made more clear in that document here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying - so many good proposals bubbling around it's easy to miss one.
On Nov 12, 2014, at 5:25 PM, Olivier Gambier notifications@github.com wrote:
In registry/AUTH.md:
+Instructs the server to associate the given key with the specified and authenticated account. Requires HTTP Authorization Header with basic auth (username:password) for the given account. Payload is public key with in JWK (JSON Web Key) format.
+
+Example Payload from client:
+
+```
+{
- "kty": "EC",
- "crv": "P-256",
- "x": "yGnNRQwOFTbHElKcy-PUEbCSO5g6LEzKgmYJMLwwG8A",
- "y": "u9FwaoJLfXAxj0Z3dHsR7Fm542XLenQw7DVrIJ2CNFc"
+}
+```
+## How to authenticate
+
+Today, registry clients first contact the index to initiate a push or pull. For v2, clients should contact the registry first. If the registry server requires authentication it will return a401 Unauthorized
response with aWWW-Authenticate
header detailing how to authenticate to this registry.
@smarterclayton docker-archive/docker-registry#623 - basic authentication (implemented by a proxy design in front of the registry service) is validated and will be implemented - this proposal here only covers the alternative key-based, JWT support.So, I believe this is in line with previous discussions on that subject:
allow for third-party to plug themselves into a proxy talking basic auth with the engine
support for a key based auth mechanism to be used at least by the Hub, and that could also be used by other people granted they would implement a matching auth service
You are right though, this should be made more clear in that document here.—
Reply to this email directly or view it on GitHub.
SGTM |
Certainly - and which is also the same users database / grants that the hub uses currently.
Short time, it will work through the existing hub mechanisms: authorize user x to repository y, clicky click. Right now, this PR is about getting the engine to move away from the v1 authentication protocol which prevents us from changing the hub, and which shortcomings are no longer bearable: poor scalability (on-pull, per entity auth doesn't fly), reliability issues, granularity issues, to a JWT signed token protocol that is compatible with the "trust" vision that you devised. Hope that clarifies. |
Once the client has a token, it will try the registry request again with the token placed in the HTTP `Authorization` header like so: | ||
|
||
``` | ||
Authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiIsImtpZCI6IkJWM0Q6MkFWWjpVQjVaOktJQVA6SU5QTDo1RU42Ok40SjQ6Nk1XTzpEUktFOkJWUUs6M0ZKTDpQT1RMIn0.eyJpc3MiOiJhdXRoLmRvY2tlci5jb20iLCJzdWIiOiJCQ0NZOk9VNlo6UUVKNTpXTjJDOjJBVkM6WTdZRDpBM0xZOjQ1VVc6NE9HRDpLQUxMOkNOSjU6NUlVTCIsImF1ZCI6InJlZ2lzdHJ5LmRvY2tlci5jb20iLCJleHAiOjE0MTUzODczMTUsIm5iZiI6MTQxNTM4NzAxNSwiaWF0IjoxNDE1Mzg3MDE1LCJqdGkiOiJ0WUpDTzFjNmNueXk3a0FuMGM3cktQZ2JWMUgxYkZ3cyIsInNjb3BlIjoiamxoYXduOnJlcG9zaXRvcnk6c2FtYWxiYS9teS1hcHA6cHVzaCxwdWxsIGpsaGF3bjpuYW1lc3BhY2U6c2FtYWxiYTpwdWxsIn0.Y3zZSwaZPqy4y9oRBVRImZyv3m_S9XDHF1tWwN7mL52C_IiA73SJkWVNsvNqpJIn5h7A2F8biv_S2ppQ1lgkbw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "Bearer" rather than "Token" to be compatible with RFC 6750?
Outlines usage for endpoints which will be used by the docker registry client for registry v2 non-standalone. Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
- Updated entire document to wrap after 80 columns where appropriate. - Clarified private claim set fields - now using `access` struct instead of difficult to understand `scope` string. - linked to up-to-date and relevent RFCs where appropriate - JWA draft spec - Oauth 2.0 RFC - Bearer Token Usage - updated signature example to reflect new claim set structure. Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
af5054d
to
51bea83
Compare
@stevvooe @dmcgowan @jfrazelle I've updated the draft spec, please review again when you get a chance! |
LGTM! Particularly, I like how we've cleared up the relationship to OAuth2. |
@jlhawn can you do potential client implementors a favour and add examples using curl? or in a more realistic place - LGTM |
client implementation developed in #9784 |
y - the point is to document the server with examples in the documentation that can show how it works. |
Do you know when this will be included into a stable release of docker? |
Why was the implementation checked in before the spec? |
@mmdriley it's not clear yet what the process should be to merge such proposals (eg: before or after implementation) - for example: should documentation be merged before a feature lands? |
@dmp42 generally the documentation and the code should to be merged at the same time. In 1.6, We'd like to make this simpler, by moving the registry documentation into the registry repository, and importing it into the docs from there. |
@jfrazelle @icecrime do you think it's best to move this to the https://github.com/docker/distribution repo? It may be more relevant here: https://github.com/docker/distribution/tree/master/auth/token |
yep that makes sense :) |
@jlhawn +1 |
Reopened as distribution/distribution#110 |
Outlines usage for endpoints which will be used by the
docker registry client for registry v2 non-standalone.
Docker-DCO-1.1-Signed-off-by: Josh Hawn josh.hawn@docker.com (github: jlhawn)