Skip to content

Instantly share code, notes, and snippets.

View maniankara's full-sized avatar

Anoop Vijayan Maniankara maniankara

View GitHub Profile
@maniankara
maniankara / tls.sh
Created June 5, 2024 09:38
Fetch TLS certs from a URL
openssl s_client -showcerts -servername www.example.com -connect www.example.com:443 </dev/null
@maniankara
maniankara / gettoken.sh
Last active January 7, 2024 16:18 — forked from eruffaldi/gettoken.sh
Google OAuth 2.0 full example bash script.
#!/bin/bash
# Bash script for generating OAuth token for Google admin user fetching
#1) on https://console.developers.google.com/ register project and associate API from library
# OUTPUT: client_id,client_secret
client_id="..."
client_secret="...."
#2) get authorization code at the following link using web browser
# OUTPUT: code
@maniankara
maniankara / self-signed-ssl-cert
Last active March 11, 2024 10:24
Create a self signed certificate
# Without CA
openssl req -x509 -newkey rsa:4096 -sha256 -days 365 -nodes -keyout selfsigned.key -out selfsigned.crt -subj "/C=FI/ST=Uusimaa/L=Helsinki/O=Verifa Oy/OU=IT/CN=example.verifa.io/emailAddress=selfsigned@verifa.io" -addext 'subjectAltName=DNS:sample.verifa.io,DNS=sample.verifa.com'
# With CA (repeats some steps from above)
openssl req -newkey rsa:2048 -nodes -keyout selfsigned.key -out selfsigned.csr -subj "/C=FI/ST=Uusimaa/L=Helsinki/O=Verifa Oy/OU=IT/CN=server.test.com/emailAddress=test@test.com"
openssl req -x509 -sha256 -days 1825 -newkey rsa:2048 -keyout rootCA.key -out rootCA.crt -subj "/C=FI/ST=Uusimaa/L=Helsinki/O=Verifa Oy/OU=IT/CN=server.test.com/emailAddress=test@test.com" -passout pass:test123
openssl x509 -req -CA rootCA.crt -CAkey rootCA.key -in selfsigned.csr -out selfsigned.crt -days 365 -CAcreateserial -passin pass:test123
@maniankara
maniankara / jsonpath_with_dotted_keys
Created September 25, 2023 13:52
Parse with jsonpath which has dots in their key names
kubectl get obj certs -o jsonpath="{.data['tls\.key']}"
@maniankara
maniankara / wsl-cmd
Created September 4, 2023 20:03
Handy WLS commands to use in cmd
# List WSLs with versions
wsl --list --verbose
# Convert an existing WSL `Ubuntu-22.04` from WSL2 to WSL1
wsl --set-version Ubuntu-22.04 1
@maniankara
maniankara / GHA-looping.yml
Created July 28, 2023 11:24
Github action looping example. This is the only way to natively loop a step in GHA
name: listfiles
on:
workflow_dispatch:
jobs:
list-png-files:
runs-on: ubuntu-latest
outputs:
file: ${{ steps.set-files.outputs.file }}
@maniankara
maniankara / import-ca-certs-local-ubuntu-debian-redhat.md
Last active August 9, 2023 12:23
Importing CA certs to your local Ubuntu/Debian

Problem

  1. Command
curl https://testhost
  1. Certificate unknown authority error
: x509: certificate signed by unknown authority

Fix:

@maniankara
maniankara / fabric-node-configs.csv
Last active December 8, 2019 12:19
Used as a table for medium article
NODE SERVICES IP OS HARDWARE
Admin node Orderer/fabric-ca 192.168.10.142 Ubuntu 18.04 1vCPU/1GB RAM/80GB HDD
Peer node Peer0 192.168.10.143 Ubuntu 18.04 1vCPU/1GB RAM/80GB HDD
APPLICATION VERSION
elastic 7.1
golang 1.11
docker 18.09
docker-compose 1.23
python 2.7
@maniankara
maniankara / elasticstack-docker.yaml
Created May 30, 2019 21:02
Elasticsearch and Kibana 7.2
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits: