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

Registry authentication fails when secret contains only .dockercfg #26

Closed
derkoe opened this issue Jan 31, 2022 · 6 comments
Closed

Registry authentication fails when secret contains only .dockercfg #26

derkoe opened this issue Jan 31, 2022 · 6 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@derkoe
Copy link
Contributor

derkoe commented Jan 31, 2022

Secrets with type = "kubernetes.io/dockercfg" containing the pull secret in the field .dockercfg do not work.

OpenShift uses this type of secret for the internal registry - so, you cannot provide the type = "kubernetes.io/dockerconfigjson".

@ckotzbauer ckotzbauer added the kind/bug Categorizes issue or PR as related to a bug. label Jan 31, 2022
@derkoe
Copy link
Contributor Author

derkoe commented Feb 1, 2022

This is not fixed with that commit since LoadFromReader does not use the old format. Only Load handles this case (distinguishing by file name).

@ckotzbauer ckotzbauer reopened this Feb 2, 2022
@ckotzbauer
Copy link
Owner

I did a small research on this: I think the legacy .dockercfg is a subset of the newer .docker/config.json file which only supports the auths section (which is identically to the auths section in newer config-files). The code in LoadFromReader and LegacyLoadFromReader (which is called from Load when the old-file is detected) is almost the same regarding the auths section. So I think old files should be handled correctly too from LoadFromReader.

Can you give me an sanitized example of your .dockercfg file?

@derkoe
Copy link
Contributor Author

derkoe commented Feb 2, 2022

This is the .dockercfg:

{
    "docker.example.com": { "username": "user", "password": "password" }
}

This is the .dockerconfigjson (where the aut is user:password base64 encoded):

{
    "auths": { "docker.example.com": { "auth": "dXNlcjpwYXNzd29yZA==" } }
}

@ckotzbauer
Copy link
Owner

A great, I missed that difference in the moring. 😉 Well I think I can patch this quickly in the evening. Thanks for the comparison!

@ckotzbauer
Copy link
Owner

This should be finally fixed now in 0.4.1 @derkoe. There's a unit-test now to keep this working. However, I don't know if the fact that there's no auth property in the .dockercfg is really official, as the official docker-code cannot handle an empty auth property. I ported the specific loading-logic to the application and modified it to make it work.

@derkoe
Copy link
Contributor Author

derkoe commented Feb 10, 2022

Works like a charm! Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants