-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Allow insecure ssl #2687
Allow insecure ssl #2687
Conversation
ping @shin- |
anyone have any comments on this? |
can this code and the client portion from #3068 be combined? |
personally, I think this stands on it own. All private repos using basic auth need to run with ssl (at least that is how it is currently in written). This pull request makes it so that one only needs purchase certs for production environments. |
@dvoet Can you rebase? |
@shin- can you take a look? |
Needs to be rebased, otherwise LGTM |
bumping this thread to hopefully get this rebased. I'm writing up a blog post on using the registry in production. It would be awesome to have this PR in so that it can be demonstrated with both self-signed certs and CA certs. :) |
working on it now On Mon, Jan 13, 2014 at 8:07 PM, Matthew Fisher notifications@github.comwrote:
|
Docker-DCO-1.1-Signed-off-by: Douglas Voet <doug.voet@gmail.com> (github: dvoet)
all set :) |
ping |
+1 |
2 similar comments
+1 |
+1 |
Rebase pls? |
Come on guys. You asked me to rebase a month ago and I did so. I don't have time to do it again right now. |
Can we get another maintainer +1 on this - @creack @vieux @crosbymichael ? Thanks! |
Could we please get an update to when this is likely to be included... was really hoping it was in 0.8 |
I would love to see this make it in. Thanks! |
+1 sorry for +1-ing, but it seems this issue may be forgotten otherwise? |
This is the equivalent of adding an "ignore and continue" button to a browser's SSL warning. Browsers got rid of those years ago and for good reason. I'd prefer we just told people how to update their OS' certificate files.
|
I don't think browsers got rid of this. Chrome certainly has a big scary warning but it has an ignore button. Curl certainly has the same functionality with the -k switch. And not everyone has access to change their cert file. |
@ewindisch agreed; documenting proper ways to achieve the same goal should be preferred. Is there already an issue to add that to the documentation? This would enable the maintainers to close this issue as. 'Won't fix, doing issue xxx in stead' |
@thaJeztah I've created an issue #4372 for documenting local CA management. @dvoet - It's obviously non-consistent between browsers and some have gotten more restrictive then loosened up again. Arguably if you don't have permission to change your cert file, you shouldn't be ignoring SSL certificates. I'm not really fond of the fact that other clients have this setting, it's too frequently abused. However, putting an interactive prompt on this that prevents automation would be a good compromise from my perspective. |
@ewindisch thanks! |
I agree with @ewindisch on this one. I think this should be a doc change and not a code change. @shykes @creack @unclejack what do you think? |
@ewindisch Even putting aside the no-so-great trust model based on CAs, the consequence of not being able to easily ignore a self-signed certificate (used a lot in dev) is that many people will just use http instead. After all http does not check identities and it's also open to man in the middle attacks. https with a signed certificate at least solves the later problem. I think it should be a code change. |
My problem was just fixed by building the current docker-0.11.0-dev from source and using it inside boot2docker. Now the certificate is accepted. Thanks to everybody for the support! |
@kennu from the release notes:
Sounds like that is what solved it for you |
Can we widen that to include those root certs which use MD5? |
Any updates on this ? Still getting the "Error response from daemon : Invalid Registry endpoint : Get https://localhost/v1_ping: x509: Certificate signed by unknown authority.". Or any clear workarounds for this ? |
In what version? This issue was resolved by the patch for my sha-384 cert.
|
Client version: 1.1.0 I generated the certificate following this page : http://www.activestate.com/blog/2014/01/deploying-your-own-private-docker-registry |
For other googlers who end up here, here's how I got my docker registry working with a self signed certificate (mostly cobbled together from here and here). The key is to act as your own CA. Not suitable for production, but at least it allows you to test out a dev docker registry. On a private server do the following: Generate a new root key:
Generate a matching root cert:
Generate your server key:
and cert request (make sure to type in the external name/ip (w/out port num) of your server when prompted for 'Common Name':
Then sign it:
Take the
Take the
after restarting nginx you should be able to push and pull to your docker registry over self-signed SSL now. @ewindisch if there's a more appropriate place to post this let me know, would be glad to clean this up and properly add it to the documentation. |
@nikvdp I have followed your instructions (excepted that I'm on OS X) and it's not working, I still have the 'x509: certificate signed by unknown authority' error. The only thing I did different in order to import my certificate on my Mac is that I have opened it, requested OS X to trust the certificate and entered my password.
|
@zedtux, @shin- I decided not to use Mac OS X since I do not use it in production. I setup an ubuntu vm using virtualbox and if you want some starting point you should go to: https://help.ubuntu.com/12.04/serverguide/certificates-and-security.html Then, once you create your own CA and sign your key, make sure sure to add the ca cert on your client machine. If you want login/logout functionality, use docker 1.2.0 or use coreos alpha release. curl - u user:pass and docker login/logout works and credentials are saved at home dir, But, I can't push images and get HTTP 401 error and looking at nginx 1.4.X logs, says no credentials provided. It's using ssl to connect but docker client is not sending them. I'll use wireshark or tcpdump to look at the traffic and provide results. |
solved... just do not forget to start docker using ca cert ;) (facepalm) I know |
Glad you were able to solve it, thanks for reporting back! |
Thank you @jonathanve ! I will try this. |
The docker daemon itself supports the use of self-signed certificates with "--tlsverify --tlscacert=ca.pem". I am having a hard time understanding, why it would be such a serious security flaw to support the same thing (like a '--tlscacert` param for docker pull/push/login) forthe communication between docker and docker-registry. I am trying way too long already to get this working. Seems a bit like Docker wants to force users into using the Docker Hub by making the operation of a private registry (which is secure and supports some kind of authentication) a very intricate endeavor. |
@jonathanve I have encountered the same problem with you. First HTTP 401 error, after added ssl certificate, then unknown authority. Restarting docker daemon with cacert.pem set me free! |
@seanlook awesome you are now using your private docker index! |
Not sure if this should be posted here but this is not clear to me after going through a lot of topics. I have followed steps mentioned by @nikvdp with no luck with both version 1.3.0 and 1.3.2 based on #8467
Seems like I got same issue with 1.3.2 binaries even when using
I also tried the same with no --insecure-registry and ca.crt at the required place with quite same result.
|
Hi @jncharpin , hope you are ok. This is the process I followed to use a self signed certificate and a private registry behind nginx:
And it works. |
@jncharpin I wrote a more detailed writeup of how to get this working over at digitaloceans community site, might help you out. Short answer: using a self signed cert works fine, and can even work without the --insecure-registry flag if you set up your CA certs properly. As @jonathanve pointed out, restarting the docker service on the client after adding the cert is essential as otherwise docker won't pick up the newly authorized certs. |
@nikvdp Maybe I'm wrong, but in my tests, I didn't need to restart the service. Seems to me Docker reads the cert file every single time: https://github.com/docker/docker/blob/662efd95c7a30e5593ca9fdc672ad3f1d6f9703c/registry/registry.go#L107 in doRequest. |
@tiborvass could be i'm mistaken on that bit. I went through this for a few registries tho, and was never able to get it to work until after I had restarted the docker service on the client. To be clear, I was adding a CA cert that had been used to sign my self-signed certificate to the client's store via ubuntu's not sure what's in the /etc/docker/certs.d mentioned there (and don't see it on my system), but as far as I could tell docker wasn't re-checking the list of valid CA certs until with each request (which makes sense as those should very rarely change). |
Thanks all for your reply. @nikvdp this is from your article on digital ocean that I setup the registry and ssl. I restarted the service many times and even tried different version of the service. From my understanding docker is considering the certificate but it seems to fail in x509 which I'm not familiar with. Regarding @jonathanve comment I'm wondering if using an IP as domain name could make a difference. |
@nikvdp oh right that makes sense. If you put the cert under |
@tiborvass good to know! will try that out next time. @jncharpin I think you're right about the problem having to do with IP vs domain name. I've never tried it using an IP directly. What are you entering in the common name field portion when you do the certificate signing steps? I'd try making a new certificate and using a domain name instead of the ip for your registry, making sure that you enter the domain name of your registry into openssl's Common Name prompt instead of the ip when you sign the cert. If you don't have a domain then you can just fake it as @jonathanve pointed out by adding an entry into your /etc/hosts file on the client machine. As long as the "domain" of your registry and the common name of the signed cert match everything should work. |
@nikvdp that is correct. In fact, the message "[...] it doesn't contain any IP SANs" appears if you use the ip address. Trust me |
@jonathanve @nikvdp I can also confirm that the issue is coming from the usage of the IP instead of a domain name in the certificate. |
@jncharpin No problem. Would be nice to write a chef cookbook for it. If you want my help, just let me know, |
This will allow support for private docker registries that have self-signed or otherwise unverified ssl certificates. Useful in non-production environments. As per prior pull request comments, this is implemented using commandline arguments to the push, pull, import and login commands. It was not implemented in the run command as it did not fit in nicely with the parameter parsing. In order to run images from a private registry it must be explicitly pulled first.