|
7 | 7 | = Creating a cluster image policy CR |
8 | 8 |
|
9 | 9 | [role="_abstract"] |
10 | | -A `ClusterImagePolicy` custom resource (CR) enables a cluster administrator to configure a sigstore signature verification policy for the entire cluster. When enabled, the Machine Config Operator (MCO) watches the `ClusterImagePolicy` object and updates the `/etc/containers/policy.json` and `/etc/containers/registries.d/sigstore-registries.yaml` files on all the nodes in the cluster. |
| 10 | +A cluster administrator can use a `ClusterImagePolicy` custom resource (CR) to configure a sigstore signature verification policy for the entire cluster. |
| 11 | + |
| 12 | +When enabled, the Machine Config Operator (MCO) watches the `ClusterImagePolicy` object and updates the `/etc/containers/policy.json` and `/etc/containers/registries.d/sigstore-registries.yaml` files on all the nodes in the cluster. |
11 | 13 |
|
12 | 14 | The following example shows general guidelines on how to configure a `ClusterImagePolicy` object. For more details on the parameters, see "About cluster and image policy parameters." |
13 | 15 |
|
@@ -35,117 +37,126 @@ mirror.com/image/repo:sha256-1234567890abcdef1234567890abcdef1234567890abcdef123 |
35 | 37 |
|
36 | 38 | . Create a cluster image policy object similar to the following examples. See "About image policy parameters" for specific details on these parameters. |
37 | 39 | + |
38 | | --- |
39 | | -.Example cluster image policy object with a public key policy and the `MatchRepoDigestOrExact` match policy |
| 40 | +The following example cluster image policy object uses a public key policy and the `MatchRepoDigestOrExact` match policy: |
| 41 | ++ |
40 | 42 | [source,yaml] |
41 | 43 | ---- |
42 | 44 | apiVersion: config.openshift.io/v1 |
43 | | -kind: ClusterImagePolicy <1> |
| 45 | +kind: ClusterImagePolicy |
44 | 46 | metadata: |
45 | 47 | name: p1 |
46 | 48 | spec: |
47 | | - scopes: <2> |
| 49 | + scopes: |
48 | 50 | - example.com |
49 | | - policy: <3> |
50 | | - rootOfTrust: <4> |
51 | | - policyType: PublicKey <5> |
| 51 | + policy: |
| 52 | + rootOfTrust: |
| 53 | + policyType: PublicKey |
52 | 54 | publicKey: |
53 | | - keyData: a2V5RGF0YQ== <6> |
54 | | - rekorKeyData: cmVrb3JLZXlEYXRh <7> |
55 | | - signedIdentity: <8> |
| 55 | + keyData: a2V5RGF0YQ== |
| 56 | + rekorKeyData: cmVrb3JLZXlEYXRh |
| 57 | + signedIdentity: |
56 | 58 | matchPolicy: MatchRepoDigestOrExact |
57 | 59 | ---- |
58 | | -<1> Creates a `ClusterImagePolicy` object. |
59 | | -<2> Defines a list of repositories or images assigned to this policy. In a cluster image policy, make sure that the policy does not block the deployment of the {product-title} images in the `quay.io/openshift-release-dev/ocp-release` and `quay.io/openshift-release-dev/ocp-v4.0-art-dev` repositories. Images in these repositories are required for cluster operation. |
60 | | -<3> Specifies the parameters that define how the images are verified. |
61 | | -<4> Defines a root of trust for the policy. |
62 | | -<5> Specifies the policy types that define the root of trust, either a public key, a BYOPKI certificate, or a link:https://docs.sigstore.dev/certificate_authority/overview/[Fulcio certificate]. This example uses a public key with Rekor verification. |
63 | | -<6> For a public key policy, specifies a base64-encoded public key in the PEM format. The maximum length is 8192 characters. |
64 | | -<7> Optional: Specifies a base64-encoded Rekor public key in the PEM format. The maximum length is 8192 characters. |
65 | | -<8> Optional: Specifies one of the following processes to verify the identity in the signature and the actual image identity: |
| 60 | +where: |
| 61 | ++ |
| 62 | +-- |
| 63 | +`kind`:: Specifies that the configuration is for a `ClusterImagePolicy` object. |
| 64 | +`spec.scopes`:: Specifies a list of repositories or images assigned to this policy. In a cluster image policy, make sure that the policy does not block the deployment of the {product-title} images in the `quay.io/openshift-release-dev/ocp-release` and `quay.io/openshift-release-dev/ocp-v4.0-art-dev` repositories. Images in these repositories are required for cluster operation. |
| 65 | +`spec.policy`:: Specifies the parameters that define how the images are verified. |
| 66 | +`spec.policy.rootOfTrust`:: Specifies a root of trust for the policy. |
| 67 | +`spec.policy.rootOfTrust.policyType`:: Specifies the policy types that define the root of trust, either a public key, a BYOPKI certificate, or a link:https://docs.sigstore.dev/certificate_authority/overview/[Fulcio certificate]. This example uses a public key with Rekor verification. |
| 68 | +`spec.policy.rootOfTrust.publicKey.keyData`:: For a public key policy, specifies a base64-encoded public key in the PEM format. The maximum length is 8192 characters. |
| 69 | +`spec.policy.rootOfTrust.publicKey.rekorKeyData`:: Specifies a base64-encoded Rekor public key in the PEM format. The maximum length is 8192 characters. This parameter is optional. |
| 70 | +`spec.policy.signedIdentity`:: Specifies the process to verify the identity in the signature and the actual image identity. This parameter is optional. Specify one of the following processes: |
66 | 71 | * `MatchRepoDigestOrExact`. |
67 | 72 | * `MatchRepository`. |
68 | 73 | * `ExactRepository`. The `exactRepository` parameter must be specified. |
69 | 74 | * `RemapIdentity`. The `prefix` and `signedPrefix` parameters must be specified. |
70 | 75 | -- |
71 | 76 | + |
72 | | --- |
73 | | -.Example cluster image policy object for a BYOPKI policy and the `MatchRepository` match policy |
| 77 | +The following example cluster image policy object uses a BYOPKI policy and the `MatchRepository` match policy: |
| 78 | ++ |
74 | 79 | [source,yaml] |
75 | 80 | ---- |
76 | 81 | apiVersion: config.openshift.io/v1alpha1 |
77 | | -kind: ClusterImagePolicy <1> |
| 82 | +kind: ClusterImagePolicy |
78 | 83 | metadata: |
79 | 84 | name: pki-policy |
80 | 85 | spec: |
81 | 86 | scopes: |
82 | | - - example.io <2> |
83 | | - policy: <3> |
84 | | - rootOfTrust: <4> |
85 | | - policyType: PKI <5> |
86 | | - pki: <6> |
| 87 | + - example.io |
| 88 | + policy: |
| 89 | + rootOfTrust: |
| 90 | + policyType: PKI |
| 91 | + pki: |
87 | 92 | caRootsData: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk....URS0tLS0t |
88 | 93 | caIntermediatesData: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1J....lDQVRFLS0tLS0= |
89 | | - pkiCertificateSubject: <7> |
| 94 | + pkiCertificateSubject: |
90 | 95 | email: email@example.com |
91 | 96 | hostname: myhost.example.com |
92 | 97 | signedIdentity: |
93 | | - matchPolicy: MatchRepository <8> |
| 98 | + matchPolicy: MatchRepository |
94 | 99 | ---- |
95 | | -<1> Creates a `ClusterImagePolicy` object. |
96 | | -<2> Defines a list of repositories or images assigned to this policy. In a cluster image policy, make sure that the policy does not block the deployment of the {product-title} images in the `quay.io/openshift-release-dev/ocp-release` and `quay.io/openshift-release-dev/ocp-v4.0-art-dev` repositories. Images in these repositories are required for cluster operation. |
97 | | -<3> Specifies the parameters that define how the images are verified. |
98 | | -<4> Defines a root of trust for the policy. |
99 | | -<5> Specifies the policy types that define the root of trust, either a public key, a BYOPKI certificate, or a link:https://docs.sigstore.dev/certificate_authority/overview/[Fulcio certificate]. This example uses a BYOPKI certificate. |
100 | | -<6> For a BYOPKI certificate, specify `caRootsData`. This parameter specifies a base64-encoded CA root certificate in the PEM format. The maximum length is 8192 characters. Optionally with `caIntermediatesData`, specifies a base64-encoded intermediate CA root certificate in the PEM format. The maximum length is 8192 characters. |
101 | | -<7> Specifies a subject alternative name (SAN) to authenticate the user’s identity by using a hostname and an email address: |
| 100 | +where: |
| 101 | ++ |
| 102 | +-- |
| 103 | +`kind`:: Specifies that the configuration is for a `ClusterImagePolicy` object. |
| 104 | +`spec.scopes`:: Specifies a list of repositories or images assigned to this policy. In a cluster image policy, make sure that the policy does not block the deployment of the {product-title} images in the `quay.io/openshift-release-dev/ocp-release` and `quay.io/openshift-release-dev/ocp-v4.0-art-dev` repositories. Images in these repositories are required for cluster operation. |
| 105 | +`spec.policy`:: Specifies the parameters that define how the images are verified. |
| 106 | +`spec.policy.rootOfTrust`:: Specifies a root of trust for the policy. |
| 107 | +`spec.policy.rootOfTrust.policyType`:: Specifies the policy types that define the root of trust, either a public key, a BYOPKI certificate, or a Fulcio certificate. This example uses a BYOPKI certificate. |
| 108 | +`spec.policy.rootOfTrust.pki`:: For a BYOPKI certificate, specifies `caRootsData`. This parameter specifies a base64-encoded CA root certificate in the PEM format. The maximum length is 8192 characters. Optionally with `caIntermediatesData`, specifies a base64-encoded intermediate CA root certificate in the PEM format. The maximum length is 8192 characters. |
| 109 | +`spec.policy.rootOfTrust.pki.pkiCertificateSubject`:: Specifies a subject alternative name (SAN) to authenticate the user’s identity by using a hostname and an email address: |
102 | 110 | * `email`. Specifies the email address specified when the certificate was generated. |
103 | 111 | * `hostname`. Specifies the hostname specified when the certificate was generated. |
104 | | -<8> For a BYOPKI certificate, specify the `MatchRepository` parameter to verify the identity in the signature and the actual image identity. The default signed identity is `matchRepoDigestOrExact`, which requires a digest reference in the signature identity for verification. The signature identity in this case uses a repository reference, and does not include the image digest. |
| 112 | +`spec.policy.signedIdentity.matchPolicy`:: For a BYOPKI certificate, specifies the `MatchRepository` parameter to verify the identity in the signature and the actual image identity. The default signed identity is `matchRepoDigestOrExact`, which requires a digest reference in the signature identity for verification. The signature identity in this case uses a repository reference, and does not include the image digest. |
105 | 113 | -- |
106 | 114 | + |
107 | | --- |
108 | | -.Example cluster image policy object with a Fulcio certificate policy and the `remapIdentity` match policy |
| 115 | +The following example cluster image policy object uses a Fulcio certificate policy and the `remapIdentity` match policy: |
| 116 | ++ |
109 | 117 | [source,yaml] |
110 | 118 | ---- |
111 | 119 | apiVersion: config.openshift.io/v1 |
112 | | -kind: ClusterImagePolicy <1> |
| 120 | +kind: ClusterImagePolicy |
113 | 121 | metadata: |
114 | 122 | name: p1 |
115 | 123 | spec: |
116 | | - scopes: <2> |
| 124 | + scopes: |
117 | 125 | - example.com |
118 | | - policy: <3> |
119 | | - rootOfTrust: <4> |
120 | | - policyType: FulcioCAWithRekor <5> |
121 | | - fulcioCAWithRekor: <6> |
| 126 | + policy: |
| 127 | + rootOfTrust: |
| 128 | + policyType: FulcioCAWithRekor |
| 129 | + fulcioCAWithRekor: |
122 | 130 | fulcioCAData: a2V5RGF0YQ== |
123 | 131 | fulcioSubject: |
124 | 132 | oidcIssuer: "https://expected.OIDC.issuer/" |
125 | 133 | signedEmail: "expected-signing-user@example.com" |
126 | | - rekorKeyData: cmVrb3JLZXlEYXRh <7> |
| 134 | + rekorKeyData: cmVrb3JLZXlEYXRh |
127 | 135 | signedIdentity: |
128 | | - matchPolicy: RemapIdentity <8> |
| 136 | + matchPolicy: RemapIdentity |
129 | 137 | remapIdentity: |
130 | | - prefix: example.com <9> |
131 | | - signedPrefix: mirror-example.com <10> |
| 138 | + prefix: example.com |
| 139 | + signedPrefix: mirror-example.com |
132 | 140 | ---- |
133 | | -<1> Creates a `ClusterImagePolicy` object. |
134 | | -<2> Defines a list of repositories or images assigned to this policy. In a cluster image policy, make sure that the policy does not block the deployment of the {product-title} images in the `quay.io/openshift-release-dev/ocp-release` and `quay.io/openshift-release-dev/ocp-v4.0-art-dev` repositories. Images in these repositories are required for cluster operation. |
135 | | -<3> Specifies the parameters that define how the images are verified. |
136 | | -<4> Defines a root of trust for the policy. |
137 | | -<5> Specifies the policy types that define the root of trust, either a public key, a BYOPKI certificate, or a link:https://docs.sigstore.dev/certificate_authority/overview/[Fulcio certificate]. This example uses a Fulcio certificate with required Rekor verification. |
138 | | -<6> For a Fulcio certificate policy, the following parameters are required: |
| 141 | +where: |
| 142 | ++ |
| 143 | +-- |
| 144 | +`kind`:: Specifies that the configuration is for a `ClusterImagePolicy` object. |
| 145 | +`spec.scopes`:: Specifies a list of repositories or images assigned to this policy. In a cluster image policy, make sure that the policy does not block the deployment of the {product-title} images in the `quay.io/openshift-release-dev/ocp-release` and `quay.io/openshift-release-dev/ocp-v4.0-art-dev` repositories. Images in these repositories are required for cluster operation. |
| 146 | +`spec.policy`:: Specifies the parameters that define how the images are verified. |
| 147 | +`spec.policy.rootOfTrust`:: Specifies a root of trust for the policy. |
| 148 | +`spec.policy.rootOfTrust.policyType`:: Specifies the policy types that define the root of trust, either a public key, a BYOPKI certificate, or a Fulcio certificate. This example uses a Fulcio certificate with required Rekor verification. |
| 149 | +`spec.policy.rootOfTrust.fulcioCAWithRekor`:: For a Fulcio certificate policy, the following parameters are required: |
139 | 150 | * `fulcioCAData`: Specifies a base64-encoded Fulcio certificate in the PEM format. The maximum length is 8192 characters. |
140 | 151 | * `fulcioSubject`: Specifies the OIDC issuer and the email of the Fulcio authentication configuration. |
141 | | -<7> Specifies a base64-encoded Rekor public key in the PEM format. This parameter is required when the `policyType` is `FulcioCAWithRekor`. The maximum length is 8192 characters. |
142 | | -<8> Optional: Specifies one of the following processes to verify the identity in the signature and the actual image identity. |
| 152 | +* `rekorKeyData`: Specifies a base64-encoded Rekor public key in the PEM format. This parameter is required when the `policyType` is `FulcioCAWithRekor`. The maximum length is 8192 characters. |
| 153 | +`spec.policy.signedIdentity.matchPolicy`:: Specifies one of the following processes to verify the identity in the signature and the actual image identity. This parameter is optional. |
143 | 154 | * `MatchRepoDigestOrExact`. |
144 | 155 | * `MatchRepository`. |
145 | 156 | * `ExactRepository`. The `exactRepository` parameter must be specified. |
146 | 157 | * `RemapIdentity`. The `prefix` and `signedPrefix` parameters must be specified. |
147 | | -<9> For the `remapIdentity` match policy, specifies the prefix that should be matched against the scoped image prefix. If the two match, the scoped image prefix is replaced with the value of `signedPrefix`. The maximum length is 512 characters. |
148 | | -<10> For the `remapIdentity` match policy, specifies the image prefix to be remapped, if needed. The maximum length is 512 characters. |
| 158 | +`spec.policy.signedIdentity.remapIdentity.prefix`:: For the `remapIdentity` match policy, specifies the prefix that should be matched against the scoped image prefix. If the two match, the scoped image prefix is replaced with the value of `signedPrefix`. The maximum length is 512 characters. |
| 159 | +`spec.policy.signedIdentity.remapIdentity.signedPrefix`:: For the `remapIdentity` match policy, specifies the image prefix to be remapped, if needed. The maximum length is 512 characters. |
149 | 160 | -- |
150 | 161 |
|
151 | 162 | . Create the cluster image policy object: |
@@ -263,9 +274,11 @@ sh-5.1# cat /etc/containers/registries.d/sigstore-registries.yaml |
263 | 274 | ---- |
264 | 275 | docker: |
265 | 276 | example.com: |
266 | | - use-sigstore-attachments: true <1> |
| 277 | + use-sigstore-attachments: true |
267 | 278 | quay.io/openshift-release-dev/ocp-release: |
268 | 279 | use-sigstore-attachments: true |
269 | 280 | ---- |
270 | | -<1> When `true`, specifies that sigstore signatures are going to be read along with the image. |
| 281 | +where: |
| 282 | + |
| 283 | +`docker.example.com.use-sigstore-attachments`:: When `true`, specifies that sigstore signatures are going to be read along with the image. |
271 | 284 | // https://github.com/openshift/api/blob/master/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clusterimagepolicies-TechPreviewNoUpgrade.crd.yaml |
0 commit comments