Skip to content

Commit e428e30

Browse files
committed
update per junjie's commments
Signed-off-by: Yi Zha <[email protected]>
1 parent 135ac0e commit e428e30

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

articles/container-registry/container-registry-tutorial-sign-build-push.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ In this tutorial:
7878
# Name of the existing Azure Key Vault used to store the signing keys
7979
AKV_NAME=myakv
8080
# New desired key name used to sign and verify
81-
KEY_NAME=wabbit-networks-io
81+
CERT_NAME=wabbit-networks-io
8282
CERT_SUBJECT="CN=wabbit-networks.io,O=Notary,L=Seattle,ST=WA,C=US"
83-
CERT_PATH=./${KEY_NAME}.pem
83+
CERT_PATH=./${CERT_NAME}.pem
8484
```
8585

8686
2. Configure ACR and image resource names.
@@ -159,15 +159,16 @@ The following steps show how to create a self-signed signing certificate for tes
159159
2. Create the certificate.
160160
161161
```azure-cli
162-
az keyvault certificate create -n $KEY_NAME --vault-name $AKV_NAME -p @my_policy.json
162+
az keyvault certificate create -n $CERT_NAME --vault-name $AKV_NAME -p @my_policy.json
163163
```
164164
165165
## Sign a container image with Notation CLI and AKV plugin
166166
167-
1. Build and push a new image with ACR Tasks.
167+
1. Build and push a new image with ACR Tasks. Always use digest to identify the image for signing, because tags are mutable and and can be overwritten.
168168
169169
```azure-cli
170-
az acr build -r $ACR_NAME -t $IMAGE $IMAGE_SOURCE
170+
DIGEST=$(az acr build -r $ACR_NAME -t $REGISTRY/${REPO}:$TAG $IMAGE_SOURCE --no-logs --query "outputImages[0].digest" -o tsv)
171+
IMAGE=$REGISTRY/${REPO}@$DIGEST
171172
```
172173
173174
2. Authenticate with your individual Azure AD identity to use an ACR token.
@@ -181,10 +182,10 @@ The following steps show how to create a self-signed signing certificate for tes
181182
> [!NOTE]
182183
> If notation login is failing, you may need to Configure a credentials store. Alternatively in development and testing environments, you can use environment variables to authenticate to an OCI-compliant registry. See guide [Authenticate with OCI-compliant registries](https://notaryproject.dev/docs/how-to/registry-authentication/) for details.
183184
184-
3. Get the Key ID of the signing key.
185+
3. Get the Key ID of the signing key. A certificate in AKV can have multiple versions, the following command get the Key Id of the latest version.
185186
186187
```bash
187-
KEY_ID=$(az keyvault certificate show -n $KEY_NAME --vault-name $AKV_NAME --query 'kid' -o tsv)
188+
KEY_ID=$(az keyvault certificate show -n $CERT_NAME --vault-name $AKV_NAME --query 'kid' -o tsv)
188189
```
189190
190191
4. Sign the container image with the [COSE](https://datatracker.ietf.org/doc/html/rfc8152) signature format using the signing key id. To sign with a self-signed certificate, you need to pass a plugin configuration `self_signed=true` in the command line.
@@ -226,7 +227,7 @@ To verify the container image, you need to add the root certificate that signs t
226227
227228
4. Configure trust policy before verification.
228229
229-
Trust policies allow users to specify fine-tuned verification policies. Use the following command to configure trust policy. Upon successful execution of the command, one trust policy named `wabbit-networks-images` is created. This trust policy applies to all the artifacts stored in repositories defined in `$REGISTRY/$REPO`. The trust identity that user trusts has the x509 subject `$CERT_SUBJECT` from previous step, and stored under trust store named `$STORE_NAME` of type `$STORE_TYPE`. See [Trust store and trust policy specification](https://github.com/notaryproject/notaryproject/blob/v1.0.0/specs/trust-store-trust-policy.md) for details.
230+
Trust policies allow users to specify fine-tuned verification policies. Use the following command to configure trust policy. Upon successful execution of the command, one trust policy named `wabbit-networks-images` is created. This trust policy applies to all the artifacts stored in repositories defined in `$REGISTRY/$REPO`. Assuming that the user trusts a specific identity with the X.509 subject `$CERT_SUBJECT`, which is used for the signing certificate. The named trust store `$STORE_NAME` of type `$STORE_TYPE` contains the root certificates. See [Trust store and trust policy specification](https://github.com/notaryproject/notaryproject/blob/v1.0.0/specs/trust-store-trust-policy.md) for details.
230231
231232
```bash
232233
cat <<EOF > ./trustpolicy.json

0 commit comments

Comments
 (0)