Skip to content

Instantly share code, notes, and snippets.

View amcginlay's full-sized avatar

Alan McGinlay amcginlay

View GitHub Profile
@amcginlay
amcginlay / prepare-pemfiles-for-acm.md
Last active August 9, 2023 13:46
Commands to prepare Digicert key material for ACM import

Preparing TLSPC PEM files for AWS ACM

Assuming we have cert-chain and private key files extracted from TLSPC via DigiCert (let's call them my-cert.chain and my-cert.key), how do we get them prepared for AWS ACM import.

In this case my-cert.chain is a full chain and my-cert.key is an encrypted private key.

Requirements

As such we need to cope with two requirements:

@amcginlay
amcginlay / tlspk-helper-agent-install.md
Last active August 8, 2023 08:58
Installing the TLSPK agent without jsctl

Installing the TLSPK agent without jsctl

Steps as follows

Lightweight cluster creation

Create a disposable KinD cluster as follows.

nickname=<YOUR_NICKNAME>
@amcginlay
amcginlay / comparing-cert-manager-csi-drivers.md
Last active August 7, 2023 13:34
Comparing cert-manager CSI drivers

Comparing cert-manager CSI drivers

You will see the following cert-manager CSI drivers side-by-side:

Lightweight cluster creation

Create a disposable KinD cluster as follows.

@amcginlay
amcginlay / list-all-running-ec2s.sh
Last active July 26, 2023 14:05
Script will list all running EC2 instances in the current AWS account
echo '"region","instance-id","instance-type","tags-name","tags-auto-owner"'
for region in $(aws ec2 describe-regions --query 'Regions[*].[RegionName]' --output text); do
aws ec2 describe-instances \
--region ${region} \
--filters "Name=instance-state-name,Values=running" \
--output json | \
jq --arg region $region -r \
'.Reservations[].Instances[] | [$region, .InstanceId, .InstanceType, (.Tags[] | select(.Key=="Name") | .Value), (.Tags[] | select(.Key=="auto:owner") | .Value)] | @csv'
done
@amcginlay
amcginlay / list-all-arns.sh
Last active July 26, 2023 10:45
command for listing all ARNs in current account
for region in $(aws ec2 describe-regions --query 'Regions[*].[RegionName]' --output text); do
# echo "--- ${region} ---"
aws resourcegroupstaggingapi get-resources \
--region ${region} \
# --resource-type-filters 'ec2:instance' \
--query 'ResourceTagMappingList[*].[ResourceARN]' \
--output text;
done
@amcginlay
amcginlay / python-notes.md
Last active June 7, 2023 22:28
python-notes.md

Python Notes

Virtual Environments

Python virtual environments are used to create an isolated environment for Python projects. Each virtual environment has its own set of Python packages installed, separate from the global Python installation.

This helps provide:

  • Dependency management
  • Isolation
@amcginlay
amcginlay / istio-csr-with-tlspk.md
Last active May 5, 2023 19:03
istio-csr-with-tlspk.md

Using istio-csr with TLSPK

Download the tlspk-helper script and istioctl CLI.

curl -fsSLO https://venafi-ecosystem.s3.amazonaws.com/tlspk/v1/tlspk-helper.sh && chmod 700 tlspk-helper.sh
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.17.2 sh -
sudo mv istio-*/bin/istioctl /usr/local/bin

Create a local K8s cluster.

@amcginlay
amcginlay / istio-mvp.md
Last active May 3, 2023 12:04
istio-mvp.md

istio-mvp

Question: What's the absolute minimum I need to show Istio in action?

Create cluster.

kind create cluster --name istio-mvp --image kindest/node:v1.26.3

Install istioctl, run a precheck, install, then check status.

@amcginlay
amcginlay / istio-traffic-shifting.md
Last active April 29, 2023 13:50
istio-traffic-shifting

istio-traffic-shifting

This example shows a meshed app with a single frontend and a pair of backends (blue and green). A VirtualService is created to split the frontend->backend traffic 50/50 between blue and green.

Create cluster.

kind create cluster --name servicemesh --image kindest/node:v1.26.3

TLSPK Venafi Enhanced Issuer with TLSPC and Vault (v2)

NOTE: v2 of this walkthrough minimizes the use of jsctl and explicitly installs js-operator:v0.0.1-alpha.24 (via Helm) which has built in support for the latest version of VenafiEnhancedIssuer/VenafiConnection CRDs.

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)