Skip to content

Instantly share code, notes, and snippets.

Avatar

Robin Cher robincher

View GitHub Profile
@robincher
robincher / insert-domains-mysql.sh
Created Jan 31, 2020
Insert database records from text file
View insert-domains-mysql.sh
#!/bin/bash
echo "Please enter database Password:"
read DB_PASSWD
if [ -z "DB_PASSWD" ]; then
echo "Please DB Password"
exit 1
fi
@robincher
robincher / kong-mtls-test.sh
Created Aug 29, 2019
Map ca certificate with consumer object
View kong-mtls-test.sh
#!/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 / self-sign-test.sh
Created Aug 29, 2019
Self-Signed CA and Client Certificate
View self-sign-test.sh
#!/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
View keybase.md

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 / index.js
Created Sep 8, 2018
Parsing X509 Certificate using pkijs
View index.js
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);
You can’t perform that action at this time.