Commit Graph

109 Commits

Author SHA1 Message Date
Valentin Rothberg 45a2d19dd1 docs: fix indentation in registries.conf
Fix a number of indentation issues in the containers-registries.conf man
page which caused rendering issues both in the man pages and the
upstream markdown on GitHub; move all to the root indent level/scope.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-07-14 11:00:12 +02:00
Sascha Grunert 2935f06f71
Error on namespaced registries for credential helpers
We now error on login if repositories or repository namespaces are used
for other credential helpers than the `AuthenticationFileHelper`. On
logout we ignore them and debug log a warning that nothing has been
modified.

The functions `SetCredentials` (for login) as well as
`RemoveAuthentication` (for logout) already feature support for path
based registries for the `AuthenticationFileHelper`. This patch adds
unit tests to ensure that the support will not break in the future.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-07-14 09:19:28 +02:00
Daniel J Walsh cdd6817ed6
Change all references to docker registry to container registry
Will leave references to distribution spec until there is an OCI Spec we
can point at.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-30 15:34:06 -04:00
Sascha Grunert 2cafc0105c
Add support for registry paths in auth.json
This patch adds support for `host[:port]/ns/…repo` to auth.json while
keeping the backwards compatible behavior.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-06-30 17:23:59 +02:00
Lokesh Mandvekar 373440662e Enable subdomain matching in registries.conf
This commit allows the prefix field in registries.conf to be in the
format: `prefix = "*.example.com" for wildcard subdomain matching.

refMatchesPrefix has been renamed to refMatchingPrefix. refMatchingPrefix
now returns the length of the prefix if there's a match
and the prefix doesn't contain `*.`. If prefix contains `*.` and there's
a match, then refMatchingPrefix returns the length of the refString
without the image. This change removes the need for
any additional string comparison in `rewriteReference`.

Co-authored-by: Valentin Rothberg <rothberg@redhat.com>
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2021-04-09 11:33:56 -04:00
Qi Wang f0555f0396 registries.conf: configure credential helpers
Allow for configuring credential helpers in `registries.conf` files.

Credential helpers are configured as a top-level field
`credential-helpers`.  This is an array of strings.  Items listed in the
array are consulted in the specified order when looking up or removing
credentials.

Note that there is a built-in credential helpers `containers-auth.json`
for using auth files.  If no global defaults are specified, we will
fallback to using auth files.  This assures backwards compat and a
working default setting.

The traces of the disabled "keyring" functionality have largely been
removed.  If we ever want to re-enable support, we can follow the
example of auth files and specify a new built-in keyring helper.

Using a built-in helper simplifies the code quite a bit since the code
structure boilds down to conditionally dispatching helpers; everything's
a credential helper with some special values for built-in helpers.

Make sure that the execution paths are properly logged (debug level).

Signed-off-by: Qi Wang <qiwan@redhat.com>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-04-02 14:45:07 +02:00
Josh Soref 111bf164be Spelling
* about
* appropriate
* busybox
* candidate
* candidates
* certificate
* config
* configuration
* containers
* decompression
* directory
* does-not/match
* does/not/exist
* doesnot
* doesnotexist
* exemplary
* garbage
* gzipped
* identify
* initially
* kubernetes
* length
* marshaling
* maximum
* mybetaproduct
* overridden
* parameter
* permissive
* policyconfiguration
* protocols
* reference
* referenceable
* requirement
* response
* simultaneously
* slashes
* subobject
* successfully
* this
* uncompressed
* unmarshaled
* unmarshaler
* unmarshaling it
* unmarshaller
* valid

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-23 14:37:37 -04:00
Dominic Yin f463e1409f fix typo in docs/containers-registries.conf.d.5.md
Signed-off-by: Dominic Yin <yindongchao@inspur.com>
2021-03-16 11:26:14 +01:00
Valentin Rothberg 9823c4765f short-name-aliases.conf: use cache folders instead of $HOME
As shown in github.com/containers/podman/issues/8559, writing to the
$HOME directory or root may be undesired.  Using /var/cache for root and
$HOME./cache for ordinary users, however, is common practice.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-02-09 11:42:28 +01:00
TerraTech 93436c61b3 Update containers-registries.conf.5.md
This change is intended to make the GitHub markdown render correctly.

The man page rendering was unaffected and still renders correctly.

Signed-off-by: TerraTech <TerraTech@users.noreply.github.com>
2021-02-02 03:04:09 -08:00
Lokesh Mandvekar f541c8245e Enable subdomain matching in policy.json
DockerReferenceNamespaces will also append wildcarded expressions for
subdomain matching in policy.json.

For example: [foo.example.com *.example.com *.com]

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2021-01-14 10:10:12 -05:00
Miloslav Trmač 9dd2c4d959 Add a signedIdentity choice "type": "remapIdentity"
This allows accepting signatures for a complete or partial
mirror of some other repository namespace in a single step,
similar in signing effect to setting up mirrors in registries.conf,
but letting image consumers to refer to the mirrors directly.

For tag/digest matching, this currently only implemnents the
default matchRepoDigestOrExact-like semantics; it's the right
choice for almost all users, and we can add other alternatives
later if it turned out to be necessary.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2020-12-04 17:57:34 +01:00
Valentin Rothberg cf9ea2e816 pkg/shortnames
Add a new package for short-name resolution. `pkg/shortnames` is built
around the short-name aliasing in the registries.conf and introduces two
functions.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-11-13 09:10:07 +01:00
Jason Travis 8cd70d6c93 docs: update reference to containers-registeries.d.md
Signed-off-by: Jason Travis <JasonTravis@nau.edu>
2020-10-23 18:08:35 -07:00
Qi Wang 259ec0bbdb Search credentials under XDG_CONFIG_HOME
Add XDG_CONFIG_HOME to the paths to be searched when login a registry. If XDG_CONFIG_HOME is empty, search under $HOME/.config. In the order that first search for authfile, XDG_RUNTIME_DIR, XDG_CONFIG_HOME, and docker config file.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-10-02 15:15:12 -04:00
Qi Wang 701023dd1a Set default rootless sigstore
Set default rootless sigstore to ~/.local/share/containers/sigstore if the caller is non-root.
Export the func ConfiguredSignatureStorageBase() for Podman image sign implementation.
Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-09-18 15:44:24 -04:00
Daniel J Walsh 33bcba75bb
Fix problems found by codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-15 10:17:41 -04:00
Qi Wang e5c467969e Support per user registries.d
Support per user  ~/.config/containers/registries.d to allow rootless podman push image sign.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-08-24 16:17:41 -04:00
Miloslav Trmač 0919e38dda Introduce docker-archive:path:@index syntax for reading untagged images
Add support for path:@index (e.g. path:@0, path:@1 ...) reference syntax
to docker-archive.

This will allow reading even untagged images from multi-image archives.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2020-08-20 09:56:08 +02:00
Miloslav Trmač c010778ba3 Allow choosing an image from tarfile.Reader by reference
We already accept the syntax for docker-archive: references,
now implement the lookup instead of warning and ignoring the value.

Implement the lookup in tarfile.Reader, not tarfile.Source,
because we will want to provide an API to obtain tags from a
Reader+Reference, without constructing a Source.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2020-08-20 09:56:08 +02:00
Qi Wang 3d43ff2de8 Load the rootless registries.conf.d for override
Load the rootless registries.conf.d for override

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-06-22 13:56:28 -04:00
Qi Wang dc78f17409 Add documentation for credHelper
Add documentation for credHelper. Close https://github.com/containers/libpod/issues/1675

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-06-04 14:56:51 -04:00
Qi Wang a20dbce9f7 Add hardcode Authfile for windows and mac
Add hardcode Authfile for windows and mac used for credential store.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-05-27 10:40:38 -04:00
Qi Wang 8cdf27d93a Add defaults for using the rootless policy path
Add support for default rootless policy path of $HOME/.config/containers/policy.json.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-05-14 12:13:03 -04:00
Daniel J Walsh 8051f86dde
Remove registries.conf VERSION 2 references from man page
VERSION 2 is fully supported, and should be just referred to as the current version.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-01 08:48:34 -04:00
Kang Huaishuai ced5884062
Update containers-registries.conf.5.md
Signed-off-by: Kang HuaiShuai <khs1994@khs1994.com>
2020-04-07 16:50:57 +08:00
Scott McCarty 5f92aa44cb
Updated warning about short names.
Patch originally from fatherlinux <smccarty@redhat.com>

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-13 08:28:45 -04:00
Valentin Rothberg 4227aadf4c containers-registries.conf.d: refine semantics
- Only load `.conf` suffixed files
- Enforce v2 format of registries.conf
- Don't recurse into sub-directories
- Rootless support
- Cache key consists of conf and dir path
- Merge `[[registry]]` tables
- Several code clean ups and minor fixes

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-13 11:23:55 +01:00
TomSweeneyRedHat 7b508e3100 Intial authfile man page
The initial man page for the authfile used by
the container tools.

Fixes: https://github.com/containers/libpod/issues/4359

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2020-03-04 08:38:39 -05:00
Daniel J Walsh 5ee42a1f9d Add $HOME/.config/containers/certs.d to perHostCertDirPath
We want to allow users to store certs in their homedir when running in rootless mode.
We want rootless podman and rootless buildah to add $HOME/.config/containers/certs.d
to the search path for certificates by default.

Currently there is no way for a non privileged user to get certs without being root on
the system or specify the certs dir on ever call.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-04 13:43:53 +01:00
Qi Wang 8c8fd0e70f Add $HOME/.config/containers/registries.conf to config path
provide per-user configuration of registries.conf under $HOME/.config/containers/registries.conf for other tools.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-03-04 10:53:07 +01:00
Valentin Rothberg eee0de5d00 registries.conf.d: add stances for the registries.conf
When loading the registries.conf, allow for loading additional files
from `/etc/containers/registries.conf.d`.  The files are loaded in
alpha-numerical order and specified fields will overwrite the previous
config.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-02 15:20:36 +01:00
Sascha Grunert 137bd7e0ff
Add documentation about rewriting docker.io registries
We now document the already existing internal `/library` suffix for
docker.io mirrors and provide an example how to deal with them.

I also fixed two typos in `containers-registries.d.5.md`.

Closes https://github.com/containers/image/issues/775

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-24 11:11:25 +01:00
TomSweeneyRedHat 9cabf276f5 Add registries warning to registries.conf
Add a warning about fully specifying registries
to the search list.

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2019-12-13 17:51:49 -05:00
TomSweeneyRedHat 4009bbea65 Touch up transport man page
Touch up the containers-transports storage specificiation in the man page.

Fixes: #666

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2019-07-31 17:49:21 -04:00
W. Trevor King 8ed6527e91
*: Fix policy.json.md -> containers-policy.json.5.md references
Catching up with be91505 (docs: rename manpages to *.5.md, 2019-03-01, #594).

Generated with:

  $ sed -i 's/policy.json.md/containers-policy.json.5.md/g' $(git grep -l policy.json.md)

Looking to carry this over the finish line for Wking.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-07-21 04:02:18 -04:00
Sascha Grunert 067419f751
Fix typo in docs/containers-registries.conf.5.md
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-06-18 14:40:34 +02:00
Miloslav Trmač 4cd207c0a7 RFC: Significantly restructure the registries.conf documentation
Primarily, start with explaining the "prefix" field and its matching semantics,
and only then explain other fields.

Also, use definition lists (using a Markdown extension supported by go-md2man)
for the individual options instead of wordy "The option `foo` will ..." text
to make it easier to find the relevant sections.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-06-11 20:42:44 +02:00
Miloslav Trmač 586de82af5 Replace Registry.Search with V2RegistriesConfig.UnqualifiedSearchRegistries
This makes the order of all of the []Registry entries irrelevant, makes the
search order easy to find/determine, and makes it much easier to edit either
the search list or the other attributes of registries independently.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-05-29 00:30:42 +02:00
Valentin Rothberg 9713e6dc23 sysregistriesv2: add mirror-by-digest-only attribute
Add a new mirror-by-digest-only attribute to the registries configuration.
If set true, mirrors will only be consulted when the passed reference
includes a digest.

To facilitate using the API, add a new method
`PullSourcesFromReference(reference.Named) ([]PullSource, Error)`.
The new `PullSource` type contains an `Endpoint` and a written
reference.  `Endpoint.RewriteReference(...)...` is now private.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-05-27 16:23:27 +02:00
Valentin Rothberg 14736d08ac containers-registries.conf.5.md: use table format for mirrors
Use the table format for mirrors as using the list format seems to
contradict the singular `mirror` field.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-05-27 16:23:27 +02:00
Daniel J Walsh 958ed01bfc
Rename atomic-signatures to containers-signatures
We no longer use the term atomic, renaming atomic to containers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-04-30 08:49:58 -04:00
Valentin Rothberg bd834ec1d6 docs: containers-transports(5) manpage
Fixes: https://github.com/containers/image/issues/540
Fixes: github.com/containers/skopeo/issues/590
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-04-24 09:59:46 +02:00
Sascha Grunert a39a6e4c00
Add registry mirror support to docker client
This commit enables private registry mirror support for the docker
client. Major changes and additions related to an image pull are:

- If mirrors are specified via the configuration (registries.conf), then
  the first working (where the manifest is available remotely) mirror
  will be used for the pull.
- The main registry will be the fallback if no mirror works.
- The insecure/skipVerify flags will be used from system context and
  from the corresponding registry/mirror as fallback too.
- Configuring a prefix will be considered, too.
- Update documentation for registry mirror support within
  `registries.conf` as well as the man page.
- Renamed the `url` to `location` within system_registries_v2

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-04-23 14:40:59 +02:00
Valentin Rothberg be915057aa docs: rename manpages to *.5.md
Suffix the manpages accordingly to be placed in the correct manpage
folder during package installation.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-03-06 15:12:44 +01:00
Valentin Rothberg 8befafed7d add container-certs.d.md manpage
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1677264
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-03-01 13:21:30 +01:00
Valentin Rothberg b16716cbaf docs/: prefix manpages with "containers-"
Prefix manpages with "containers-" and propagate the change into the
manpages.  Furthermore, make sure that the manpages have the NAME and
DESCRIPTION section to make them be indexed by `man -k` and `apropos`.

Fixes: #492
Signed-off-by: Valentin Rothberg <vrothberg@suse.com>
2018-08-23 13:47:21 +02:00
TomSweeneyRedHat d994164bbc Update registries.conf man
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2018-06-21 10:19:27 -04:00
Daniel J Walsh 3796e5bb77 Reformat policy.json.md to be used as a man page
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-04-07 05:50:18 -04:00
Nalin Dahyabhai 32b40fc540 Add a "tarball" transport for importing tarballs
Add a "tarball" transport which can be used to import tarballs of root
filesystem as images by treating each tarball as a single layer,
supplying a default OCI configuration (or one passed to the image from
which the ImageSource or Image was initialized), and generating an OCI
manifest to describe it all.

A tarball named "-" is buffered in memory using the contents of stdin.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-11-02 09:58:05 -04:00
baude 950085430b Add registries.conf file and build library to parse it
registries.conf is a system-wide configuration file initially
developed in https://github.com/projectatomic/registries.  We
eventually want to ship the configuration file with this project;
hence the addition.  However, we also needed a library like
approach that gave this and other projects the ability to
parse the file in the same manner.

Signed-off-by: baude <bbaude@redhat.com>
2017-08-29 12:24:09 -05:00
Miloslav Trmač ffcd0be048 Add a JSON schema for the JSON data embedded in a signature
Note that this is NOT a replacement for the atomic-signature.md documentation.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-05-10 15:25:22 +02:00
Miloslav Trmač 8a5d2f82a6 Add documentation for the atomic signature format
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-05-10 14:57:38 +02:00
Miloslav Trmač ab49b0a484 Add documentation for signature access protocols
This is primarily the only documentation of the sigstore layout;
in addition it comments on the OpenShift API master REST API and the
OpenShift docker/distribution API extension.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-04-03 23:15:59 +02:00
Miloslav Trmač 322058e563 Add signedIdentity type:matchRepoDigestOrExact, make it the default
This is the new default: tag references require a signature with a
matching repo:tag, digest references require a signature with a matching
repo (and any tag [or digest]), with the digest itself still being
validated in image.UnparsedImage, independently of signature processing.

Users can still opt into strict checking by specifying matchExact
in signedIdentity.

Also update most tests to use matchExactOrSignedDigest, to match
the default.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-11-08 15:04:53 +01:00
Aaron Weitekamp 20ba448863 Support man page formatting
Signed-off-by: Aaron Weitekamp <aweiteka@redhat.com>
2016-10-14 09:26:28 -04:00
Miloslav Trmač dd0bf87c52 Add documentation for the signature verification policy files
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-10-11 19:06:28 +02:00
Miloslav Trmač d3a6b77882 Rename sigstore-write to sigstore-staging
This makes it much clearer how that URL is supposed to be used.

(And it could also clear the way to, in the future, have a write server.
Perhaps.)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-09-15 21:26:53 +02:00
Miloslav Trmač aaedc64236 Implement lookaside storage for signatures for Docker registries
Allows configuring "sigstore" (for RW) and "sigstore-write" (write-only)
for images/repositories/namespaces/registries in
/etc/containers/repositories.d/*.yaml .

If configured, uses them to store signatures in the docker: transport.

Also includes documentation in docs/registries.d.md.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-09-12 17:51:26 +02:00