-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
support legacy registries in exernal stores #23100
Conversation
naked pings @thaJeztah @icecrime @vdemeester @calavera @cpuguy83 :) |
I'd like to have @dmcgowan @aaronlehmann @stevvooe to have a look as well (for registry/distribution) |
I'm not wildly familiar with the behavior. My initial concern is that we need to be careful about making certain endpoints the same that are not to avoid credential leak. The following are pitfalls that must be avoided:
Looking at the original complaint in #22910, I'm wondering if the mistake here is stripping the scheme but I am not sure I understand this issue deeply enough. |
Failure in gccgo and janky?
|
I think the root cause of this is that As I understand the problem, As @stevvooe points out, ignoring the scheme stored with an authentication credential is potentially problematic. If the user specified creds to be associated with a Is there any good reason to allow schemes to be specified to But changing this might break some existing users, for example the ECR case discussed in #22910. |
this behavior has been kept since old Dockers so we still maintain it with when retrieving creds from the filestore - the problem may be that we don't do the same with the external store |
Is there a good reason to strip the scheme from the url, turning it into a different thing? |
I don't know either why |
ping @aaronlehmann @stevvooe what should we do here? |
@@ -100,6 +110,16 @@ func (c *nativeStore) GetAll() (map[string]types.AuthConfig, error) { | |||
return auths, nil | |||
} | |||
|
|||
func (c *nativeStore) getLegacyServerAddress(serverAddress string) string { |
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.
Could you add a comment here explaining what a "legacy" address is?
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.
it's a registry address with http[s]://
prefixed and possibly a path url in there (which will be stripped)
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.
To the code?
Add a comment and do a rebase. |
rebased, added a comment to @stevvooe's comment, this PR still lacks of everything I said in the first comment and which make the PR itself not ready to code review
|
ping @runcom build is failing;
|
@thaJeztah right, I'm holding a rebase again because I did not understand what we should do with this PR, given my comment in #23100 (comment) which lists some outstanding issues |
@runcom alright, yeah, came here because I don't know either what's the best solution, but spotted it was failing CI 😊 |
@aaronlehmann @stevvooe any hint on how to go ahead with this one? give:
|
I'm okay with accepting a scheme in |
@aaronlehmann alright, I'll adapt the PR accordingly, thanks |
e3d12ba
to
4a4e811
Compare
LGTM 🐸 |
func ConvertToHostname(url string) string { | ||
stripped := url | ||
if strings.HasPrefix(url, "http://") { | ||
stripped = strings.Replace(url, "http://", "", 1) |
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.
stripped = strings.TrimPrefix(url, "http://")
7cc47cf
to
008b06a
Compare
There are some build errors:
But otherwise these changes look right, thanks. |
@aaronlehmann should be fixed now |
013d2a2
to
7e499ee
Compare
if _, ok := dockerCli.ConfigFile().AuthConfigs[s]; ok { | ||
loggedIn = true | ||
regToLogout = s | ||
break |
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.
Wondering if we should log out from all of the registries from regsToTry
which are found, in case someone ends up in a state where the same registry is stored in multiple ways. It would be very unexpected if docker logout
only removed one copy but not the others.
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.
Make sense, I'll fix this and add an integration test if possible.
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.
Fixed and added an integration test, PTAL
572f895
to
669d426
Compare
var ( | ||
serverAddress string | ||
isDefaultRegistry bool | ||
) | ||
if opts.serverAddress != "" { | ||
serverAddress = opts.serverAddress |
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.
Shouldn't isDefaultRegistry
be set to true if this matches IndexServer
?
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'm not sure that ever worked, if you want I can add it
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.
@aaronlehmann fixed
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
LGTM |
Issue with newer docker versions if https is used via login causes push/pull commands to fail. Fixed slated for docker 1.13.0 - moby/moby#22910 - moby/moby#23100 (comment)
Issue with newer docker versions if https is used via login causes push/pull commands to fail. Fixed slated for docker 1.13.0 - moby/moby#22910 - moby/moby#23100 (comment)
Issue with newer docker versions if https is used via login causes push/pull commands to fail. Fixed slated for docker 1.13.0 - moby/moby#22910 - moby/moby#23100 (comment)
Issue with newer docker versions if https is used via login causes push/pull commands to fail. Fixed slated for docker 1.13.0 - moby/moby#22910 - moby/moby#23100 (comment)
Tackling and fixing #22910
Signed-off-by: Antonio Murdaca runcom@redhat.com