Giter Club home page Giter Club logo

Comments (6)

filmil avatar filmil commented on June 19, 2024

Indeed, would be really nice to support http for non-localhost.

from containerregistry.

roblg avatar roblg commented on June 19, 2024

I'm also generally supportive of being able to use HTTP if desired, since in a service mesh, we might know that all connections are TLS, even if that's transparent to the applications.

That being said for any future users that might drop in here, I found that our specific use case of pointing to a k8s pod hostname via http works as long as the fully-qualified hostname is used (e.g. foo.foo-ns.svc.cluster.local). Seems like somebody has come across this before. :) https://github.com/google/containerregistry/blob/master/client/v2_2/docker_http_.py#L443-L450

from containerregistry.

borg286 avatar borg286 commented on June 19, 2024

I also encountered this problem. Some local kubernetes stacks create a virtual node inside a docker container and run everything in there. The kubelets can't access the "localhost" registry from outside their sandbox, but both can access the node IP. If I run a private registry there it has 192.168.9.2 which docker_http.py assumes is HTTPS and I get an odd error message

CRITICAL:root:Error publishing provided image: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:727)

Would it be possible to fix the code so that it first tries https, catches the error, then falls back to http? A properly set up registry should fail http so there should be no security problem that is opened up.

from containerregistry.

borg286 avatar borg286 commented on June 19, 2024

After thinking about this, falling back to http would introduce an attack vector. A man-in-the-middle could claim the dns record for some domain, hoping to catch cases where the https failed and the subsequent http request with to this bad guy, who could then deliver an infected image.
Assumming that is the case we should have a way to specify the schema. Consider detecting if http:// or https:// is a prefix on the image name and use in talking to the registry but stripping it for image name purposes, much like is done when specifying a domain other than dockerhub.com

from containerregistry.

uddmorningsun avatar uddmorningsun commented on June 19, 2024

Same issue! We also utilize private registry(Harbor) to distribution image or store our project base docker image in internal project. For convenience, Harbor is deployed with HTTP.

And since rules_docker(https://github.com/bazelbuild/rules_docker/blob/master/container/pull.bzl) relies heavily it, if I want to pull internal image to usage, it will fail because of parse scheme and try ping

... ...
(04:06:01) ERROR: Analysis of target '//cmd/webhook:image' failed; build aborted: no such package '@static_base//image': Pull command failed: F0301 04:06:01.489578  378089 __main__.py:147] Error pulling and saving image 192.168.20.38/build/debian:stretch: [Errno 111] Connection refused

My ugly workaround to bind 192.168.20.38 to localhost in /etc/hosts, and update field registry = 'localhost:80' in WORKSPACE file.

Looking forward to support it

from containerregistry.

borg286 avatar borg286 commented on June 19, 2024

jeb2239, can you provide justification for closing this. I still would like this feature added

from containerregistry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.