Skip to content

Client credentials store. - #20107

Merged
thaJeztah merged 1 commit into
moby:masterfrom
calavera:client_auth_store
Feb 29, 2016
Merged

thaJeztah merged 1 commit into
moby:masterfrom
calavera:client_auth_store

Conversation

@calavera

@calavera calavera commented Feb 8, 2016

Copy link
Copy Markdown
Contributor

This change implements communication with an external credentials store,
ala git-credential-helper. The client falls back the plain text store,
what we're currently using, if there is no remote store configured.

This implementation shells out to helper program when a credential store is
configured. Those programs can be implemented with any language as long as they
follow the convention to pass arguments and information.

There is an implementation for the OS X keychain in https://github.com/docker/docker-credential-helpers. That package also provides basic structure to create other helpers.

docker-osxkeychain

Signed-off-by: David Calavera [email protected]

@jessfraz

jessfraz commented Feb 8, 2016

Copy link
Copy Markdown
Contributor

+1 I think we should use the native keychain and allow the operating system apply its security to the objects it controls

@thaJeztah

Copy link
Copy Markdown
Member

nice! +1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is MPL compatible with our licensing and distribution?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? MPL is copyleft, whereas Apache is doesn't have such distribution restrictions. I don't see MPL anywhere on here. There is some GPLv3 but that specifically has a static linking exception.

IANAL, but this requires more thought. For example, this may have implications for proprietary authorization plugins.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://opensource.com/law/11/9/mpl-20-copyleft-and-license-compatibility

A good example of these subtle incompatibilities is between MPL 1.1 and Apache 2.0. In certain circumstances, a patent litigant could trigger Apache 2.0's patent peace clause without triggering MPL 1.1's similar (but slightly different) patent peace clause. This made the two licenses incompatible in the sense used here. Aligning these triggering conditions is what allowed us to be more comfortable that Apache 2.0 and MPL 2.0 are compatible. In other words, complying with MPL 2.0's patent requirements will allow someone to be comfortable that they've also complied with the patent requirements of any Apache-licensed code contained within the MPL-licensed project.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not asking about license compatibility. I am asking about whether or not MPL is compatible with the goals of a login system. Are we comfortable with forcing implementors of login plugins to have to link against code under a copyleft license?

This is going to require more than a one word answer and a link to blog.

@stevvooe

stevvooe commented Feb 8, 2016

Copy link
Copy Markdown
Contributor

This is pretty awesome.

I disagree with adopting yet-another-plugin-framework, but this is a fine start. Could we just define a cli API, like credentials add|get|remove <serverurl>? This would allow non-go plugins.

@calavera

calavera commented Feb 8, 2016

Copy link
Copy Markdown
Contributor Author

I disagree with adopting yet-another-plugin-framework, but this is a fine star.

I'm not sold on that part either.

Could we just define a cli API, like credentials add|get|remove ? This would allow non-go plugins.

Yes, that's what git does. I wanted to have a working version before settling down in one protocol.

@calavera

calavera commented Feb 8, 2016

Copy link
Copy Markdown
Contributor Author

What I like about this implementation is that it doesn't require any STDOUT parsing, like a pure command line would require. I don't think it would be much complicated, but it's definitely less "graceful".

@vdemeester

Copy link
Copy Markdown
Member

waw nice !! 👍 on this too 😉

@stevvooe

stevvooe commented Feb 8, 2016

Copy link
Copy Markdown
Contributor

What I like about this implementation is that it doesn't require any STDOUT parsing, like a pure command line would require.

Piping stdout into a json unmarshaler seems straightforward and can be done with a large number of languages. The framing and protocol of go-plugin would have to implemented in each language. I don't think there is anything "graceful" about using go-plugin here.

@calavera

calavera commented Feb 8, 2016

Copy link
Copy Markdown
Contributor Author

Okay, let's go with a shelling out implementation, it should not be very hard to modify and I agree that it's more open to other languages.

@stevvooe

stevvooe commented Feb 9, 2016

Copy link
Copy Markdown
Contributor

@calavera 👍

@cpuguy83

cpuguy83 commented Feb 9, 2016

Copy link
Copy Markdown
Member

😍

@calavera calavera changed the title [PROPOSAL] Client credentials store. Client credentials store. Feb 9, 2016
@calavera

calavera commented Feb 9, 2016

Copy link
Copy Markdown
Contributor Author

