Skip to content

Instantly share code, notes, and snippets.

View amcginlay's full-sized avatar

Alan McGinlay amcginlay

View GitHub Profile
@amcginlay
amcginlay / cert.yaml
Last active November 11, 2022 12:33
cert.yaml
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: www081050-jetstack-mcginlay-net
spec:
secretName: www081050-jetstack-mcginlay-net-tls
dnsNames:
- www081050.jetstack.mcginlay.net
issuerRef:
@amcginlay
amcginlay / privileged-ports.sh
Last active December 3, 2022 15:10
Non-root use of port 80
# From https://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-on-linux
sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80
@amcginlay
amcginlay / pomerium_okta.md
Last active December 21, 2022 16:09
Okta authentication through the Pomerium Ingress Controller

Okta authentication through the Pomerium Ingress Controller

Okta: Create an App Integration

Experiment with KinD, csi-driver and TLS Protect Cloud

Create a KinD cluster

k8s_name=kind-$(date +"%y%m%d%H%M")
cat <<EOF | kind create cluster --config -
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: ${k8s_name}
nodes:

cert-manager + Vault + TLSPC

The following instructions have been tested using a KinD cluster and uses the Venafi Secrets Engine for HashiCorp Vault

install vault (dev mode)

helm repo add hashicorp https://helm.releases.hashicorp.com
helm -n vault install vault hashicorp/vault --create-namespace \
  --set "server.dev.enabled=true" \
  --set "server.extraArgs=-dev-plugin-dir=/vault/plugins/" \
@amcginlay
amcginlay / k8s-vault-pki.md
Last active March 14, 2023 11:54
How to enable PKI in K8s Vault for specified subdomains

Enable Secrets Engine PKI in K8s Vault (dev-mode)

Install Vault

helm repo add hashicorp https://helm.releases.hashicorp.com
helm -n vault install vault hashicorp/vault --create-namespace --set "server.dev.enabled=true"

Start session on Vault pod

Smallstep cert-manager issuer with TLSPK

Create KinD cluster, connect to TLSPK and deploy enterprise cert-manager

k8s_name=kind-$(date +"%y%m%d%H%M")
cat <<EOF | kind create cluster --config -
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: ${k8s_name}
nodes:

TLSPK Venafi Enhanced Issuer with TLSPC and Vault

Terminology:

  • TLSPK: TLS Protect for Kubernetes (previously Jetstack Secure or JSS)
  • TLSPC: TLS Protect Cloud (previously Venafi as a Service or VaaS)
  • TLSP: TLS Protect Data Centre (previously Venafi Trust Protection Platform or TPP)
  • VEI: Venafi Enhanced Issuer (not to be confused with the native cert-manager issuer for Venafi)

cert-manager's native Venafi issuer requires Kubernetes secrets to hold Venafi credentials (e.g. API keys). Ideally you wish to eliminate the use of all secrets as these create a potential attack vector.

Adventures in OpenShift (OKD on AWS)

Cloud9 Jumpbox

Create a Cloud9 jumpbox using Step 01-03 here. This box will sufficient AWS privileges, for example, EC2 and Route53.

Inspired by Installing a cluster quickly on AWS

Set base directory

Minimizing the use of jsctl

Minimizing the use of the jsctl CLI gives you more flexibility.

For example:

  • You get to install whatever version of js-operator you desire
  • You force yourself to get familiar with the controller's Installation manifest, which jsctl otherwise attempts to abstract away

Start cluster