Skip to content

Instantly share code, notes, and snippets.

View ram-devsecops's full-sized avatar

Ram Reddy ram-devsecops

  • EITS
  • United States
View GitHub Profile
@ram-devsecops
ram-devsecops / generate_new_kubeconfig.sh
Created September 8, 2021 01:45 — forked from Oats87/generate_new_kubeconfig.sh
This bash script will sign an x509 certificate using the kube-ca located on any rancher node. This allows you to gain access back to your RKE-created kubernetes cluster should you lose the kube_config and cluster.yml for it, but still have SSH access to the hosts.
#!/bin/bash
echo "This will generate a new kube config for accessing your RKE-created kubernetes cluster. This script MUST be run on a Kubernetes node."
echo "Please enter the IP of one of your control plane hosts, followed by [ENTER]:"
read cphost
openssl genrsa -out kube-admin.key 2048
openssl req -new -sha256 -key kube-admin.key -subj "/O=system:masters/CN=kube-admin" -out kube-admin.csr
sudo openssl x509 -req -in kube-admin.csr -CA /etc/kubernetes/ssl/kube-ca.pem -CAcreateserial -CAkey /etc/kubernetes/ssl/kube-ca-key.pem -out kube-admin.crt -days 365 -sha256
sudo rm -f /etc/kubernetes/ssl/kube-ca.srl
@ram-devsecops
ram-devsecops / cheatsheet-elasticsearch.md
Created April 5, 2021 14:20 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@ram-devsecops
ram-devsecops / markdown-details-collapsible.md
Created December 2, 2020 15:54 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@ram-devsecops
ram-devsecops / cleanup.sh
Created November 29, 2018 17:14 — forked from superseb/cleanup.sh
Cleanup host added as custom to Rancher 2.0
#!/bin/sh
docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
@ram-devsecops
ram-devsecops / chocolateyinstall.ps1
Created March 1, 2018 23:45
Install iso file using chocolatey
# First, download the ISO file from the internet (NOTE: you could equally use a locally stored ISO)
Get-ChocolateyWebFile 'WindowsSDK2008' "$env:temp\winsdk2008.iso" 'http://download.microsoft.com/download/f/e/6/fe6eb291-e187-4b06-ad78-bb45d066c30f/6.0.6001.18000.367-KRMSDK_EN.iso'
# Next, mount the ISO file, ready for using it's contents
$iso = Get-Item "$env:temp\winsdk2008.iso"
Mount-DiskImage -ImagePath $iso
#Get the drive letter where iso is mounted
$driveLetter = (Get-DiskImage $iso | Get-Volume).DriveLetter
@ram-devsecops
ram-devsecops / revert-a-commit.md
Created October 21, 2017 19:15 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

Elastic Load Balancer, CloudFront and Let's Encrypt
connection {
agent = false
bastion_host = "${var.bastion_host}"
bastion_user = "ec2-user"
bastion_port = 22
bastion_private_key = "${file("${path.module}/../keys/${var.serverinfo["bastion_private_key"]}")}"
user = "${var.serverinfo["user"]}"
private_key = "${file("${path.module}/../keys/${var.serverinfo["private_key"]}")}"
host = "192.168.2.10"
timeout = "2m"