Skip to content
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

fix insecure manifest inspect with restrictive certs perms #1378

Merged
merged 1 commit into from
Sep 20, 2018

Conversation

clnperez
Copy link
Contributor

If, for some reason, the certs directory has permissions that are
inaccessible by docker, we should still be able to fetch manifests using
the insecure flag.

Since the cli doesn't access the engine's list of insecure registries,
the registry client should make a singleton list of the registry being queried with the
insecure flag.

Closes #1358

Signed-off-by: Christy Norman christy@linux.vnet.ibm.com

@codecov-io
Copy link

codecov-io commented Sep 18, 2018

Codecov Report

Merging #1378 into master will decrease coverage by 0.09%.
The diff coverage is n/a.

@@            Coverage Diff            @@
##           master    #1378     +/-   ##
=========================================
- Coverage   54.88%   54.79%   -0.1%     
=========================================
  Files         293      293             
  Lines       19428    19428             
=========================================
- Hits        10663    10645     -18     
- Misses       8089     8110     +21     
+ Partials      676      673      -3

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

serviceOpts := registry.ServiceOptions{}
if insecure {
logrus.Debugf("allowing insecure registry for: %s", reference.Domain(namedRef))
serviceOpts.InsecureRegistries = []string{reference.Domain(namedRef)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name was a bit confusing, so checked if reference.Domain() returned the port-number as well, but looks like it does 😅 👍 https://github.com/docker/distribution/blob/6170ac53daed40ebbebc9fe5f482495d01f09f12/reference/reference_test.go#L51-L55

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it does. i double-checked that b/c i had the same concern. :) thanks @thaJeztah!

@thaJeztah
Copy link
Member

ping @justincormack @silvin-lubecki ptal

repoInfo, err := registry.ParseRepositoryInfo(namedRef)
if err != nil {
return nil, err
}
registryService, err := registry.NewService(registry.ServiceOptions{})

serviceOpts := registry.ServiceOptions{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: var serviceOpts registry.ServiceOptions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed that and re-pushed

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

If, for some reason, the certs directory has permissions that are
inaccessible by docker, we should still be able to fetch manifests using
the `insecure` flag.

Since the cli doesn't access the engine's list of insecure registries,
the registry client should make a singleton list of the registry being queried with the
`insecure` flag.

Closes docker#1358

Signed-off-by: Christy Norman <christy@linux.vnet.ibm.com>
Copy link
Collaborator

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯

@thaJeztah
Copy link
Member

Thanks!

lifubang pushed a commit to lifubang/cli that referenced this pull request Oct 12, 2018
…e-fix

fix insecure manifest inspect with restrictive certs perms

Signed-off-by: Lifubang <lifubang@acmcoder.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants