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 / download-syft.yaml
Created March 21, 2022 10:28
download syft using sbom-action
- uses: anchore/sbom-action/[email protected] # installs syft
@developer-guy
developer-guy / main.go
Created February 28, 2022 10:36
A code sample for storing Kyverno policy on OCI registry
package main
import (
"errors"
"fmt"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/empty"
"github.com/google/go-containerregistry/pkg/v1/mutate"
"github.com/google/go-containerregistry/pkg/v1/remote"
@developer-guy
developer-guy / pod.yaml
Created January 5, 2022 09:47
sample pod yaml for testing renew
apiVersion: v1
kind: Pod
metadata:
name: your-webhook
namespace: platform
spec:
volumes:
- name: tls-volume
secret:
defaultMode: 420
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: vault-issuer
namespace: platform
spec:
vault:
server: http://vault.default:8200
path: pki/sign/config-admission-webhook
auth:
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: config-sidecar-injector-service
namespace: platform
spec:
secretName: config-admission-webhook-tls
issuerRef:
name: vault-issuer
dnsNames:
@developer-guy
developer-guy / deploy-vault-with-helm-dev-mode-enabled.sh
Created January 4, 2022 18:45
Deploy Vault with Helm dev mode enabled
$ helm repo add hashicorp https://helm.releases.hashicorp.com
$ helm repo update
$ helm upgrade --install vault hashicorp/vault \
--set "injector.enabled=false" \
--set "server.dev.enabled=true"
@developer-guy
developer-guy / configure-k8s-auth-method-notes.sh
Created January 4, 2022 18:21
Configure Kubernetes Authentication Method
# Vault provides a Kubernetes authentication method that enables clients to authenticate with a Kubernetes Service Account Token.
# Enable the Kubernetes authentication method.
$ vault auth enable kubernetes
Success! Enabled kubernetes auth method at: kubernetes/
# Configure the Kubernetes authentication method to use location of the Kubernetes API, the service account token, its certificate, and the name of Kubernetes' service account issuer (required with Kubernetes 1.21+).
$ vault write auth/kubernetes/config \
kubernetes_host="https://$KUBERNETES_PORT_443_TCP_ADDR:443" \
token_reviewer_jwt="$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \
kubernetes_ca_cert=@/var/run/secrets/kubernetes.io/serviceaccount/ca.crt \
@developer-guy
developer-guy / configure-vault-pki-notes.sh
Last active January 4, 2022 18:19
Configure Vault PKI
# Enable the PKI secrets engine at its default path.
$ vault secrets enable pki
Success! Enabled the pki secrets engine at: pki/
# By default the KPI secrets engine sets the time-to-live (TTL) to 30 days. A certificate can have its lease extended to ensure certificate rotation on a yearly basis (8760h).
# Configure the max lease time-to-live (TTL) to 8760h.
$ vault secrets tune -max-lease-ttl=8760h pki
Success! Tuned the secrets engine at: pki/
# Vault can accept an existing key pair, or it can generate its own self-signed root. In general, we recommend maintaining your root CA outside of Vault and providing Vault a signed intermediate CA.
@developer-guy
developer-guy / keybase.md
Created December 9, 2021 10:58
my identity proof

Keybase proof

I hereby claim:

  • I am developer-guy on github.
  • I am developerguy (https://keybase.io/developerguy) on keybase.
  • I have a public key ASBH5MyQO5bJeRxfCQiXt6BXvQ9pz6lIJ8i8XdLEStuZnQo

To claim this, I am signing this object:

@developer-guy
developer-guy / demo.md
Last active January 3, 2022 18:29
Experimental Keyless Cosign verify-blob command to verify signature that is exported by the skopeo tool to the directory

Experimental Keyless Cosign verify-blob command to verify the signature that is exported by the skopeo tool to the directory

Let's assume that we have an image called devopps/busybox:glibc, we gain this image by copying the real busybox:glibc image from DockerHub by issuing the following command:

$ crane copy busybox:glibc devopps/busybox:glibc

crane is a tool for interacting with remote images and registries. https://github.com/google/go-containerregistry/tree/main/cmd/crane