-
Notifications
You must be signed in to change notification settings - Fork 574
Docker Registry and Certbot for Let's Encrypt #123
Docker Registry and Certbot for Let's Encrypt #123
Conversation
Have you considered Docker Trusted Registry, which includes security, monitoring and UI in addition to private Docker Registry? |
@ismarslomic not really, at least for now, as it's the paid solution "Starting at $150 monthly" |
If you install it on your own you dont have any costs as I understood it. Edit: Sorry, you are right. DTR requires UCP, which is a payable service. |
@ismarslomic We only use free and open source software in the community edition of ADOP, so we can't use DTR. It also requires UCP it seems, amongst other things: https://docs.docker.com/docker-trusted-registry/install/license/ |
Sorry, my bad. Licensing for both, UCP and DTR was hidden very nicely on Docker docs. |
After all discussions and my quick fixes, rebase required. Will do it soon. |
Rebase - done. @nickdgriffin @SachinKSingh28 sorry for a delay, please review and merge if it looks fine, thanks! |
Test cases:
Tested with:
To be tested:
|
Thanks @nickdgriffin , he suggested to make a prompt, in case if we have already up&running ADOP with NGINX container it's allocating 80 and 443 ports and because of this, we can't issuing new certificates for other services as Let's Encrypt requires these ports to be open. Now, we can use the same "./adop gen-certs" command multiple times (for example if i want to generate new certificate for new platform extension etc.), as i added a check if we have running Proxy (NGINX) container with user prompt confirmation, if he agree to stop this container and issuing new certificates or not. 46a0051#diff-006650ed73143f2ce2864bfcf2e172d2R77 @nickdgriffin could you please test it on Windows again, i can cover only Linux & Mac testing. Thank you in advance! |
@anton-kasperovich , has this been run for "./quickstart.sh -t local"? As I'm not sure certbot will work at the moment like that:
I'll try "-t aws" out too when I have time. |
I've tested from Windows 7 with "-t aws" and it works fine, still need to complete the Windows 10 test. I think it'd be good to get an additional sanity test on Windows too (@dsingh07 /@SachinKSingh28 please?). I think the quickstart script needs to have some logic added that will only allow the registry commands to be run for "-t aws" as we know that will have an accessible public IP for Lets Encrypt to reach to verify the target of the certificate, and we need a caveat mentioned somewhere that the Registry will only function with this type. I don't think it's worth holding up this PR to get something usable out there. |
Another failure case that I think needs handling - I ran quickstart and it failed when it got to "adop compose init" because I had an old secrets file (which is legit), so after fixing that I ran the same command again and got this:
I couldn't actually enter anything for the prompt, and I just wanted it to leave the certificates in place and carry on without regenerating them ideally. @anton-kasperovich , is there a way that can be achieved for the case where the CLI fails for whatever reason and someone just reruns quickstart? |
Works from Windows 10 too with "-t" AWS. I think the only things that need handling are:
And one final sanity test from someone else and then this is good to go :) |
Tested successfully on Windows 7 through Git Bash Test scenario for registry:
Further tested certbot by trying to regenerate unexpired certs which didn't work, as has been pointed out above by @nickdgriffin
Got the following output:
We should handle this case, as we don't know what the valid answers to this question are. |
Oh, it's took me some time to find more proper way (at least i think so...). So the issue which was raised by @nickdgriffin and @dsingh07 , it's because we can not support Docker TTY in Git Bash (Windows) without massive work around like "winpty" or "babun" which obviously is not the option for us. So what I've done:
Example after i update on non-interactive usage with use case which was mention above (tested on Win10 and Git Bash which was installed from Docker Toolbox):
Please give it a try one more time by someone and hopefully we can merge it now, sorry for not getting into it earlier... |
Carried out the tests in #123 (comment) again for Centos 7 and Windows 7, and it all looks good. Also performed the test after rebasing on master just to be safe and it was fine from Centos 7. I'll try Windows 10 again when I can. I also happened to look at the rate limits (because I couldn't do the rebase test from Windows), https://letsencrypt.org/docs/rate-limits/, which implies that only 20 instances a week with a registry will be possible as the domain counts as "nip.io" I think. You can see what's already been registered at https://crt.sh/?q=%25.nip.io. Right now I can't create another one :( |
Unfortunately, because of rate limits on Let's Encrypt, we can't keep it as solution by default, 'cause it might fail ADOP initialization at all. I'm rewriting this PR with self-signed certificates by default, but at the same time i will keep Certbot solution as additional, that people would still able to generate real SSL certificates issued by Let's Encrypt, if they would like to. |
@nickdgriffin @dsingh07 i've updated the Certbot bash script, please take a look on the "gen-export-certs" new function, which was developed to generate and export (in needed places) self-signed certificates |
@anton-kasperovich - Stack was created successfully with registry when I launched quickstart from linux dev box but haven't tried git bash yet. I was getting error message when trying to login to the registry.
|
05.02.17 Updated PR. Changed strategy of copying certificate on copying it to the /etc/docker/certs.d/{domain_name} folder, as per instruction below:
So, at the moment, we should have working Docker Registry whatever a way of deployment we use, i mean quickstart or just ./adop compose init... both should work, as i've added docker-machine cp commands in order to support quickstart as well. Please, pay attention, that this solution will work only internally i.e. inside the stack. If someone wants to use Docker Registry remotely (like i want to pull image from stack on my own laptop), i have to copy and trust certificate. My next step is to provide documentation, on how to use Self-Signed (evaluation mode) and Let's Encrypt (close to "production" way of usage). |
site/_docs/reference/cli/index.md
Outdated
@@ -11,3 +11,4 @@ A quick reference to ADOP CLI commands. | |||
* [./adop project](/adop-docker-compose/docs/reference/cli/project/) | |||
* [./adop target](/adop-docker-compose/docs/reference/cli/target/) | |||
* [./adop workspace](/adop-docker-compose/docs/reference/cli/workspace/) | |||
* [./certbot](/adop-docker-compose/docs/reference/cli/certbot/) |
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.
I think this should be "./adop certbot" here?
Given this another round of testing on Windows 7 with the latest Docker Toolbox and it worked as expected, and I also rebased on master and tested and it also still worked (and rebased cleanly). I focused on the new self-signed certificate stuff from inside Jenkins but didn't attempt to trust it locally. I'd like to give it a go on Windows 10 and Ubuntu too just to cover the bases I think. |
Tested on Windows 10 with the latest Docker Toolbox and it worked as expected with the self-signed certificates, also not attempting to trust it locally. Gave it a shot from Windows 10 with virtualbox too and it behaved as expected - the registry ended up in a restart loop due to lack of certs but that didn't stop me accessing the rest of the tools. I commented out the "if aws" section which resulted in a failure but I don't think that'd be too tricky to resolve in a future PR: I think this is probably good to go once the typo in the docs mentioned above has been sorted, but could you also rebase on master please? |
…of SSL certificates
@nickdgriffin Finally found a time, I've made rebase and fixed the typo |
LGTM :) |
Thanks to #91 and #18 PR's, it's helped a lot to make this PR possible.
Added:
Usage example:
Notes: