Skip to content

Instantly share code, notes, and snippets.

View robincher's full-sized avatar

Robin Cher robincher

View GitHub Profile
@robincher
robincher / index.js
Created September 8, 2018 10:38
Parsing X509 Certificate using pkijs
const atob = require('atob');
const asn1js = require('asn1js');
const fs = require('fs');
const pkijs = require('pkijs');
const pvutils = require('pvutils')
const Certificate = pkijs.Certificate
let certificateBuffer = new ArrayBuffer(0);
@robincher
robincher / keybase.md
Created December 21, 2018 06:45
Keybase

Keybase proof

I hereby claim:

  • I am robincher on github.
  • I am robincher (https://keybase.io/robincher) on keybase.
  • I have a public key ASAnWqIXbW8XGBZCwtZJx4tLmEmBLQpUdc5-4pMChJ1gbAo

To claim this, I am signing this object:

@robincher
robincher / self-sign-test.sh
Created August 29, 2019 09:39
Self-Signed CA and Client Certificate
#!/bin/bash
#Generate Self-signed CA
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout ca.key -out ca.crt
#Make a directory
mkdir client
#Generate Corresponding client certificate
openssl genrsa -out client/helios.key 2048
@robincher
robincher / kong-mtls-test.sh
Created August 29, 2019 09:43
Map ca certificate with consumer object
#!/bin/bash
# Create manual mappings between certificate and Consumer objec
curl -X POST -H 'Kong-Admin-Token:xxxxxx' http://localhost:8001/Scratch/consumers/helios/mtls-auth -d 'subject_name=helios.gemsapi.io'
# Test route with MTLS and Basic Auth Plugin enabled
curl -kv -H 'Authorization: Bearer Basic xxxxxxx' --key helios.key --cert helios.crt https://localhost:8443/mockbin/request
@robincher
robincher / insert-domains-mysql.sh
Created January 31, 2020 10:47
Insert database records from text file
#!/bin/bash
echo "Please enter database Password:"
read DB_PASSWD
if [ -z "DB_PASSWD" ]; then
echo "Please DB Password"
exit 1
fi
@robincher
robincher / aws-auth-patch.sh
Last active July 31, 2023 09:59
Patching aws-auth for EKS
#!/bin/bash
export AWS_ACCOUNT_ID=$1
export AWS_INSTANCE_ROLE=$2
export EKS_CLUSTER_NAME=$3
if [ -z "$AWS_ACCOUNT_ID" ]
then
echo -n "AWS Account Number: "
read AWS_ACCOUNT_ID
@robincher
robincher / kong-k3d.yaml
Created July 13, 2022 12:09
Deploying Kong Enterprise with Helm and k3d
# Kong for Kubernetes with Kong Enterprise with Enterprise features enabled and
# exposed via TLS-enabled Ingresses. Before installing:
# * Several settings (search for the string "CHANGEME") require user-provided
# Secrets. These Secrets must be created before installation.
# * Ingresses reference example "<service>.kong.CHANGEME.example" hostnames. These must
# be changed to an actual hostname that resolve to your proxy.
# * Ensure that your session configurations create cookies that are usable
# across your services. The admin session configuration must create cookies
# that are sent to both the admin API and Kong Manager, and any Dev Portal
# instances with authentication must create cookies that are sent to both
@robincher
robincher / kong-flux.yaml
Last active July 30, 2022 01:42
Kong Enterprise Stand-Alone with Flux
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: kong
namespace: flux-system
spec:
interval: 30m
url: https://charts.konghq.com
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
@robincher
robincher / kong-docker.sh
Created March 9, 2023 07:43
Kong Docker Set-up
## Run Kong 3.2 with Docker Containers
#### Create Docker Network
docker network create kong-net
# Export License
export KONG_LICENSE_DATA=''
### Start a Postgres Container (If running db mode)
@robincher
robincher / tal-eks.yaml
Last active April 2, 2024 23:57
EKS Cluster Config
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: kong-tal-eks
region: ap-southeast-1
addons:
- name: vpc-cni
version: latest