Skip to content

Commit c7d5655

Browse files
gbartolinifcanovai
authored andcommitted
docs: image signing
Signed-off-by: Gabriele Bartolini <[email protected]> Signed-off-by: Francesco Canovai <[email protected]>
1 parent a4ace2b commit c7d5655

File tree

2 files changed

+28
-62
lines changed

2 files changed

+28
-62
lines changed

BUILD.md

Lines changed: 5 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -122,69 +122,12 @@ docker run -d --rm -p 5000:5000 --name registry registry:2
122122
This command runs a lightweight, temporary instance of the `registry:2`
123123
container on port `5000`.
124124

125-
# Image Signatures
126-
127-
Every image is signed using cosign and an ephemeral key with GitHub as the OIDC provider, the images can be
128-
verify using the following command:
129-
130-
```shell
131-
cosign verify --certificate-identity-regexp="https://github.com/cloudnative-pg/postgres-containers/.github/workflows/" \
132-
--certificate-oidc-issuer="https://token.actions.githubusercontent.com" \
133-
ghcr.io/cloudnative-pg/postgresql(-testing)@<sha256 image>
134-
```
135-
136-
Using the following image:
137-
`ghcr.io/cloudnative-pg/postgresql-testing@sha256:e5d7aaf92103ecabd4ea4c109e49727692b1c47174fb77d8e17ef1e29685d7dd`
138-
We can execute the following command with the following output
139-
140-
```shell
141-
cosign verify --certificate-identity-regexp="https://github.com/cloudnative-pg/postgres-containers/.github/workflows/" --certificate-oidc-issuer="https://token.actions.githubusercontent.com" ghcr.io/cloudnative-pg/postgresql-testing@sha256:e5d7aaf92103ecabd4ea4c109e49727692b1c47174fb77d8e17ef1e29685d7dd | jq
142-
143-
Verification for ghcr.io/cloudnative-pg/postgresql-testing@sha256:e5d7aaf92103ecabd4ea4c109e49727692b1c47174fb77d8e17ef1e29685d7dd --
144-
The following checks were performed on each of these signatures:
145-
- The cosign claims were validated
146-
- Existence of the claims in the transparency log was verified offline
147-
- The code-signing certificate was verified using trusted certificate authority certificates
148-
[
149-
{
150-
"critical": {
151-
"identity": {
152-
"docker-reference": "ghcr.io/cloudnative-pg/postgresql-testing"
153-
},
154-
"image": {
155-
"docker-manifest-digest": "sha256:e5d7aaf92103ecabd4ea4c109e49727692b1c47174fb77d8e17ef1e29685d7dd"
156-
},
157-
"type": "cosign container image signature"
158-
},
159-
"optional": {
160-
"1.3.6.1.4.1.57264.1.1": "https://token.actions.githubusercontent.com",
161-
"1.3.6.1.4.1.57264.1.2": "workflow_dispatch",
162-
"1.3.6.1.4.1.57264.1.3": "504be3a25448fa5277f712ee8df1ded1066ed164",
163-
"1.3.6.1.4.1.57264.1.4": "Bake images",
164-
"1.3.6.1.4.1.57264.1.5": "cloudnative-pg/postgres-containers",
165-
"1.3.6.1.4.1.57264.1.6": "refs/heads/dev/136",
166-
"Bundle": {
167-
"SignedEntryTimestamp": "MEQCIGTI2BU4HroJxyY5iSLckxjezt9j8HiVSkyNsRn2GfgBAiBwrfzC872HdkpjWD3p9VH6lxAQg3N+UAcyKlFO08EJBw==",
168-
"Payload": {
169-
"body": "eyJhcGlWZXJzaW9uIjoiMC4wLjEiLCJraW5kIjoiaGFzaGVkcmVrb3JkIiwic3BlYyI6eyJkYXRhIjp7Imhhc2giOnsiYWxnb3JpdGhtIjoic2hhMjU2IiwidmFsdWUiOiI2NGEyZjMzMGQzYTZkN2YwOTBlNmEzNWQ0MWI1ZDljZGM1ZDQ1YzRhZTRhNWYwNTk1YTZiNjIzN2QzNzBkOWIxIn19LCJzaWduYXR1cmUiOnsiY29udGVudCI6Ik1FWUNJUUMvMGdYamRVNThhbG1OQ2pRUjVmb0RUK2JCcmlWa2UyNUNUeGNlM2FSem5BSWhBUFRyeUFMRHdGTDFOTjgrVVpxTGZSWHFwNjJtcld5VUpLNXlqSXhPYUVlMSIsInB1YmxpY0tleSI6eyJjb250ZW50IjoiTFMwdExTMUNSVWRKVGlCRFJWSlVTVVpKUTBGVVJTMHRMUzB0Q2sxSlNVaFBWRU5EUW5JclowRjNTVUpCWjBsVllXMVdURFpXVERWSVFuTnJhbUZGTjNKaE9FRnBMMFp3UzBKUmQwTm5XVWxMYjFwSmVtb3dSVUYzVFhjS1RucEZWazFDVFVkQk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kRWbFpXZWpSS0t6WmhVV1UzYW1KR04zSTVhak5DYjFaSGFncFVlR1J1VVZKMlNXSmxOR3hrUmxaeFpIbENObmhTTVhwcVYybEtRamxPTTFCa2NGWm5SR3M5Q2kwdExTMHRSVTVFSUVORlVsUkpSa2xEUVZSRkxTMHRMUzBLIn19fX0=",
170-
"integratedTime": 1737391476,
171-
"logIndex": 163912591,
172-
"logID": "c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d"
173-
}
174-
},
175-
"Issuer": "https://token.actions.githubusercontent.com",
176-
"Subject": "https://github.com/cloudnative-pg/postgres-containers/.github/workflows/bake.yaml@refs/heads/dev/136",
177-
"githubWorkflowName": "Bake images",
178-
"githubWorkflowRef": "refs/heads/dev/136",
179-
"githubWorkflowRepository": "cloudnative-pg/postgres-containers",
180-
"githubWorkflowSha": "504be3a25448fa5277f712ee8df1ded1066ed164",
181-
"githubWorkflowTrigger": "workflow_dispatch"
182-
}
183-
}
184-
]
185-
```
186-
125+
## Image Signing Workflow
187126

