Commit Graph

55 Commits

Author SHA1 Message Date
dependabot[bot] 05f86fe582
build(deps): bump github.com/containerd/containerd/v2 in /cmd
Bumps [github.com/containerd/containerd/v2](https://github.com/containerd/containerd) from 2.0.4 to 2.0.5.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v2.0.4...v2.0.5)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd/v2
  dependency-version: 2.0.5
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-21 18:04:19 +00:00
dependabot[bot] ef5ba82fd6
build(deps): bump golang.org/x/net from 0.36.0 to 0.38.0 in /cmd
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.36.0 to 0.38.0.
- [Commits](https://github.com/golang/net/compare/v0.36.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.38.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-16 23:19:10 +00:00
Stefan Berger fd725bccd6 build(deps): Run go mod tidy in cmd/
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2025-03-17 21:36:35 -04:00
dependabot[bot] d7dbabf80a
build(deps): bump github.com/containerd/containerd/v2 in /cmd
Bumps [github.com/containerd/containerd/v2](https://github.com/containerd/containerd) from 2.0.0 to 2.0.4.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v2.0.0...v2.0.4)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd/v2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-18 00:37:31 +00:00
dependabot[bot] 0788082004
build(deps): bump github.com/go-jose/go-jose/v4 in /cmd
Bumps [github.com/go-jose/go-jose/v4](https://github.com/go-jose/go-jose) from 4.0.4 to 4.0.5.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Changelog](https://github.com/go-jose/go-jose/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-jose/go-jose/compare/v4.0.4...v4.0.5)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-24 22:54:11 +00:00
Stefan Berger 744c7cab90 build(deps): Update dependencies due to high severity issues
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2024-12-18 21:56:00 -05:00
Stefan Berger f66a7fd67e build(deps): Update a few dependencies
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2024-12-16 11:21:54 -05:00
Akihiro Suda 5c12942714
go.mod: github.com/containerd/containerd/v2 v2.0.0
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-12-10 17:49:17 +09:00
Derek McGowan 8f67ad5859 Update go module to imgcrypt v2
Allow importing of containerd v2 without breaking compatibility for
use with containerd v1.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-10-24 07:06:14 -07:00
Akihiro Suda b71cf225e1
go.mod: github.com/containerd/containerd/v2 v2.0.0-rc.6
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-10-24 19:11:01 +09:00
dependabot[bot] b1ff2f6434
build(deps): bump google.golang.org/grpc from 1.64.0 to 1.64.1 in /cmd
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.64.0 to 1.64.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.64.0...v1.64.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-09 21:58:18 +00:00
Stefan Berger 8c4135efc9 build(deps): update to ocicrypt v1.2.0
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2024-07-01 10:02:31 -04:00
Sebastiaan van Stijn bc04b3cc65
go.mod: github.com/containerd/containerd v2.0.0-rc.3
rc.3 rmoves pkg/seed, so removing that import from cmd/ctr

full diff: https://github.com/containerd/containerd/compare/v2.0.0-rc.2...v2.0.0-rc.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-22 01:06:51 +02:00
Derek McGowan 8b9b205467 Update to containerd v2.0.0-rc.2
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-05-26 17:27:03 -07:00
Akihiro Suda 27550399fb
go.mod: github.com/containerd/containerd/v2 v2.0.0-rc.1
- github.com/containerd/containerd/{containers,images,...} -> github.com/containerd/containerd/v2/core/{containers,images,...}
- github.com/containerd/containerd/{errdefs,logs,platforms} -> github.com/containerd/{errdefs,logs,platforms}
- github.com/containerd/typeurl -> github.com/containerd/typeurl/v2
- github.com/urfave/cli -> github.com/urfave/cli/v2 (See containerd/containerd PR 9809)
- github.com/gogo/protobuf -> github.com/containerd/containerd/v2/protobuf

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-04-25 12:01:20 +09:00
Akihiro Suda 85438ace2e
GetImageLayerDescriptors: handle application/vnd.in-toto+json
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-04-25 11:59:58 +09:00
dependabot[bot] 33dc459b2c
build(deps): bump golang.org/x/net from 0.17.0 to 0.23.0 in /cmd
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.17.0 to 0.23.0.
- [Commits](https://github.com/golang/net/compare/v0.17.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-19 12:39:27 +00:00
Sebastiaan van Stijn cb7e5d33ff
separate command-line to a separate module
(This is a very quick attempt at "what this will look like")

This repository provides both command-line utilities, and a module for external
consumers.

Currently, both are part of the same module; as a result, dependencies of both
the module *and* the command-line utilities are listed in the repositories go.mod.
This affects consumers of this project, because (due to go module's nature of
dependency (version) resolution), those consumers will inherit all dependencies,
or will be "forced" to use the same version of the CLI dependencies.

This is a very quick attempt at separating the CLI utilities from the "module",
by creating a separate go.mod (and module) for the CLI utilities.

I'm not fond of the name (github.com/containerd/imgcrypt/cmd) for that module
(possibly renaming to github.com/containerd/imgcrypt/cli would be slightly
clearer).

This change _will_ add some additional work when tagging releases; a separate tag
should be created for the cli utilities (tagging as `cmd/vX.Y.Z`), and the
"github.com/containerd/imgcrypt" dependency in the go.mod inside the cmd directory
may need to be updated to reflect the latest version of the main module when tagging
new releases (as the replace rule is non-transitional); something like:

1. update `github.com/containerd/imgcrypt` version in cmd/go.mod to "next release"
2. tag both `v<new release>` and `cmd/v<new version>` in tandem.

CI / validation also needs to be updated to verify both `go.mod` and `go.sum`
files are correct / up-to-date. Possibly checks should be added to make sure the
main module is isolated from the cmd module (i.e., the "module" should not import
any path from the cmd directory: the reverse is of course OK (and expected)).

Finally; use of the 'vendor' directory may need to be discussed; it is common
to only use a vendor directory for projects that produce binaries, but omit the
vendor directory for "library" projects. In this case (if vendoring is still
desired), the vendor directory should be removed from the root of the repository,
and moved inside the `cmd` directory.

Originally-from: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-03-28 14:17:54 +09:00
Akihiro Suda 9eee3300d1
Remove unused variables
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-03-27 23:34:41 +09:00
Stefan Berger 0778f7ec89 ctr: Fix issues in the help screens for image en- and decryption
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2024-03-11 21:45:21 -04:00
Stefan Berger b32797501b ctr: Sync code with containerd v1.6.30 ctr
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2024-03-11 21:37:48 -04:00
Stefan Berger 264dfc7467 ctr: Avoid staticcheck on imported file
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-12-28 15:30:41 -05:00
Stefan Berger 3c4442c99a ctr: Avoid staticcheck on seed.WithTimeAndRand
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-12-28 15:15:46 -05:00
Stefan Berger 9e8e1c1df3 ctr: Sync code with containerd v1.6.23 ctr
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-08-15 10:28:46 -04:00
Stefan Berger 0f2559e3c9 ctr: Sync code with containerd v1.6.20 ctr
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-08-15 08:36:11 -04:00
Stefan Berger c48dd78700 cmd: Copy IntToInt32Array into img package and use it
Since IntToInt32Array was removed from commands package, move it into
out own img package.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-08-15 08:16:30 -04:00
Stefan Berger 002abac5a5 images: Change 'any' to 'anything' to avoid clash with built-in type 'any'
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-05-01 11:30:48 -04:00
Austin Vazquez 981a3fdd5a Remove references to package io/ioutil
Package io/ioutil has been marked deprecated in Go 1.16.

Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2022-11-10 00:07:32 +00:00
Stefan Berger 06da359b73 Add support for zstd type of compressed layers
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Resolves: https://github.com/containerd/imgcrypt/issues/95
2022-10-07 12:24:22 -04:00
Stefan Berger 2c93cef1eb ctr: Document that import of encrypted image requires decryption key
The import of an encrypted image requires the decryption key as proof
that one posses one of the decryption keys of the image. However, the
image will not be decrypted as part of the import. The alternative path
that does not require the decryption key is to pull the image from a
repository.

The underlying reason why one needs the key is because containerd sends
an encrypted layer to ctd-decoder which needs the decryption key for the
decryption of that layer and for the import to succeed.

It is not currently clear what the layer represents and why it is part
of an exported image. The layer that is sent for the current alpine
image is the layer with the hash ff7f8bb.. from here:

./blobs/sha256/8a1591...:
{"architecture":"amd64",[...]
 {"type":"layers",
  "diff_ids":
    ["sha256:ff7f8bbf1c81b508f82b1c59e8c2467175c0b33e58a79507f4fde8067d6f1897",
     "sha256:c32387d564776805eb144718cd41629761e1980280c9d512df358b60f9fe6ba3"]
 }
}

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2022-09-19 09:22:12 -04:00
Stefan Berger 44f4e187e2 ctr: Add support for --all-platforms to encrypt command
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2022-09-19 09:22:12 -04:00
Stefan Berger d9fccdc463 ctr: Sync with upstream ctr and add --skip-digest-for-named opt to import
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2022-09-19 09:22:12 -04:00
Stefan Berger b8f807f68a ctr: Sync with upstream ctr and add --platform option to import
Signed-off-by: Stefan Berger <stefab@linux.ibm.com>
2022-09-19 09:22:12 -04:00
Kazuyoshi Kato 9f08722ade Use reflect to support diff.ApplyConfig with/without gogo's types.Any
containerd is migrating off from github.com/gogo/protobuf
(see https://github.com/containerd/containerd/issues/6564).

However imgcrypt depends containerd and containerd also depends
imgcrypt, which makes changing this signature complicated.

This change workarounds the issue by using Go's reflect package.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-21 00:33:17 +00:00
Kazuyoshi Kato 6eaeb4a586 Add build tags to make gofmt happy
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-20 17:04:13 +00:00
Akihiro Suda fe5e256b4c
Decouple CreateCryptoConfig() from github.com/urfave/cli
Decouple `CreateCryptoConfig()` from `github.com/urfave/cli`, so that it
can be called from other applications that do not use `github.com/urfave/cli`.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-10-29 15:10:23 +09:00
zounengren 967ee1fc62 replace pkg/errors and bump related library
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-09-22 17:23:25 -04:00
Stefan Berger 5c4f3ee7f4 Sync ctr-enc with containerd's ctr v1.5.0-rc.3
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-05-07 20:32:42 -04:00
Stefan Berger 6173025deb helpers: Sync parse_helpers.go with ocicrypt's file
This patch syncs the parse_helpers.go with ocicrypto's parse_helpers.go.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-01-25 18:22:03 -05:00
Stefan Berger d72290977c Update to ocicrypt v1.1.0
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-01-25 18:16:51 -05:00
Stefan Berger 3723f9c1c9 Apply gofmt on run.go
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-10-21 13:40:43 -04:00
Stefan Berger f8581ead31 pkcs11: Update to latest ocicrypt and roll back some changes
Update to the latest ocicrypt and adjust the code accordingly. Ocicrypt
now gets the user-provided configuration for pkcs11 only if a pkcs11 key
in yaml format is provided. This avoids unnecessary error messages if for
example an image is pulled but doesn't need pkcs11 configuration since
no keys are needed since it doesn't need to be decrypted. Also, the helper
functions ending in 'WithOpts' do not exist anymore and so we roll back some
of the previous changes.

Also, due to the changes, the config file is searched for in this order:
- ${OCICRYPT_CONFIG}="internal": use an internal allow-all policy
- ${OCICRYPT_CONFIG}
- ${XDG_CONFIG_HOME}/ocicrypt.conf
- ${HOME}/.config/ocicrypt.conf
- /etc/ocicrypt.conf

The previously used IMGCRYPT_CONFIG variable is not used anymore.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-10-20 07:21:10 -04:00
Stefan Berger 0d835cf0d0 pkcs11: Use CryptoConfigOpts from enchelpers
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-10-15 16:52:46 -04:00
Stefan Berger 18a4ccda33 ctr-enc: Add warning about pkcs11 usage currently being experimental
While ocicrypt's pkcs11 support is experimental we display a warning when using
pkcs11 keys for encryption.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-29 10:37:31 -04:00
Stefan Berger d95ea7ae27 Add pkcs11 support
Extend the parse_helpers with pkcs11 support.

We introduce a configuration file from which pkcs11 parameters are read. A config file
may look like this:

pkcs11:
  module-directories:
    - /usr/lib64/pkcs11/
  allowed-module-paths:
    - /usr/lib64/pkcs11/libsofthsm2.so

The module-directories enumerates directories in which to look for pkcs11 modules.
The allowed-module-paths restricts the pkcs11 modules that can be used.

The config file is searched for in this order:
- ${IMGCRYPT_CONF}
- ${XDG_CONFIG_HOME}/imgcrypt.conf
- ${HOME}/.config/imgcrypt.conf
- /etc/imgcrypt.conf

If no config file can be found then an internal default configuration is used.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-29 10:37:31 -04:00
Stefan Berger 99a6c7aabe Create CreateCryptoConfig in parse_helpers and have encrypt.go use it.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-29 10:37:31 -04:00
Stefan Berger 5922a4e04c images: Move functions into parse_helpers.go to resemble ocicrypt
ocicrypt has a parse_helpers.go that has similar functions as those in
crypt_utils.go. To resemble ocicrypt's parse_helpers.go move functions
out of crypt_utils.go into our own parse_helpers.go. Ultimately we should
be using ocicrypt's parse_helpers.go and get rid of ours.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-29 10:37:31 -04:00
Brandon Lum bdd59ce7dc Implement decryption-keys-path capabilities to use local keys
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
2020-01-06 09:07:53 +00:00
Brandon Lum 3234bf723a Refactor options in images/encryption/client
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
2019-11-13 20:49:03 -05:00
Stefan Berger cb61fda0fc Use mediatypes from ocicrypt and use latest containerd
The mediatype we used before was only experimental:

   application/vnd.docker.image.rootfs.diff.tar.gzip+enc

The newer one is

   application/vnd.oci.image.layer.v1.tar+gzip+enc

Update to latest containerd and adjust code to it.

We need to update the mediatypes being used by GetImageLayerDescriptors,
so we move the function into our own directory.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-09-27 16:48:07 -04:00