containerregistry icon indicating copy to clipboard operation
containerregistry copied to clipboard

[WIP] Add SSL Certificate Support to Fast Pull and Push

Open ahirreddy opened this issue 7 years ago • 15 comments

This PR allows specifying SSL certificates (client key and cert chain) for a specific domain (or set of domains). The transport pool wrapper now exposes a add_certificate method that mimics the underlying httplib2.Http transports that it's wrapping.

ahirreddy avatar Nov 26 '17 00:11 ahirreddy

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

googlebot avatar Nov 26 '17 00:11 googlebot

@mattmoor Does this approach seem reasonable? And should it be expanded to all uses of the transport pool?

Also, I'll open up a pr against docker_rules if/when this guy gets merged. I've got a branch that threads through the arguments.

ahirreddy avatar Nov 26 '17 00:11 ahirreddy

tl;dr I'm worried this is going to end up making rules very verbose.

What does a docker_push look like in the end-state? What does a k8s_object look like (has its own push client)?

An alternative would be to make the client support something like this. I think my bias is generally towards adopting compatibility with the solutions folks are using with conventional clients, unless there are strong reasons against (maybe there are).

Are you guys using anything like this for certs?

mattmoor avatar Nov 27 '17 17:11 mattmoor

There's also precedent for defining certs using flags on the Docker client: https://docs.docker.com/engine/reference/commandline/cli/

dekkagaijin avatar Nov 27 '17 18:11 dekkagaijin

@KingEmet thanks, I was looking for that. :)

mattmoor avatar Nov 27 '17 18:11 mattmoor

I'm happy with either solution. Is there a clean way to depend on certs in /etc/docker/certs.d? That's actually the solution we use today for Docker pull/push today, we require engineers install those certs.

ahirreddy avatar Nov 28 '17 18:11 ahirreddy

@ahirreddy my biggest concern is the root requirement for reading that directory :(

drwx------ 2 root root    4096 Jan 20  2017 docker

Since this is daemon-side auth and the daemon runs as root, it can read this ACL'd this way. We don't (want to) require root, so we cannot (as-is).

I think we basically want what you have, but instead of passing the certs it would enable reading them from this standard directory (WDYT?).

@KingEmet I don't think there are environment variables controlling this because it's daemon-side. I think the environment variables control certs for talking to the daemon. Please correct me if I'm mistaken. :)

mattmoor avatar Nov 28 '17 19:11 mattmoor

@ahirreddy In summary, if you can also require making that directory user-readable, then the flag option is viable and less verbose.

mattmoor avatar Nov 28 '17 19:11 mattmoor

@mattmoor Sounds good! I'll give it a try this weekend

ahirreddy avatar Nov 29 '17 22:11 ahirreddy

@mattmoor looks like it, yeah. Seems like /etc/docker/certs.d/... is for daemon <-> registry communications

dekkagaijin avatar Dec 01 '17 04:12 dekkagaijin

Um...the merge-base version for this is a bit old cough. I am trying to rebase and fix the problems.

abergmeier avatar Dec 27 '17 11:12 abergmeier

Ok, rebased and pushed to https://github.com/abergmeier/containerregistry/tree/container-push-pull-cert. It now semi-depends on https://github.com/google/containerregistry/pull/51. @mattmoor @ahirreddy Can you take a look and see whether its good?

abergmeier avatar Dec 27 '17 19:12 abergmeier

Sorry, I've been swamped with other things. I'm planning to take a look next week!

ahirreddy avatar Jan 18 '18 21:01 ahirreddy

@mattmoor It occurred to me, it's unclear where to look for the certificates on OS X. Docker for Mac doesn't seem to support client certs, and docker-machine stores them inside the VM.

ahirreddy avatar Jan 23 '18 02:01 ahirreddy

@ahirreddy: Any progress on this?

calder avatar Mar 16 '18 00:03 calder