Skip to content

Instantly share code, notes, and snippets.

View developer-guy's full-sized avatar
🐾
Every artifact can be verifiably traced to Source Code and Hardware

Batuhan Apaydın developer-guy

🐾
Every artifact can be verifiably traced to Source Code and Hardware
View GitHub Profile
@developer-guy
developer-guy / install-kyverno.sh
Created March 22, 2022 14:13
install kyverno with helm
$ helm repo add kyverno https://kyverno.github.io/kyverno/
$ helm repo update
$ helm install kyverno kyverno/kyverno --namespace kyverno --create-namespace
@developer-guy
developer-guy / gcp-annotate-serviceacc.sh
Created March 22, 2022 14:12
gcp service account annotate
$ kubectl annotate serviceaccount \
 --namespace kyverno \
kyverno \
iam.gke.io/gcp-service-account=${GSA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com
@developer-guy
developer-guy / generate-key-pair-kms.sh
Created March 22, 2022 14:11
Cosign generate key pair GCP KMS
$ gcloud kms keyrings create test - location "global"
$ gcloud kms keys create "cosign" \
 - location "global" \
 - keyring "test" \
 - purpose=asymmetric-signing - default-algorithm=ec-sign-p256-sha256
$ cosign generate-key-pair - kms gcpkms://projects/$PROJECT_ID/locations/global/keyRings/test/cryptoKeys/cosign/versions/1
@developer-guy
developer-guy / cosign-sign-with-gcp-kms.sh
Created March 22, 2022 14:10
Cosign sign with GCP KMS
$ cosign sign --key gcpkms://projects/$PROJECT_ID/locations/global/keyRings/test/cryptoKeys/cosign/versions/1 gcr.io/$PROJECT_ID/alpine:3.15.0
@developer-guy
developer-guy / kyverno-verify-images.yaml
Created March 22, 2022 14:10
Kyverno verifyImages GCP KMS
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: check-image
spec:
validationFailureAction: enforce
background: false
webhookTimeoutSeconds: 30
failurePolicy: Fail
rules:
@developer-guy
developer-guy / sign-blob.yaml
Created March 21, 2022 14:51
GoReleaser setting to sign blob
# signs the checksum file
# all files (including the sboms) are included in the checksum, so we don't need to sign each one if we don't want to
# https://goreleaser.com/customization/sign
signs:
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
certificate: '${artifact}.pem'
args:
- sign-blob
@developer-guy
developer-guy / sign-container-image.yaml
Created March 21, 2022 14:47
GoReleaser setting to sign container images with cosign
# signs our docker image
# https://goreleaser.com/customization/docker_sign
docker_signs:
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
artifacts: images
output: true
args:
- 'sign'
@developer-guy
developer-guy / cosign-installer.yaml
Created March 21, 2022 14:30
install cosign with cosign-install GA
- uses: sigstore/cosign-installer@v2.1.0 # installs cosign
@developer-guy
developer-guy / sbom.yaml
Created March 21, 2022 12:47
GoReleaser SBOM generation configuration section
# creates SBOMs of all archives and the source tarball using syft
# https://goreleaser.com/customization/sbom
# Two different sbom configurations need two different IDs
sboms:
- id: archive
artifacts: archive
- id: source
artifacts: source
@developer-guy
developer-guy / download-syft.yaml
Created March 21, 2022 10:28
download syft using sbom-action
- uses: anchore/sbom-action/download-syft@v0.7.0 # installs syft