Skip to content

Instantly share code, notes, and snippets.

View tom-butler's full-sized avatar
🚵

tom-butler tom-butler

🚵
View GitHub Profile
@tom-butler
tom-butler / Install-Chamber.sh
Last active January 14, 2019 12:48
store a key in chamber
#--------------------------------------------------------------
# Install Chamber
#--------------------------------------------------------------
# Chamber is used to access secrets which are stored encrypted
# in aws ssm paramater store
# Get the latest version of Chamber
curl -s https://api.github.com/repos/segmentio/chamber/releases/latest \
| grep "browser_download_url.*linux-amd64" \
@tom-butler
tom-butler / list-access-keys.sh
Created September 14, 2017 00:24
list aws access keys
#!/bin/bash
for user in $(aws iam list-users --output text | awk '{print $NF}'); do
aws iam list-access-keys --user $user --output text
done
@tom-butler
tom-butler / remote-state-provisioner.tf
Created August 21, 2017 00:27
Terraform remote-state-provisioner
#==============================================================
# remote-state.tf
#==============================================================
# This file is used to set variables that are passed to sub
# modules to build our stack
#--------------------------------------------------------------
# Global Config
#--------------------------------------------------------------
@tom-butler
tom-butler / crontab
Created August 20, 2017 23:59
goss implementation
*/5 * * * * cd /opt/healthz && /bin/echo "`date +'\%Y-\%m-\%dT\%H:\%M:\%SZ'` `/usr/local/bin/goss validate -f nagios_verbose`" >> healthz.log
@tom-butler
tom-butler / asg_time_delay.tf
Created August 2, 2017 00:30
ASG Time Delay
# Get the time in UTC 15 minutes from now
data "external" "date" {
# use date to get the time 15 mins from now
program = ["bash", "${path.module}/date.sh"]
}
# Wait 15 minutes before scaling instances.
resource "aws_autoscaling_schedule" "delaystart" {
scheduled_action_name = "delaystart"
min_size = 2
@tom-butler
tom-butler / AddAllOrgAccountsToPolicy.py
Created June 20, 2017 04:49
Boto3: Add All Org Accounts To IAM Policy
#!/usr/bin/env python3
import boto3
import json
central_logging = '<insert your central logging account id here>'
# Variables for the grafana monitoring server
role_name = 'monitoring_prodcloudwatch_access_role'
policy_arn = 'arn:aws:iam::<insert your central logging account id here>:policy/monitor-assumerole'
@tom-butler
tom-butler / centralMonitoringRole.tf
Created June 20, 2017 04:30
Terraform: Central Monitoring Role
#==============================================================
# tom-butler / centralMonitoringRole.tf
#==============================================================
variable "central_logging_account_id" {}
# The Role itself
resource "aws_iam_role" "monitor_access_role" {
name = "central-logging-monitor"
path = "/"
@tom-butler
tom-butler / InstanceProfile.json
Created June 20, 2017 03:29
Instance Profile
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "InstanceProfile",
"Effect": "Allow",
"Action": [
"sts:AssumeRole"
],
"Resource": [
@tom-butler
tom-butler / assumeRole.json
Last active June 20, 2017 03:24
Assume Role
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<CentralMonitoringAccountId>:role/<CentralMonitoringRole>"
},
"Action": "sts:AssumeRole"
@tom-butler
tom-butler / scout2.sh
Created February 27, 2017 21:41
scout2-pipeline
#!/bin/bash
#AWS keys should be set before this
echo "Installing Scout security auditor"
git clone https://github.com/nccgroup/Scout2
cd Scout2
pip3 install -r requirements.txt
python Scout2.py