127+
Postgres operand images are securely signed with [cosign](https://github.com/sigstore/cosign)
128+
based on their digest through a GitHub workflow, using the
129+
[`cosign-installer` action](https://github.com/marketplace/actions/cosign-installer), which leverages
130+
[short-lived tokens issued through OpenID Connect](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect).
188131

189132
## Trademarks
190133

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,29 @@ docker buildx imagetools inspect <IMAGE> --format "{{ json .SBOM.SPDX }}"
118118
This command outputs the SBOM in JSON format, providing a detailed view of the
119119
software components and build dependencies.
120120

121+
## Image Signatures
122+
123+
CloudNativePG container images are securely signed using
124+
[cosign](https://github.com/sigstore/cosign), a tool within the
125+
[Sigstore](https://www.sigstore.dev/) ecosystem.
126+
This signing process is automated via GitHub Actions and leverages
127+
[short-lived tokens issued through OpenID Connect](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect).
128+
129+
The token issuer is `https://token.actions.githubusercontent.com`, and the
130+
signing identity corresponds to a GitHub workflow executed under the
131+
`cloudnative-pg/postgres-containers` repository. This workflow uses the
132+
[`cosign-installer` action](https://github.com/marketplace/actions/cosign-installer)
133+
to facilitate the signing process.
134+
135+
To verify the authenticity of an image using its digest, you can run the
136+
following `cosign` command:
137+
138+
```sh
139+
cosign verify IMAGE@DIGEST \
140+
--certificate-identity-regexp="^https://github.com/cloudnative-pg/postgres-containers/" \
141+
--certificate-oidc-issuer="https://token.actions.githubusercontent.com"
142+
```
143+
121144
## Building Images
122145

123146
For detailed instructions on building PostgreSQL container images, refer to the

0 commit comments

Comments
 (0)