cosigned

by sigstore

Helm chartv0.1.23App 1.8.0Apache-2.0Verified publisher

The Helm chart for Cosigned

About this chart

Cosigned Admission Webhook

Requirements

  • Kubernetes cluster with rights to install admission webhooks
  • Helm

Parameters

The following table lists the configurable parameters of the cosigned chart and their default values.

KeyTypeDefaultDescription
commonNodeSelectorobject{}
commonTolerationslist[]
cosign.cosignPubstring""
cosign.secretKeyRef.namestring""
cosign.webhookNamestring"cosigned.sigstore.dev"
policywebhook.envobject{}
policywebhook.extraArgsobject{}
policywebhook.image.pullPolicystring"IfNotPresent"
policywebhook.image.repositorystring"gcr.io/projectsigstore/policy-webhook"
policywebhook.image.versionstring"sha256:82940e8c3e0d3d5dd92b4779f4378e664f91b790db0d799b03535648eddc141d"
policywebhook.podSecurityContext.allowPrivilegeEscalationboolfalse
policywebhook.podSecurityContext.capabilities.drop[0]string"all"
policywebhook.podSecurityContext.enabledbooltrue
policywebhook.podSecurityContext.readOnlyRootFilesystembooltrue
policywebhook.podSecurityContext.runAsNonRootbooltrue
policywebhook.resources.limits.cpustring"100m"
policywebhook.resources.limits.memorystring"256Mi"
policywebhook.resources.requests.cpustring"100m"
policywebhook.resources.requests.memorystring"128Mi"
policywebhook.securityContext.enabledboolfalse
policywebhook.securityContext.runAsUserint65532
policywebhook.service.annotationsobject{}
policywebhook.service.portint443
policywebhook.service.typestring"ClusterIP"
policywebhook.serviceAccount.annotationsobject{}
policywebhook.webhookNames.defaultingstring"defaulting.clusterimagepolicy.sigstore.dev"
policywebhook.webhookNames.validatingstring"validating.clusterimagepolicy.sigstore.dev"
serviceMonitor.enabledboolfalse
webhook.envobject{}
webhook.extraArgsobject{}
webhook.image.pullPolicystring"IfNotPresent"
webhook.image.repositorystring"gcr.io/projectsigstore/cosigned"
webhook.image.versionstring"sha256:784518ff3ee755ce42e174e61036094af771c43bdc76b65a8f0e52481ed450ac"
webhook.namestring"webhook"
webhook.podSecurityContext.allowPrivilegeEscalationboolfalse
webhook.podSecurityContext.capabilities.drop[0]string"all"
webhook.podSecurityContext.enabledbooltrue
webhook.podSecurityContext.readOnlyRootFilesystembooltrue
webhook.podSecurityContext.runAsUserint1000
webhook.resources.limits.cpustring"100m"
webhook.resources.limits.memorystring"256Mi"
webhook.resources.requests.cpustring"100m"
webhook.resources.requests.memorystring"128Mi"
webhook.securityContext.enabledboolfalse
webhook.securityContext.runAsUserint65532
webhook.service.annotationsobject{}
webhook.service.portint443
webhook.service.typestring"ClusterIP"
webhook.serviceAccount.annotationsobject{}

Deploy cosigned Helm Chart

export COSIGN_PASSWORD=<my_cosign_password>
cosign generate-key-pair

The previous command generates two key files cosign.key and cosign.pub. Next, create a secret to validate the signatures:

kubectl create namespace cosign-system

kubectl create secret generic mysecret -n \
cosign-system --from-file=cosign.pub=./cosign.pub

Install cosigned using Helm and setting the value of the secret key reference to mysecret that you created above:

helm repo add sigstore https://sigstore.github.io/helm-charts

helm repo update

helm install cosigned -n cosign-system sigstore/cosigned --devel --set cosign.secretKeyRef.name=mysecret

Enabling Admission control

To enable the cosigned admission webhook to check for signed images, you will need to add the following label in each namespace that you would want the webhook triggered:

Label: cosigned.sigstore.dev/include: "true"

apiVersion: v1
kind: Namespace
metadata:
  labels:
    cosigned.sigstore.dev/include: "true"
    kubernetes.io/metadata.name: my-namespace
  name: my-namespace
spec:
  finalizers:
  - kubernetes

Testing the webhook

  1. Using Unsigned Images: Creating a deployment referencing images that are not signed will yield the following error and no resources will be created:

    kubectl apply -f my-deployment.yaml
    Error from server (BadRequest): error when creating "my-deployment.yaml": admission webhook "cosigned.sigstore.dev" denied the request: validation failed: invalid image signature: spec.template.spec.containers[0].image
    
  2. Using Signed Images: Assuming a signed nginx image with a tag signed exists on a registry, the resource will be successfully created.

    kubectl run pod1-signed  --image=< REGISTRY_USER >/nginx:signed -n testns
    pod/pod1-signed created
    

Deploy cosigned with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cosigned on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcosigned is pinned at v0.1.23 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply