Skip to content

Instantly share code, notes, and snippets.

Avatar

Kinnaird McQuade kmcquade

View GitHub Profile
@kmcquade
kmcquade / _aws_scripts.md
Created Sep 9, 2018
Miscellaneous useful scripts with AWS
View _aws_scripts.md

List:

  • export-aws-creds.py
    • Simple script that parses the ~/.aws/credentials file and creates the export command needed for pumping your AWS creds to command line

aws-secrets-send.sh and aws-secrets-get.sh

  • Used for grabbing secrets from S3 encrypted at the object level with KMS.
  • Easy to copy + paste or include in your repo when you have to use Ec2 userdata + IAM roles to download KMS-encrypted objects from S3
  • Based on this github repo but without the built-in options to create buckets and keys. This limits the capabilities of the script in a good way.
@kmcquade
kmcquade / cloud-config.yml
Created Dec 24, 2018 — forked from justinsoliz/cloud-config.yml
Terraform definition for Jenkins with ECS, EFS, CoreOS
View cloud-config.yml
#cloud-config
write-files:
- path: /etc/conf.d/nfs
permissions: '0644'
content: |
OPTS_RPC_MOUNTD=""
coreos:
units:
- name: update-engine.service
@kmcquade
kmcquade / .gitignore
Created Jan 29, 2019
.gitignore for my Infrastructure as Code repos
View .gitignore
##### Working directories #####
tmp
_notes
##### Technologies #####
#### Terraform
# Local .terraform directories
**/.terraform/*
*.plan
@kmcquade
kmcquade / copy-ssm-parameters
Created Feb 28, 2019 — forked from mvanholsteijn/copy-ssm-parameters
script to copy all SSM parameter store parameters to disk
View copy-ssm-parameters
#!/usr/bin/env python
#
# copy all SSM parameter store parameters to disk
#
import os, sys, argparse, boto3
parser = argparse.ArgumentParser(description='copy all parameter values to local')
parser.add_argument("--path", dest="path", required=True,
help="to copy the keys from", metavar="STRING")
parser.add_argument("--directory", dest="directory", required=True,
@kmcquade
kmcquade / Makefile
Created Mar 9, 2019 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
View Makefile
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@kmcquade
kmcquade / gist:6e3fdb7bfe43a56b9868fa96566ad6c3
Last active Mar 17, 2019 — forked from Ray33/gist:ba189a729d81babc99d7cef0fb6fbcd8
Amazon Elastic Network Adapter (ENA) on CentOS 7
View gist:6e3fdb7bfe43a56b9868fa96566ad6c3
sudo su
yum --enablerepo=extras install epel-release
yum -y install patch dkms kernel-devel perl
yum update
reboot
sudo su
@kmcquade
kmcquade / jenkins-decrypt.md
Last active Mar 20, 2019 — forked from tuxfight3r/jenkins-decrypt.groovy
Decrypting Jenkins Password
View jenkins-decrypt.md

To Decrypt Jenkins Passwords

  1. Go to the "Configure System" screen.
  2. Right click on a password field, Inspect element, then change to "text" instead of "password".
  3. Copy that field and then go to the Script Console. Paste the below into the field, replace with your encrypted password, and then hit "run".
encrypted_pw = '{your_encrypted_password_with_brackets_around_it}'
passwd = hudson.util.Secret.decrypt(encrypted_pw)
println(passwd)
@kmcquade
kmcquade / 0.12.tf
Created May 27, 2019 — forked from tuannvm/0.12.tf
#terraform #hashicorp #cheatsheet #0.12
View 0.12.tf
# first class expresssion
variable "ami" {}
resource "aws_instance" "example" {
ami = var.ami
}
###
# list & map
resource "aws_instance" "example" {
@kmcquade
kmcquade / keep-jenkins-plugins-uptodate.groovy
Created May 27, 2019 — forked from alecharp/keep-jenkins-plugins-uptodate.groovy
Simple groovy script to upgrade active plugins when new versions are available
View keep-jenkins-plugins-uptodate.groovy
jenkins.model.Jenkins.getInstance().getUpdateCenter().getSites().each { site ->
site.updateDirectlyNow(hudson.model.DownloadService.signatureCheck)
}
hudson.model.DownloadService.Downloadable.all().each { downloadable ->
downloadable.updateNow();
}
def plugins = jenkins.model.Jenkins.instance.pluginManager.activePlugins.findAll {
it -> it.hasUpdate()
@kmcquade
kmcquade / jenkins-list-pending-script-approvals.groovy
Created May 29, 2019
List pending script approvals in Jenkins
View jenkins-list-pending-script-approvals.groovy
import org.jenkinsci.plugins.scriptsecurity.scripts.*
ScriptApproval sa = ScriptApproval.get();
//list pending approvals
for (ScriptApproval.PendingScript pending : sa.getPendingScripts()) {
println "Pending Approved : " + pending.script
}
//list pending signatures
for (ScriptApproval.PendingSignature pending : sa.getPendingSignatures()) {
println "Pending Signature : " + pending.signature