cosigned
by sigstore
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.
| Key | Type | Default | Description |
|---|---|---|---|
| commonNodeSelector | object | {} | |
| commonTolerations | list | [] | |
| cosign.cosignPub | string | "" | |
| cosign.secretKeyRef.name | string | "" | |
| cosign.webhookName | string | "cosigned.sigstore.dev" | |
| policywebhook.env | object | {} | |
| policywebhook.extraArgs | object | {} | |
| policywebhook.image.pullPolicy | string | "IfNotPresent" | |
| policywebhook.image.repository | string | "gcr.io/projectsigstore/policy-webhook" | |
| policywebhook.image.version | string | "sha256:82940e8c3e0d3d5dd92b4779f4378e664f91b790db0d799b03535648eddc141d" | |
| policywebhook.podSecurityContext.allowPrivilegeEscalation | bool | false | |
| policywebhook.podSecurityContext.capabilities.drop[0] | string | "all" | |
| policywebhook.podSecurityContext.enabled | bool | true | |
| policywebhook.podSecurityContext.readOnlyRootFilesystem | bool | true | |
| policywebhook.podSecurityContext.runAsNonRoot | bool | true | |
| policywebhook.resources.limits.cpu | string | "100m" | |
| policywebhook.resources.limits.memory | string | "256Mi" | |
| policywebhook.resources.requests.cpu | string | "100m" | |
| policywebhook.resources.requests.memory | string | "128Mi" | |
| policywebhook.securityContext.enabled | bool | false | |
| policywebhook.securityContext.runAsUser | int | 65532 | |
| policywebhook.service.annotations | object | {} | |
| policywebhook.service.port | int | 443 | |
| policywebhook.service.type | string | "ClusterIP" | |
| policywebhook.serviceAccount.annotations | object | {} | |
| policywebhook.webhookNames.defaulting | string | "defaulting.clusterimagepolicy.sigstore.dev" | |
| policywebhook.webhookNames.validating | string | "validating.clusterimagepolicy.sigstore.dev" | |
| serviceMonitor.enabled | bool | false | |
| webhook.env | object | {} | |
| webhook.extraArgs | object | {} | |
| webhook.image.pullPolicy | string | "IfNotPresent" | |
| webhook.image.repository | string | "gcr.io/projectsigstore/cosigned" | |
| webhook.image.version | string | "sha256:784518ff3ee755ce42e174e61036094af771c43bdc76b65a8f0e52481ed450ac" | |
| webhook.name | string | "webhook" | |
| webhook.podSecurityContext.allowPrivilegeEscalation | bool | false | |
| webhook.podSecurityContext.capabilities.drop[0] | string | "all" | |
| webhook.podSecurityContext.enabled | bool | true | |
| webhook.podSecurityContext.readOnlyRootFilesystem | bool | true | |
| webhook.podSecurityContext.runAsUser | int | 1000 | |
| webhook.resources.limits.cpu | string | "100m" | |
| webhook.resources.limits.memory | string | "256Mi" | |
| webhook.resources.requests.cpu | string | "100m" | |
| webhook.resources.requests.memory | string | "128Mi" | |
| webhook.securityContext.enabled | bool | false | |
| webhook.securityContext.runAsUser | int | 65532 | |
| webhook.service.annotations | object | {} | |
| webhook.service.port | int | 443 | |
| webhook.service.type | string | "ClusterIP" | |
| webhook.serviceAccount.annotations | object | {} |
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
-
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 -
Using Signed Images: Assuming a signed
nginximage with a tagsignedexists 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartcosigned is pinned at v0.1.23 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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