|
| 1 | +// This module is included in the following assemblies: |
| 2 | +// * secure/using-tekton-chains-for-openshift-pipelines-supply-chain-security.adoc |
| 3 | + |
| 4 | +:_mod-docs-content-type: PROCEDURE |
| 5 | +[id="chains-generating-cosign-secret_{context}"] |
| 6 | += Generating the cosign key pair by using the TektonConfig CR |
| 7 | + |
| 8 | +To use the `cosign` signing scheme for {tekton-chains} secrets, you can generate a `cosign` key pair that uses ECDSA encryption by setting the `generateSigningSecret` field in the `TektonConfig` custom resource (CR) to `true`. |
| 9 | + |
| 10 | +.Prerequisites |
| 11 | + |
| 12 | +* You installed the {oc-first} utility. |
| 13 | +* You are logged in to your {OCP} cluster with administrative rights for the `openshift-pipelines` namespace. |
| 14 | +
|
| 15 | +.Procedure |
| 16 | + |
| 17 | +. Edit the `TektonConfig` CR by running the following command: |
| 18 | ++ |
| 19 | +[source,terminal] |
| 20 | +---- |
| 21 | +$ oc edit TektonConfig config |
| 22 | +---- |
| 23 | + |
| 24 | +. In the `TektonConfig` CR, set the `generateSigningSecret` value to `true`: |
| 25 | ++ |
| 26 | +.Example of creating an ECDSA cosign key pair by using the TektonConfig CR |
| 27 | +[source,yaml] |
| 28 | +---- |
| 29 | +apiVersion: operator.tekton.dev/v1 |
| 30 | +kind: TektonConfig |
| 31 | +metadata: |
| 32 | + name: config |
| 33 | +spec: |
| 34 | +# ... |
| 35 | + chain: |
| 36 | + disabled: false |
| 37 | + generateSigningSecret: true # <1> |
| 38 | +# ... |
| 39 | +---- |
| 40 | +<1> The default value is `false`. Setting the value to `true` generates the `ecdsa` key pair. |
| 41 | + |
| 42 | +. After a few minutes, extract the public key from the secret and store it, so that you can use it to verify artifact attestations. Run the following command to extract the key: |
| 43 | ++ |
| 44 | +[source,terminal] |
| 45 | +---- |
| 46 | +$ oc extract -n openshift-pipelines secret/signing-secrets --keys=cosign.pub |
| 47 | +---- |
| 48 | + |
| 49 | +.Result |
| 50 | + |
| 51 | +The {pipelines-shortname} Operator generates an `ecdsa` type `cosign` key pair and stores it in the `signing-secrets` secret in the `openshift-pipelines` namespace. The secret includes the following files: |
| 52 | + |
| 53 | +* `cosign.key`: The private key |
| 54 | +* `cosign.password`: The password for decrypting the private key |
| 55 | +* `cosign.pub` The public key |
| 56 | +
|
| 57 | +If a `signing-secrets` secret already exists, the Operator does not overwrite the secret. |
| 58 | + |
| 59 | +The `cosign.pub` file in your current directory contains the public key that is extracted from the secret. |
| 60 | + |
| 61 | +[WARNING] |
| 62 | +==== |
| 63 | +If you set the `generateSigningSecret` field from `true` to `false`, the {pipelines-title} Operator overrides and empties any value in the `signing-secrets` secret. |
| 64 | +==== |
| 65 | + |
| 66 | +The {pipelines-title} Operator does not provide the following security functions: |
| 67 | + |
| 68 | +* Key rotation |
| 69 | +* Auditing key usage |
| 70 | +* Proper access control to the key |
0 commit comments