|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * installing/disconnected_install/installing-mirroring-disconnected-v2.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="oc-mirror-about-sig-mirroring-verification_{context}"] |
| 7 | += Enabling signature verification for oc-mirror plugin v2 |
| 8 | + |
| 9 | +Starting with {product-title} 4.19, the oc-mirror plugin v2 supports signature verification, which is disabled by default. When enabled, the plugin verifies that container images match their signatures, ensuring they have not been altered and come from trusted sources. If a signature mismatch is detected, the mirroring workflow will fail. |
| 10 | + |
| 11 | +.Procedure |
| 12 | + |
| 13 | +. If you want to enable signature verification for all images, run the following command: |
| 14 | ++ |
| 15 | +[source,terminal] |
| 16 | +---- |
| 17 | +$ oc mirror --secure-policy=true |
| 18 | +---- |
| 19 | + |
| 20 | +. If you want to enable or disable signature verification for specific elements — such as a transport protocol, registry, namespace, or image — follow these steps: |
| 21 | + |
| 22 | +.. Create a `policy.json` file in either the `$HOME/.config/containers/` or `/etc/containers/` directory. |
| 23 | ++ |
| 24 | +[NOTE] |
| 25 | +==== |
| 26 | +If your policy configuration file is located outside the default directory, you can specify its path by using the `--policy` flag with the `oc mirror` command. |
| 27 | +
|
| 28 | +For more information, see link:https://github.com/containers/image/blob/main/docs/containers-policy.json.5.md[`containers-policy.json(5)`]. |
| 29 | +==== |
| 30 | + |
| 31 | +.. Define verification rules for the desired scope (for example, registry or image) using the appropriate policy configuration. You can set the verification requirement by specifying the desired rule under each element. |
| 32 | ++ |
| 33 | +.Example: Enable verification for only a specific image, and reject all other images |
| 34 | ++ |
| 35 | +[source,json] |
| 36 | +---- |
| 37 | +{ |
| 38 | + "default": [{"type": "reject"}], |
| 39 | + "transports": { |
| 40 | + "docker": { |
| 41 | + "hostname:5000/myns/sigstore-signed-image": [ |
| 42 | + { |
| 43 | + "type": "sigstoreSigned", |
| 44 | + "keyPath": "/path/to/sigstore-pubkey.pub", |
| 45 | + "signedIdentity": {"type": "matchRepository"} |
| 46 | + } |
| 47 | + ] |
| 48 | + } |
| 49 | + } |
| 50 | +} |
| 51 | +---- |
0 commit comments