-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
add X-Registry-Auth header support #6207
add X-Registry-Auth header support #6207
Conversation
Manual tests were successful. I am now working on testing that in the apiv2 tests. |
I looked into running a local registry and found a blocker, unfortunately pretty late in the process. The Docker compat endpoints don't expose a There is no way to point Podman to a custom registries.conf. The e2e tests are using a REGISTRIES_CONF_PATH env variable but that's a NOP as there's no code using that at all. For now, I suggest to merge the PR as is and to trust that my local smoke tests work. However, I believe we need a way to point Podman to a custom registries.conf. Buildah exposes a |
@baude @jwhonce @edsantiago @mheon PTAL |
How hard would it be to add our own, undocumented, unsupported, |
A simple 1 minute change. If that's acceptable, this would certainly be the quickest way forward. |
Can we restrict it so it's not available outside of the tests? |
We could via an env var, for instance. But I think this would make it sufficiently complex to justify adding a |
We have plenty of basically-undocumented unit-testing-only flags like that, so I'm on board |
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.
Just one improvement for the API usage.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vrothberg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Back to WIP: We now support both, single-auth headers and multi-auth headers. Multi-auth headers are the same as the ones from projectatomic docker. This way, we are compatible with vanilla Docker and the projectatomic/RHEL Docker which we can/will also use for the new libpod endpoints. It's now wired into the compat endpoints. Libpod endpoints are still missing along with unit, apiv2 and integration tests. |
Dev update:
I'll continue on Monday and wire in support for all commands/endpoints that support Since so many tests require a local registry, I would love to have |
In response to containers#6207: this is a helper script intended for use in starting and stopping a local container registry. It takes care of port, username, password assignments; generates a self-signed certificate; and starts the container in an isolated podman root/runroot to avoid conflicting with the caller's environment. Intended usage: invoke from shell script, using 'eval' to get results into calling process environment. See help message (-h) for invocation details. This will work for shell scripts but will be difficult if called from Go or C - if that is likely to happen, I'd love to hear suggestions for alternate ways to get the settings back to the caller. Signed-off-by: Ed Santiago <[email protected]>
In response to containers#6207: this is a helper script intended for use in starting and stopping a local container registry. It takes care of port, username, password assignments; generates a self-signed certificate; and starts the container in an isolated podman root/runroot to avoid conflicting with the caller's environment. Intended usage: invoke from shell script, using 'eval' to get results into calling process environment. See help message (-h) for invocation details. This will work for shell scripts but will be difficult if called from Go or C - if that is likely to happen, I'd love to hear suggestions for alternate ways to get the settings back to the caller. Signed-off-by: Ed Santiago <[email protected]>
Note that we first need to get containers/image#933 in. |
Also, once #6269 is merged, we can add auth tests. |
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.
Is identitytoken
going to be implemented in a follow on PR?
pkg/bindings/play/play.go
Outdated
"github.com/containers/libpod/pkg/domain/entities" | ||
"github.com/ghodss/yaml" | ||
"github.com/pkg/errors" | ||
v1 "k8s.io/api/core/v1" |
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.
How much does this grow the remote client?
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.
This would effectively revert the changes from @baude and rebump from 33M to 41M.
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 want to go back to the initial approach of sending all credentials over to the server (see containers/image#942 (comment)). The amount of work and complexity is getting out of hand.
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.
This would avoid repulling the k8s stuff back in :)
Can you elaborate on that? Identity tokens are already supported via the c/image backends and accounted for in the header. |
8c5ab02
to
36c5f57
Compare
3af8dfc
to
ccc0869
Compare
Looking at the |
Fixed in #6403 |
* Support the `X-Registry-Auth` http-request header. * The content of the header is a base64 encoded JSON payload which can either be a single auth config or a map of auth configs (user+pw or token) with the corresponding registries being the keys. Vanilla Docker, projectatomic Docker and the bindings are transparantly supported. * Add a hidden `--registries-conf` flag. Buildah exposes the same flag, mostly for testing purposes. * Do all credential parsing in the client (i.e., `cmd/podman`) pass the username and password in the backend instead of unparsed credentials. * Add a `pkg/auth` which handles most of the heavy lifting. * Go through the authentication-handling code of most commands, bindings and endpoints. Migrate them to the new code and fix issues as seen. A final evaluation and more tests is still required *after* this change. * The manifest-push endpoint is missing certain parameters and should use the ABI function instead. Adding auth-support isn't really possible without these parts working. * The container commands and endpoints (i.e., create and run) have not been changed yet. The APIs don't yet account for the authfile. * Add authentication tests to `pkg/bindings`. Fixes: containers#6384 Signed-off-by: Valentin Rothberg <[email protected]>
Note: I vendored a commit of c/image (non release). I agreed with @rhatdan to do this until c/image has new release. It's acceptable for an RC at least. |
LGTM |
/lgtm |
In response to containers#6207: this is a helper script intended for use in starting and stopping a local container registry. It takes care of port, username, password assignments; generates a self-signed certificate; and starts the container in an isolated podman root/runroot to avoid conflicting with the caller's environment. Intended usage: invoke from shell script, using 'eval' to get results into calling process environment. See help message (-h) for invocation details. This will work for shell scripts but will be difficult if called from Go or C - if that is likely to happen, I'd love to hear suggestions for alternate ways to get the settings back to the caller. Signed-off-by: Ed Santiago <[email protected]>
Support the
X-Registry-Auth
http-request header.The content of the header is a base64 encoded JSON payload which can
either be a single auth config or a map of auth configs (user+pw or
token) with the corresponding registries being the keys. Vanilla
Docker, projectatomic Docker and the bindings are transparantly
supported.
Add a hidden
--registries-conf
flag. Buildah exposes the sameflag, mostly for testing purposes.
Do all credential parsing in the client (i.e.,
cmd/podman
) passthe username and password in the backend instead of unparsed
credentials.
Add a
pkg/auth
which handles most of the heavy lifting.Go through the authentication-handling code of most commands, bindings
and endpoints. Migrate them to the new code and fix issues as seen.
A final evaluation and more tests is still required after this
change.
The manifest-push endpoint is missing certain parameters and should
use the ABI function instead. Adding auth-support isn't really
possible without these parts working.
The container commands and endpoints (i.e., create and run) have not
been changed yet. The APIs don't yet account for the authfile.
Add authentication tests to
pkg/bindings
.Fixes: #6384
Signed-off-by: Valentin Rothberg [email protected]