Skip to content

Instantly share code, notes, and snippets.

@salrashid123
salrashid123 / gpg_golang.md
Last active July 12, 2023 12:59
Another GPG encryption/decryption sign/verify script on gist
@salrashid123
salrashid123 / cosign.md
Last active November 13, 2024 14:31
Generate and verify cosign signatures using openssl
@salrashid123
salrashid123 / readme.md
Last active April 30, 2023 14:50
GCP Binary Authorization containeranalysis audit log sample

Simple demo to setup cloud load balancer for mTLS

the backend is python server listening on :8080 which just echo's back the inbound headers from the l7lb

you can use the certificates included here or create a new one.

to use this demo, just make a local copy of all the files at the end of this repo and run through the script

  • server_tls_policy_chain.tmpl
  • trust_config_chain.yaml
@salrashid123
salrashid123 / main.go
Created April 18, 2023 11:02
Using ServiceAccount Impersonation with QuotaProject
package main
/*
Using impersonation and quota projects for google apis
---
export GCLOUD_USER=`gcloud config get-value core/account`
@salrashid123
salrashid123 / readme.md
Last active September 2, 2024 10:17
GCP DNS Based Service Directory with TCP and HTTP Internal Load Balancer
@salrashid123
salrashid123 / tls_sm_private_ca.md
Last active August 16, 2023 14:59
GCP Secret Manager and Private CA based TLS keys

just a generic example of creating a private key and saving it to secret manager

the alternative is to create a csr and get gcp private ca to sign it

export PROJECT_ID=`gcloud config get-value core/project`
export PROJECT_NUMBER=`gcloud projects describe $PROJECT_ID --format='value(projectNumber)'`
export GCLOUD_USER=`gcloud config get-value core/account`

# create private key and csr
@salrashid123
salrashid123 / readme.md
Last active May 21, 2024 13:49
Simple GCP OIDC workload Federation using a fake oidc server

following setsup uses a fake oidc server for gcp workload federation...

The oidc server used here is from this example

which means it will issue any id_token if asked... since the id_token is used to authenticate, if you configure the following as-is, petty anyone who guesses your project id and the fact you've set this up can authenticate to your gcp resurces.

package main
import (
"fmt"
_ "cloud.google.com/go/compute/metadata"
_ "cloud.google.com/go/kms/apiv1"
_ "google.golang.org/genproto/googleapis/api/monitoredres"