Skip to content

Commit 6d3eb4f

Browse files
automated commit
Signed-off-by: Public copy <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 0641463 commit 6d3eb4f

3 files changed

Lines changed: 174 additions & 92 deletions

File tree

images/cosign/README.md

Lines changed: 101 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -32,49 +32,41 @@ Be sure to replace the `ORGANIZATION` placeholder with the name used for your or
3232
<!--getting:end-->
3333

3434
<!--body:start-->
35+
## Compatibility Notes
36+
Like most other Chainguard Images, the Cosign image has few-to-zero CVEs and does not run as the root user.
3537

38+
## Getting Started
39+
You can use the Cosign image to sign and verify container images via Docker or through automated workflows such as GitHub Actions.
3640

41+
### Verifying a container image signature
42+
To verify an image signature, use the image to run Cosign's `verify` command. As of Cosign 2.0, Cosign defaults to using Sigstore's keyless mode, you'll need to also specify the OIDC issuer and signer identity to tell Cosign who you trust for the verification process.
3743

38-
## Image Variants
39-
40-
Our `latest` tag uses the most recent build of the [Wolfi Cosign](https://github.com/wolfi-dev/os/blob/main/cosign.yaml) package. The following tagged variant is available without authentication:
41-
42-
- `latest`: This is an image for running `cosign` commands. It does not include a shell or other applications.
43-
44-
### Cosign Version
45-
This will automatically pull the image to your local system and execute the command `cosign version`:
44+
For convenience, you can export those values as environment variables in your shell, and then tell Docker to pass those environment variables into the running Cosign container:
4645

4746
```shell
48-
docker run --rm cgr.dev/chainguard/cosign version
47+
export COSIGN_CERTIFICATE_OIDC_ISSUER=https://token.actions.githubusercontent.com
48+
export COSIGN_CERTIFICATE_IDENTITY=https://github.com/chainguard-images/images/.github/workflows/release.yaml@refs/heads/main
4949
```
5050

51-
You should see output similar to this:
51+
The following example uses the Cosign image to verify the signature of the Cosign image itself:
5252

5353
```
54-
______ ______ _______. __ _______ .__ __.
55-
/ | / __ \ / || | / _____|| \ | |
56-
| ,----'| | | | | (----`| | | | __ | \| |
57-
| | | | | | \ \ | | | | |_ | | . ` |
58-
| `----.| `--' | .----) | | | | |__| | | |\ |
59-
\______| \______/ |_______/ |__| \______| |__| \__|
60-
cosign: A tool for Container Signing, Verification and Storage in an OCI registry.
61-
62-
...
63-
Platform: linux/arm64
54+
docker run --rm \
55+
-e COSIGN_CERTIFICATE_OIDC_ISSUER \
56+
-e COSIGN_CERTIFICATE_IDENTITY \
57+
cgr.dev/chainguard/cosign \
58+
verify cgr.dev/chainguard/cosign
6459
```
6560

66-
67-
68-
## Usage
69-
7061
### Signing a container image
7162

72-
For example, from GitHub Actions:
63+
The following GitHub Action will log into the registry, push an image, and then sign it with Cosign:
7364

7465

7566
```yaml
7667
on:
77-
push:
68+
workflow_dispatch:
69+
7870
env:
7971
IMAGE: ghcr.io/${{ github.repository }}
8072
DOCKER_CONFIG: .docker-tmp
@@ -85,7 +77,7 @@ jobs:
8577
id-token: write
8678
packages: write
8779
steps:
88-
- name: Login to registry
80+
- name: Log in to registry
8981
run: |
9082
set -x
9183
mkdir -p "${DOCKER_CONFIG}"
@@ -96,8 +88,8 @@ jobs:
9688
- name: Push image with docker
9789
run: |
9890
set -x
99-
docker pull alpine:latest
100-
docker tag alpine:latest "${IMAGE}"
91+
docker pull cgr.dev/chainguard/wolfi-base
92+
docker tag cgr.dev/chainguard/wolfi-base "${IMAGE}"
10193
docker push "${IMAGE}"
10294
- name: Sign image with cosign
10395
run: |
@@ -112,35 +104,103 @@ jobs:
112104
-a sha=${{ github.sha }} \
113105
-a run_id=${{ github.run_id }} \
114106
-a run_attempt=${{ github.run_attempt }}
107+
```
108+
109+
### Attesting to an image's SBOM
110+
111+
Another common use case for Cosign is attesting to an image's SBOM (software bill of materials). The following command creates an attestation of type `spdxjson` for an image based on the provided SBOM file and image digest:
112+
113+
```shell
114+
docker run --rm cgr.dev/chainguard/cosign attest --type spdxjson \
115+
--predicate example-image.spdx.json \
116+
sha256:7f95c5aa7e789ad51737e03021586949346f38ced1533ecdcb2ef2b9104137ac
115117
116118
```
117119

118-
### Verifying a container image signature
120+
A detailed guide on how to sign an SBOM with Cosign is available on [Chainguard Academy](https://edu.chainguard.dev/open-source/sigstore/cosign/how-to-sign-an-sbom-with-cosign/).
119121

120-
To verify an image signature, use the image to run Cosign's `verify` command. Since as of Cosign 2.0, Cosign defaults to using Sigstore's keyless mode, you'll need to also specify the OIDC issuer and signer identity to tell Cosign who you trust for the verification process.
121122

122-
For convenience, you can export those values as environment variables in your shell, and then tell Docker to pass those environment variables into the running Cosign container.
123+
### Verifying an Attestation
123124

124-
For example, to use the Cosign image to verify the signature of the Cosign image itself:
125+
Cosign can also be used to verify the identity of the person or entity issuing an attestation. To verify that an attestation was issued by a specific entity, we use the `cosign verify-attestation` command, specifying the email address of the issuer:
125126

126127
```shell
127-
export COSIGN_CERTIFICATE_OIDC_ISSUER=https://token.actions.githubusercontent.com
128-
export COSIGN_CERTIFICATE_IDENTITY=https://github.com/chainguard-images/images/.github/workflows/release.yaml@refs/heads/main
128+
cosign verify-attestation \
129+
--certificate-oidc-issuer=https://github.com/login/oauth \
130+
--type https://spdx.dev/Document \
131+
--certificate-identity=emailaddress@emailprovider.com \
132+
sha256:7f95c5aa7e789ad51737e03021586949346f38ced1533ecdcb2ef2b9104137ac
133+
```
129134

130-
docker run --rm \
131-
-e COSIGN_CERTIFICATE_OIDC_ISSUER \
132-
-e COSIGN_CERTIFICATE_IDENTITY \
133-
cgr.dev/chainguard/cosign \
134-
verify cgr.dev/chainguard/cosign
135+
If the identity is successfully verified, an initial message similar to the following is printed to stderr:
136+
137+
```shell
138+
Verification for user/example-image@sha256:545a731e803b917daf44e292b03b427427f8090c4e6c4a704e4c18d56c38539f --
139+
The following checks were performed on each of these signatures:
140+
- The cosign claims were validated
141+
- Existence of the claims in the transparency log was verified offline
142+
- The code-signing certificate was verified using trusted certificate authority certificates
143+
Certificate subject: <you@domain.com>
144+
Certificate issuer URL: https://github.com/login/oauth
135145
```
136146

137-
## Detailed Environment Information
147+
## Configuration
148+
149+
The following environment variables are required when verifying a container image signature:
150+
151+
- `COSIGN_CERTIFICATE_OIDC_ISSUER`: Trusted OIDC issuer, example: `https://token.actions.githubusercontent.com`
152+
- `COSIGN_CERTIFICATE_IDENTITY`: Trusted certificate identity, example: `https://github.com/chainguard-images/images/.github/workflows/release.yaml@refs/heads/main`
153+
154+
### Detailed Environment Information
138155

139156
To obtain detailed information about the environment, you can run the `cosign env` command:
140157

141158
```shell
142159
docker run --rm cgr.dev/chainguard/cosign env --show-descriptions=false
143160
```
161+
162+
You'll get output similar to this, containing the environment variables used to configure Cosign:
163+
164+
```shell
165+
ACTIONS_ID_TOKEN_REQUEST_TOKEN=
166+
ACTIONS_ID_TOKEN_REQUEST_URL=
167+
BUILDKITE_AGENT_ACCESS_TOKEN=
168+
BUILDKITE_AGENT_ENDPOINT=
169+
BUILDKITE_AGENT_LOG_LEVEL=
170+
BUILDKITE_JOB_ID=
171+
COSIGN_DOCKER_MEDIA_TYPES=
172+
COSIGN_EXPERIMENTAL=
173+
COSIGN_MAX_ATTACHMENT_SIZE=
174+
COSIGN_PASSWORD=
175+
COSIGN_PKCS11_IGNORE_CERTIFICATE=
176+
COSIGN_PKCS11_MODULE_PATH=
177+
COSIGN_PKCS11_PIN=
178+
COSIGN_REPOSITORY=
179+
GITHUB_HOST=
180+
GITHUB_TOKEN=
181+
GITLAB_HOST=
182+
GITLAB_TOKEN=
183+
GOOGLE_SERVICE_ACCOUNT_NAME=
184+
SIGSTORE_CT_LOG_PUBLIC_KEY_FILE=
185+
SIGSTORE_ID_TOKEN=
186+
SIGSTORE_REKOR_PUBLIC_KEY=
187+
SIGSTORE_ROOT_FILE=
188+
SIGSTORE_TSA_CERTIFICATE_FILE=
189+
SOURCE_DATE_EPOCH=
190+
SPIFFE_ENDPOINT_SOCKET=
191+
COSIGN_CERTIFICATE_OIDC_ISSUER=******
192+
COSIGN_CERTIFICATE_IDENTITY=******
193+
```
194+
195+
## Documentation and Resources
196+
197+
- [Chainguard Academy: An Introduction to Cosign](https://edu.chainguard.dev/open-source/sigstore/cosign/an-introduction-to-cosign/)
198+
- [Blog Post: Chainguard announces new Sigstore Images to bring critical software supply chain tooling to enterprises](https://www.chainguard.dev/unchained/chainguard-announces-new-sigstore-images-to-bring-critical-software-supply-chain-tooling-to-enterprises)
199+
- [Chainguard Academy: How to Sign an SBOM with Cosign](https://edu.chainguard.dev/open-source/sigstore/cosign/how-to-sign-an-sbom-with-cosign/)
200+
- [Chainguard Academy: Verifying Chainguard Images and Metadata Signatures with Cosign](https://edu.chainguard.dev/chainguard/chainguard-images/verifying-chainguard-images-and-metadata-signatures-with-cosign/)
201+
202+
- [Video: Signing and Verifying Container Images With Sigstore Cosign and Kyverno ](https://www.youtube.com/watch?v=HLb1Q086u6M)
203+
144204
<!--body:end-->
145205

146206
## Contact Support

images/redis/README.md

Lines changed: 71 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<!--overview:start-->
1616
# Chainguard Image for redis
1717

18-
Minimalist Wolfi-based [Redis](https://github.com/redis/redis) image.
18+
Chainguard image for [Redis](https://github.com/redis/redis), an in-memory database that persists on disk. Redis is a key-value store, supporting an array of different values, including Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs, and Bitmaps.
1919

2020
Chainguard Images are regularly-updated, minimal container images with low-to-zero CVEs.
2121
<!--overview:end-->
@@ -32,87 +32,108 @@ Be sure to replace the `ORGANIZATION` placeholder with the name used for your or
3232
<!--getting:end-->
3333

3434
<!--body:start-->
35+
## Compatibility Notes
3536

36-
## Important - license update
37+
The Chainguard Redis image is comparable to [the official Redis image on Docker Hub](https://hub.docker.com/_/redis).
3738

38-
Redis version 7.4 and subsequent releases are no longer licensed under
39-
BSD-3-Clause. A dual licensing model has been adopted, of which users have the
40-
choice to adopt either RSALv2 or SSPLv1.
39+
Unlike many other Chainguard images, the Redis image includes a shell, allowing you to interact with the Redis database using the Redis command-line interface, `redis-cli`.
4140

42-
Please give careful consideration to the licensing conditions when consuming
43-
redis. For more information, refer to the [upstream license information](https://github.com/redis/redis/blob/unstable/LICENSE.txt).
41+
By default this image runs as a non-root user named `redis` with a uid of `65532`. Typically, Redis does not have a default data directory and instead defaults to whatever the working directory is for the Redis process. The Chainguard Redis image provides a default working directory of `/data` that is writeable by the `redis` user.
4442

45-
## Overview
43+
### Important license update
4644

47-
Redis is an in-memory database that persists on disk.
45+
Redis version 7.4 and subsequent releases are no longer licensed under BSD-3-Clause; instead, the Redis project has adopted a dual licensing model. This means users have the choice to adopt either the Redis Source Available License v2 (RSALv2) or the Server Side Public License v1 (SSPLv1).
4846

49-
The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs, Bitmaps.
47+
Please give careful consideration to these licensing conditions when using Redis. For more details, refer to the [upstream license information](https://github.com/redis/redis/blob/unstable/LICENSE.txt).
5048

51-
- [Documentation](https://edu.chainguard.dev/chainguard/chainguard-images/reference/redis)
52-
- [Provenance Information](https://edu.chainguard.dev/chainguard/chainguard-images/reference/redis/provenance_info/)
49+
## Getting Started
5350

54-
## Image Variants
51+
To run the Chainguard Redis image with Docker using default configuration you could run the following command:
5552

56-
Our `latest` tag use the most recent build of the [Wolfi Redis](https://github.com/wolfi-dev/os/blob/main/redis.yaml) package.
57-
The `latest` tagged variant is a distroless image for running Redis.
53+
```sh
54+
docker run -p 6379:6379 --rm cgr.dev/chainguard/redis
55+
```
5856

59-
## Redis Version
60-
This will automatically pull the image to your local system and execute the command `redis --version`:
57+
This command forwards port `6379` (the default port for Redis) on the host machine to port `6379` on the container:
6158

62-
```shell
63-
docker run --rm cgr.dev/chainguard/redis --version
59+
```
60+
1:C 25 Oct 2024 17:12:32.419 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
61+
1:C 25 Oct 2024 17:12:32.419 * Redis version=7.4.1, bits=64, commit=74b289a0, modified=1, pid=1, just started
62+
1:C 25 Oct 2024 17:12:32.419 # Warning: no config file specified, using the default config. In order to specify a config file use /usr/bin/redis-server /path/to/redis.conf
63+
1:M 25 Oct 2024 17:12:32.420 * monotonic clock: POSIX clock_gettime
64+
1:M 25 Oct 2024 17:12:32.420 * Running mode=standalone, port=6379.
65+
1:M 25 Oct 2024 17:12:32.421 * Server initialized
66+
1:M 25 Oct 2024 17:12:32.421 * Ready to accept connections tcp
6467
```
6568

66-
You should see output similar to this:
69+
Following that, you can open another terminal and use `redis-cli` locally. Any commands you run through it will be forwarded to the `redis` process in the container:
6770

6871
```
69-
Redis server v=7.0.8 sha=00000000:0 malloc=libc bits=64 build=736cb94cbb0b299
72+
$ redis-cli set test 10
73+
OK
74+
$ redis-cli get test
75+
"10"
76+
$ redis-cli
77+
127.0.0.1:6379>
7078
```
7179

72-
## Using Redis
73-
74-
The default redis port is 6379.
75-
To run with Docker using default configuration:
80+
Alternatively, to test out Redis within the container, you can run the following command to access the container's shell:
7681

7782
```sh
78-
docker run -p 6379:6379 --rm cgr.dev/chainguard/redis
79-
1:C 27 Dec 2022 16:42:20.647 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
80-
1:C 27 Dec 2022 16:42:20.647 # Redis version=7.0.7, bits=64, commit=00000000, modified=0, pid=1, just started
81-
1:C 27 Dec 2022 16:42:20.647 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
82-
1:M 27 Dec 2022 16:42:20.648 * monotonic clock: POSIX clock_gettime
83-
1:M 27 Dec 2022 16:42:20.648 * Running mode=standalone, port=6379.
84-
1:M 27 Dec 2022 16:42:20.648 # Server initialized
85-
1:M 27 Dec 2022 16:42:20.650 * Ready to accept connections
83+
docker run -it --entrypoint sh cgr.dev/chainguard/redis
84+
```
85+
86+
Then run the `redis-server` command to start the `redis` process, and include the `--daemonize yes` option to prevent it from taking over the terminal:
87+
88+
```
89+
/data $ redis-server --daemonize yes
90+
```
91+
92+
Following that, you can run `redis-cli`, the Redis command-line interface, and begin testing the database:
93+
94+
```
95+
/data $ redis-cli
96+
127.0.0.1:6379> set test 20
97+
OK
98+
127.0.0.1:6379> get test
99+
"20"
86100
```
87101

88-
## Users and Directories
102+
## Configuration
89103

90-
By default this image runs as a non-root user named `redis` with a uid of 65532.
91-
Redis does not have a default data directory, it defaults to whatever the working directory is for the process.
92-
We provide a default `WORKDIR` of `/data` that is writeable by the `redis` user.
104+
If you supply a different configuration file or change the user, UID, or `WORKDIR` instruction, you'll need to ensure the user running the `redis` process has permissions to access the relevant `redis.conf` and `dumb.rb` files.
93105

94-
If you supply a different configuration file or change the user, UID, or `WORKDIR`, you'll need to ensure the user running the redis
95-
process has permissions to write to that directory.
106+
When running in Docker using a volume, the Chainguard Redis image will automatically use a custom configuration instead of the default one. Here's an example that mounts a host volume containing a custom Redis configuration to the `/data` directory in the container:
96107

97-
When running in Docker using a volume, that should also be taken care of automatically.
98-
Here's an example of using a host volume:
108+
```sh
109+
docker run -d -v $(pwd):/data -p 6379:6379 cgr.dev/chainguard/redis
110+
```
111+
112+
Again, this example forwards the local port `6379` to the container's port `6379`, the `redis` process's default port.
113+
114+
Following that, you can run `redis-cli` commands from your local machine which are then forwarded to the container:
99115

100116
```
101-
% docker run -d -v $(pwd):/data -p 6379:6379 redis
102-
d029bfb291c7a00618342ab26702dc3788cfda24b85208de04464ccb06681797
103117
$ redis-cli set foo bar
104118
OK
105-
$ redis-cli save
106-
OK
107119
$ redis-cli get foo
108120
"bar"
109-
$ docker kill d029bfb291c7a00618342ab26702dc3788cfda24b85208de04464ccb06681797
110-
d029bfb291c7a00618342ab26702dc3788cfda24b85208de04464ccb06681797
111-
$ docker run -d -v $(pwd):/data -p 6379:6379 redis
112-
29845f88b862d8e337cf8183e8fb6ac1bd9b43c4ec2de37111bfe08b227e1caa
113-
$ redis-cli get foo
121+
```
122+
123+
You can also open the `redis-cli` prompt locally and forward commands to the container from there:
124+
125+
```
126+
$ redis-cli
127+
127.0.0.1:6379> get foo
114128
"bar"
115129
```
130+
131+
## Documentation and Resources
132+
133+
* [Official Redis Documentation](https://redis.io/docs/latest/)
134+
* (eBook) [How To Manage a Redis Database](https://www.digitalocean.com/community/books/how-to-manage-a-redis-database-ebook)
135+
* (Tutorial) [How to Port a Sample Application to Chainguard Images](https://edu.chainguard.dev/chainguard/migration/porting-apps-to-chainguard/) — this article works through porting a small but complete application (built on NodeJS and Redis) to use Chainguard Images
136+
* [Vulnerability Comparison: redis](https://edu.chainguard.dev/chainguard/chainguard-images/vuln-comparison/redis/)
116137
<!--body:end-->
117138

118139
## Contact Support

images/redis/metadata.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ image: cgr.dev/chainguard/redis
33
logo: https://storage.googleapis.com/chainguard-academy/logos/redis.svg
44
endoflife: ""
55
console_summary: ""
6-
short_description: Minimalist Wolfi-based [Redis](https://github.com/redis/redis) image.
6+
short_description: Chainguard image for [Redis](https://github.com/redis/redis), an in-memory database that persists on disk. Redis is a key-value store, supporting an array of different values, including Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs, and Bitmaps.
77
compatibility_notes: ""
88
readme_file: README.md
99
upstream_url: https://github.com/redis/redis
1010
keywords:
1111
- application
12+
tier: APPLICATION
1213
aliases:
1314
- redis:latest

0 commit comments

Comments
 (0)