sigstore / k8s-manifest-sigstore

kubectl plugin for signing Kubernetes manifest YAML files with sigstore
Apache License 2.0
79 stars 21 forks source link

Extend verify-resource sub-command #13

Closed yuji-watanabe-jp closed 3 years ago

yuji-watanabe-jp commented 3 years ago

Description This issue is the proposal to extend verify-resource subcommand to allow the following features.

verify-resource subcommand allows user to inspect resources according to the sigstore signing.

In this verification, signed manifest is specified in metadata annotation of each resources, or command option explicitly. If the resource is not changed from the signed manifest, it is reported as valid.

Two usage patterns of this sub-command.

  1. A user specifies the resources by command options and checks if they are not changed from signed manifest. (signed manifest specified in metadata annotation is used in this case.)

    kubectl sigstore verify-resource cm -n myapp

    Resources can be specified by manifest.

    kubectl get deploy -n myapp | kubectl sigstore verify-resource -f -
  2. A user specifies the signed manifest and verifies if the resources deployed from the manifest is not changed from the signed state

# build manifest
kustomize build ~/myapp > manifest.yaml

# sign manifest
kubectl sigstore sign manifest.yaml -i manifest-bundle:dev

# deploy application
kubectl apply -n myapp -f manifest.yaml

# verify application with signed manifest
kubectl sigstore verify-resource -n myapp -i manifest-bundle:dev

Features to be extended

Expected

Usage:
  kubectl sigstore verify-resource (RESOURCE/NAME | -f FILENAME | -i IMAGE) [options]

Flags:
  -c, --config string                  path to verification config YAML file (for advanced verification)
  -f, --filename string                manifest filename
  -i, --image string                   a comma-separated list of signed image names that contains YAML manifests
  -k, --key string                     path to your signing key (if empty, do key-less signing)
  -n, --namespace string               If present, the namespace scope for this CLI request
  -o, --output string                  output format string, either "json" or "yaml" (if empty, a result is shown as a table)
yuji-watanabe-jp commented 3 years ago

This extension was merged to main branch with the PR #16 . Thanks! > @hirokuni-kitahara