Given @cpuguy83's ❤️-y eyes, I'm going to assume that we should move forward with this. I've updated the implementation to shell out already. I've also updated the osxkeychain program to handle that. There are still things to do here, like adding tests and docs, but I'll appreciate your reviews.

@vdemeester

Copy link
Copy Markdown
Member

If I understand correctly : If there is no credentialStore specified, we use the FileStore that does what we do now ; otherwise, it uses a remote one if available and use a FileStore to store anything other than username and password ; am I right ? 😛

Design LGTM, I like this a lot 😻

@calavera

calavera commented Feb 9, 2016

Copy link
Copy Markdown
Contributor Author

@vdemeester you're correct.

@calavera
calavera force-pushed the client_auth_store branch 4 times, most recently from 8039237 to 5d2b29a Compare February 10, 2016 17:59

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious - what's the reason for this build tag?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using that same tag to load a mock command for testing, to avoid shelling out during tests. I'm still considering if it's the best way to simulate commands. I'm open to suggestions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aaronlehmann

Copy link
Copy Markdown

I really like this PR. Having secure credential storage will be great.

One suggestion is I think it would be better to serialize the AuthConfig struct directly into credential stores instead of extracting the password from that struct. The distribution team is working on adding long-lived tokens for 1.11 that will avoid the need to save passwords at all in many cases. If the credential store treats AuthConfig structs as opaque, it should end up being forward-compatible with this model, allowing us to store the long-lived tokens in an OS-specific keychain (which would be the best of both worlds).

@calavera

Copy link
Copy Markdown
Contributor Author

@thaJeztah I addressed your comments, thanks for the suggestions.

you can download them from:

- Apple OS X keychain: https://github.com/docker/docker-credential-helpers/releases
- Microsoft Windows Credential Manager: https://github.com/docker/docker-credential-helpers/releases

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working on the first release as we speak, but anyone can build the binaries form the source until then 😸

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we link to the repo itself then, so that they end up at the readme?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need. We probably have about 1 month to make sure we have releases in the right place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay, congrats! 🎉

@thaJeztah

Copy link
Copy Markdown
Member

LGTM, thanks!

@vdemeester

Copy link
Copy Markdown
Member

LGTM 🐯

@thaJeztah thaJeztah added this to the 1.11.0 milestone Feb 29, 2016
@thaJeztah

Copy link
Copy Markdown
Member

All green! Let's merge!

thaJeztah added a commit that referenced this pull request Feb 29, 2016
@thaJeztah
thaJeztah merged commit 29ce086 into moby:master Feb 29, 2016
@cpuguy83

Copy link
Copy Markdown
Member

🍌

@calavera
calavera deleted the client_auth_store branch February 29, 2016 21:33
@calavera

Copy link
Copy Markdown
Contributor Author

🍏

@vdemeester

Copy link
Copy Markdown
Member

🍋

@thaJeztah

Copy link
Copy Markdown
Member

image

@JonathonReinhart

Copy link
Copy Markdown

I'm not intimately familiar with git-credential-helper, but isn't this pretty similar in function? Are existing Git credential helpers compatible with this implementation? If not, is there any reason they had to be different? It seems like a lot of re-inventing the wheel if existing Git credential helpers couldn't be re-used for Docker.

Signed,
A guy running Linux who happily uses Git credential helpers.

@jlhawn

jlhawn commented Mar 4, 2016

Copy link
Copy Markdown

@JonathonReinhart I'm also not very familiar with *-credential-helper-type applications but I think that the reason why you should not reuse an existing credential helper for another application (like docker using git-credential-helper) is because the the credential management system typically has access control for which applications are able to access different stored credentials. You certainly could do this, but if docker used git-credential-helper then it would also have access to all of the credentials that git would have access to and vice-versa.

By having a separate binary, upon first use, your credential management system will present a dialog asking if you want to authorize this new application to set/access this new entry in your credential store. Now git-credential-store will only be able to access your password for github.com and not index.docker.io, for example.

A guy running Linux ...

Hmm, looks like just Windows and OS X support for now? I'm sure support for GNOME Keyring will come soon?

@runcom

runcom commented Mar 4, 2016

Copy link
Copy Markdown
Member

A guy running Linux ...
Hmm, looks like just Windows and OS X support for now? I'm sure support for GNOME Keyring will come soon?

@jlhawn working on it docker/docker-credential-helpers#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.