Skip to content

Instantly share code, notes, and snippets.

View scarolan's full-sized avatar
🤸‍♂️
In whatever position one is in...one must find balance. -BKS Iyengar

Sean Carolan scarolan

🤸‍♂️
In whatever position one is in...one must find balance. -BKS Iyengar
View GitHub Profile
@scarolan
scarolan / easy_vault_transit_demo.sh
Last active October 18, 2018 19:23
Easy Vault Transit Demo
# Log into your vault instance if you haven't already
vault login root
# Enable the transit secret engine
vault secrets enable transit
# Create a key
vault write -f transit/keys/my-key
# Read the key, nothing up my sleeves
vault read transit/keys/my-key
# Write some base64 encrypted data to the transit endpoint
vault write transit/encrypt/my-key plaintext=$(base64 <<< "my secret data")
@scarolan
scarolan / pangrams
Created July 30, 2018 22:53 — forked from huyhong/pangrams
List of Pangrams
Nymphs blitz quick vex dwarf jog. (27 letters)
DJs flock by when MTV ax quiz prog. (27 letters) (2 acronyms and a US spelling)
Big fjords vex quick waltz nymph. (27 letters)
Bawds jog, flick quartz, vex nymph. (27 letters)
Junk MTV quiz graced by fox whelps. (28 letters) (Includes proper noun)
Bawds jog, flick quartz, vex nymphs. (28 letters)
Waltz, bad nymph, for quick jigs vex! (28 letters)
Fox nymphs grab quick-jived waltz. (28 letters)
Brick quiz whangs jumpy veldt fox. (28 letters)
Glib jocks quiz nymph to vex dwarf. (28 letters)
job "java" {
datacenters = ["dc1"]
type = "service"
# This is broken for some reason.
# constraint {
# attribute = "$attr.kernel.name"
# value = "linux"
# }
ecommerce_servers = "1"
demoami = "ami-05349ec17a04c40fb"
subdomain = "sean"
key_name = "epsilontraining"
function vencrypt() {
INPUTFILE=$1
vault write -format=json transit/encrypt/my-key plaintext=@<(base64 -i $INPUTFILE) | jq -r '.data|.ciphertext'
}
function vdecrypt() {
INPUTFILE=$1
vault write -format=json transit/decrypt/my-key ciphertext=$(cat $INPUTFILE ) | jq -r '.data|.plaintext' | base64 -i -d
}
@scarolan
scarolan / install_vault_consul.sh
Created October 18, 2018 19:37
Installs HashiCorp Vault with Consul as Storage backend
#!/bin/sh
#
# Once you have stood up your three Vault instances, run the script on each
# machine with your three IP addresses as script arguments. Put the IP address
# of the local machine *first* in the list.
#
# Once the script is complete you should be able to start Vault and Consul:
#
# systemctl start consul
# systemctl start vault
@scarolan
scarolan / main.tf
Last active November 14, 2018 17:42
challenge 04 answer
provider "azurerm" {
version = "= 1.4"
}
terraform {
required_version = ">= 0.11.7"
}
variable "name" {
default = "seanc03"
provider "aws" {
assume_role {
role_arn = "arn:aws:iam::582482956935:role/build-automation"
session_name = "Automation"
}
region = "us-west-2"
}
provisioner "remote-exec" {
inline = ["echo 'Hello World'"]
connection {
type = "ssh"
user = "ec2-user"
private_key = "${file("${var.private_key_path}")}"
}
}
variable "key_name" {
default = "terraformdemo"
}
resource "tls_private_key" "example" {
algorithm = "RSA"
rsa_bits = 4096
}
resource "aws_key_pair" "generated_key" {