Bug 1393443

Summary: rhel-push-plugin blocks all rhel-based pushes
Product: Red Hat Enterprise Linux 7 Reporter: Ed Santiago <santiago>
Component: dockerAssignee: Antonio Murdaca <amurdaca>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: amurdaca, dwalsh, lsm5, lsu
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-06 17:44:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Ed Santiago 2016-11-09 15:01:20 UTC
docker-1.12.3-4.el7.x86_64 is blocking pushes of all rhel-based images, even to registries other than docker.io :

    # sed -e 's/^ *//' >Dockerfile <<EOF
    FROM docker.io/busybox:latest
    MAINTAINER nobody
    LABEL Vendor="Red Hat, Inc."
    LABEL Name="rhelNOTREALLY"
    RUN echo hi
EOF

    # docker build -t foo .
    # docker tag foo nonexistent-registry.com/myname/myrhel:latest
    # docker push nonexistent-registry.com/myname/myrhel:latest
    Error response from daemon: plugin rhel-push-plugin failed with error: AuthZPlugin.AuthZReq: sha256:f4011a6057abe2835b3b29ce796d100c27cdf48098bb8de9d3bf908d7f0d2c09 is RHEL based, please push by tag

Expected result: 'unable to ping registry endpoint' (or, if this were a real registry other than docker.io, success)

Analysis: seems to be caused by

    https://github.com/projectatomic/rhel-push-plugin/commit/bc8b12c38bbe86ba2d94928bdefdb934cab0ceac

...which now returns an error (was: nil), triggering:

    RHELBased, err := p.isRHELBased(repoName)
    if err != nil {
        return authorization.Response{Err: err.Error()}
    }

Comment 1 Antonio Murdaca 2016-11-09 15:10:34 UTC
Ed, I don't understand, by declaring those LABEL you're effectively making the image "rhel-based" for what the plugin knows about an image. That's the way the plugin works (and even if we do the same directly in docker, we still need to base the login on LABELs).

Comment 2 Daniel Walsh 2016-11-09 15:13:39 UTC
Antonio the only place we want to block pushes to is docker.io.  We want to allow a customer to push to their own registries.

Comment 3 Ed Santiago 2016-11-09 15:25:26 UTC
Would now be a good time to ask what "please push by tag" is supposed to mean? I am pushing by tag. And now that's the error message when pushing to docker.io as well. The old message ("RHEL based images are not allowed to be pushed to docker.io") was more descriptive, but I don't see a code path that gets to it any more.

Comment 4 Antonio Murdaca 2016-11-09 15:29:50 UTC
Fixed by https://github.com/projectatomic/rhel-push-plugin/commit/eb9e6beb8767a4a102e011c2d6e70394629dfa91

$ docker push nonexistent-registry.com/myname/myrhel:latest
The push refers to a repository [nonexistent-registry.com/myname/myrhel]
Get https://nonexistent-registry.com/v1/_ping: dial tcp: lookup nonexistent-registry.com on 10.38.5.26:53: no such host

# now trying to push to docker.io

$ docker tag foo runcom/rhelbased
% docker push runcom/rhelbased
Error response from daemon: authorization denied by plugin rhel-push-plugin: RHEL based images are not allowed to be pushed to docker.io

Comment 5 Luwen Su 2016-11-15 16:09:18 UTC
In docker-1.12.3-7.el7.x86_64, 

# docker tag foo nonexistent-registry.com/myname/myrhel:latest

# docker push nonexistent-registry.com/myname/myrhel:latest
The push refers to a repository [nonexistent-registry.com/myname/myrhel]
Get https://nonexistent-registry.com/v1/_ping: dial tcp: lookup nonexistent-registry.com on 10.72.17.5:53: no such host


Move to verified

Comment 8 errata-xmlrpc 2016-12-06 17:44:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2859.html