No description
  • Go 62.8%
  • Shell 25.6%
  • Makefile 6.8%
  • Dockerfile 4.3%
  • Smarty 0.5%
Find a file
dependabot[bot] 329e85366b chore: bump actions/dependency-review-action from 4.3.5 to 4.4.0
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.3.5 to 4.4.0.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](a6993e2c61...4081bf99e2)

---
updated-dependencies:
- dependency-name: actions/dependency-review-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 09:14:12 +00:00
.github chore: bump actions/dependency-review-action from 4.3.5 to 4.4.0 2024-11-04 09:14:12 +00:00
charts/attest-provider feat: add support for policy parameters 2024-10-16 14:52:11 +01:00
mutation Add mutation for adding digest to image spec 2024-06-20 12:48:41 +01:00
pkg refactor: remove copyright year; add newline 2024-10-18 09:33:52 -05:00
scripts refactor: remove copyright year; add newline 2024-10-18 09:33:52 -05:00
template refactor: remove copyright year; add newline 2024-10-18 09:33:52 -05:00
test/bats Fix expected error string 2024-06-21 11:40:12 +01:00
validation Return full verification result to rego 2024-06-20 15:48:57 +01:00
.dockerignore Initial commit 2024-05-23 10:19:55 -05:00
.gitignore chore: use new verfier API 2024-09-02 09:56:35 +01:00
.golangci.yaml merge poc 2024-05-23 10:52:35 -05:00
CODE-OF-CONDUCT.md refactor: use contributor covenant 2024-10-21 09:55:00 -05:00
CONTRIBUTING.md feat: add contributing.md 2024-10-18 13:22:58 -05:00
Dockerfile Remove GitHub app usage now that attest is public 2024-10-23 10:29:43 +01:00
go.mod [BOT] Update attest lib (#117) 2024-10-23 14:59:41 +00:00
go.sum [BOT] Update attest lib (#117) 2024-10-23 14:59:41 +00:00
LICENSE Initial commit 2024-05-23 10:19:55 -05:00
main.go refactor: remove copyright year; add newline 2024-10-18 09:33:52 -05:00
main_test.go refactor: remove copyright year; add newline 2024-10-18 09:33:52 -05:00
Makefile Remove GitHub app usage now that attest is public 2024-10-23 10:29:43 +01:00
NOTICE refactor: remove copyright year; add newline 2024-10-18 09:33:52 -05:00
README.md docs: enable admission events and lower timeout value 2024-07-29 15:08:56 -05:00
SECURITY.md Initial commit 2024-05-23 10:19:55 -05:00

Attest External Data Provider

OPA Gatekeeper external data provider implementation for Docker attest library image attestation verification.

Prerequisites

Quick Start

  1. Create a kind cluster.
kind create cluster --name gatekeeper
  1. Install the latest version of Gatekeeper and enable the external data feature.
# Add the Gatekeeper Helm repository
helm repo add gatekeeper https://open-policy-agent.github.io/gatekeeper/charts

# Install the latest version of Gatekeeper with the external data feature enabled.
helm install gatekeeper/gatekeeper \
    --set enableExternalData=true \
    --set emitAdmissionEvents=true \
    --set emitAuditEvents=true \
    --set validatingWebhookFailurePolicy=Fail \
    --set validatingWebhookTimeoutSeconds=10 \
    --set postInstall.probeWebhook.enabled=false \
    --set postInstall.labelNamespace.enabled=false \
    --name-template=gatekeeper \
    --namespace security \
    --create-namespace
  1. Build and deploy the external data provider.
git clone https://github.com/docker/attest-provider.git
cd attest-provider

# if you are not planning to establish mTLS between the provider and Gatekeeper,
# deploy the provider to a separate namespace. Otherwise, do not run the following command
# and deploy the provider to the same namespace as Gatekeeper.
export NAMESPACE=security

# generate a self-signed certificate for the external data provider
./scripts/generate-tls-cert.sh

# build the image via docker buildx
make docker-buildx

# load the image into kind
make kind-load-image

# deploy attest provider
helm install attest-provider charts/attest-provider \
    --set provider.tls.caBundle="$(cat certs/ca.crt | base64 | tr -d '\n\r')" \
    --set image="docker/attest-provider:dev" \
    --namespace "${NAMESPACE:-gatekeeper-system}"
  1. Install constraint template and constraint.
kubectl apply -f validation/attest-constraint-template.yaml
kubectl apply -f validation/attest-constraint.yaml
  1. Test the external data provider by dry-running the following command:
kubectl create ns test
kubectl run nginx --image nginx -n test --dry-run=server -ojson

Gatekeeper should deny the pod admission above because the image nginx is missing signed annotations but has an image policy in tuf-staging.

TODO: implement mutating policy (tag -> digest)

  1. To reload the attest-provider image after making changes, run the following command:
make reload
  1. Uninstall the external data provider and Gatekeeper.
kubectl delete -f validation/
# kubectl delete -f mutation/ TODO: implement mutation
helm uninstall attest-provider --namespace "${NAMESPACE:-gatekeeper-system}"
helm uninstall gatekeeper --namespace security