AWS ECR, GCP, Chainguard cgr.dev, and others typically use credential helpers.
With docker, skopeo, crane, etc as my user it looks like this
$ cat ~/.docker/config.json
{
"auths": {},
"credHelpers": {
"cgr.dev": "cgr",
"891377301584.dkr.ecr.us-east-1.amazonaws.com": "ecr-login"
}
}
I have credential helpers configured in there, and everything looks at those. Those credential helpers can do whatever they need (i.e. use sso, yubikeys, oidc, tokens, stuff stored in keyrings etc) but all of them emit a short lived token which is then used for auth.
Cred helpers are based on url prefix. See example docs here GitHub - GoogleCloudPlatform/docker-credential-gcr: A Docker credential helper for GCR users for how a GCP credential helper works.
Thus upon doing:
$ incus remote add cgr.dev --protocol oci https://cgr.dev
$ incus launch cgr.dev:chainguard/node:latest
I expect for this to happen:
- incus client to call to incus daemon, get oci url
- incus client locally execute docker credHelpers to get short-lived token, if any
- incus client to pass the token to daemon (well whatever Username & Secret cred helper returned)
- incus daemon use the token to pass it to skopeo
- incus daemon to query image / search images / pull them / etc
- incus daemon then launches stuff from local registry
A realistic example is:
echo "cgr.dev" | docker-credential-cgr get
{"ServerURL":"cgr.dev","Username":"_token","Secret":"eyJhbGc....."}
Which then can be used dynamically for auth
This is also similar to how all other tools do it, for end-users with ephemeral tokens (crane skopeo docker etc).
I don’t know if there is like an fd / socket option to credhelpers that maybe incus client can grab and pass through to the daemon to pass to skopeo or some such, as that would work on local machine development with incus daemon and client on the same machine.
This is the preferred mode of operation for interactive users, as then strong authentication can be done (both ecr-login and cgr support OIDC with multi-factor authentication and delegation to things like google accounts & github, etc).
Separately, it is possible with most cred helpers to issue long lived tokens, but it still best to go via credhelpers to continiously exchange/refresh those tokens. Thus it would help to specify how to configure credhelpers for the incus daemon account / skopeo. If it is even done sort of backdooring - leaving global creds owned by incus daemon user account in incus daemon home directory. In that usecase the creds/tokens provided should be long-lived noninteractive secret usable to get ephemeral tokens.