Skip to content

Commit a931215

Browse files
authored
Merge pull request #1393 from cgwalters/auth-expand
secrets: Expand on authfile
2 parents 204ed0e + 86b45a5 commit a931215

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

docs/src/building/secrets.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,46 @@
22
# Secrets (e.g. container pull secrets)
33

44
To have `bootc` fetch updates from registry which requires authentication,
5-
you must include a pull secret in `/etc/ostree/auth.json` (or
6-
as of recent versions in `/usr/lib/ostree/auth.json`).
5+
you must include a pull secret in one of `/etc/ostree/auth.json`,
6+
`/run/ostree/auth.json` or `/usr/lib/ostree/auth.json`.
77

8-
Another common case is to also fetch container images via
9-
`podman` or equivalent. There is a [pull request to add `/etc/containers/auth.json`](https://github.com/containers/image/pull/1746)
10-
which would be shared by the two stacks by default.
8+
The path to the authentication file differs from that used
9+
by e.g. `podman` by default as some of the file paths used
10+
there are not appropriate for system services (e.g. reading
11+
the `/root` home directory).
1112

1213
Regardless, injecting this data is a good example of a generic
1314
"secret". The bootc project does not currently include one
1415
single opinionated mechanism for secrets.
1516

17+
## Synchronizing the bootc and podman credentials
18+
19+
See the [containers-auth.json](https://github.com/containers/image/blob/main/docs/containers-auth.json.5.md) man page. In many cases, you will
20+
want to keep both the bootc and podman/skopeo credentials
21+
in sync. One pattern is to symlink the two via e.g. a systemd `tmpfiles.d` fragment.
22+
23+
If you have a process invoking `podman login` (which by default writes to
24+
an ephemeral `$XDG_RUNTIME_DIR/containers/auth.json`) you can then
25+
`ln -s /run/user/0/containers/auth.json /run/ostree/auth.json`.
26+
27+
## Performing an explicit login
28+
29+
If you have automation (or manual processes) performing a login,
30+
you can pass `--authfile` to set the bootc authfile explicitly;
31+
for example
32+
33+
```bash
34+
echo <somepassword> | podman login --authfile /run/ostree/auth.json -u someuser --password-stdin
35+
```
36+
37+
This pattern of using the ephemeral location in `/run` can work
38+
well when the credentials are derived on system start from
39+
an external system. For example, `aws ecr get-login-password --region region`
40+
as suggested by [this document](https://docs.aws.amazon.com/AmazonECR/latest/userguide/Podman.html).
41+
42+
You can also use the machine-local persistent location `/etc/ostree/auth.json`
43+
via this method.
44+
1645
## Using a credential helper
1746

1847
In order to use a credential helper as configured in `registries.conf`

0 commit comments

Comments
 (0)