Skip to content

Instantly share code, notes, and snippets.

View tb3088's full-sized avatar

Matthew Patton tb3088

  • Personal projects
  • Alexandria Virginia
View GitHub Profile
@tb3088
tb3088 / gist:6f11eefdb0da4e52a378de9c43cb8146
Created October 3, 2017 23:10
Packer wrapper and README
RUNNING
=======
symlink 'packer-wrapper.sh' to desired command: eg. verify, build, inspect
Run with '-h' to get usage.
example:
./validate.sh -i ami-xxx[.var|.json] -e dev -r us-east-1 base.json
@tb3088
tb3088 / ssh-wrapper.sh
Last active October 4, 2017 22:23
SSH wrapper
#!/bin/bash
# Usage:
#
# [VERBOSE=-v]
# [PROFILE=<profile>]
# [IDENTITY=<key>]
# ssh-wrapper.sh [cmd] <host> [args]
#
# just symlink to the wrapper to automatically set PROFILE
@tb3088
tb3088 / scrub.sh
Created October 5, 2017 19:49
purge a directory structure of 'old' files
#!/bin/bash
[ -x "${FIND:=`which find 2>/dev/null`}" ] || { echo "ERROR: 'find' program ($FIND) not found/executable"; exit 1; }
PROG=`basename $0 .sh`
declare -i VERBOSE=0 MAXDEPTH=1 DRYRUN=0
let ${AGET:=atime}
let ${AGE:='+1'}
@tb3088
tb3088 / gist:4ea9324ce6c3d10ea7ef08559797c5c9
Created November 20, 2018 10:58
combined RHEL6/7 playbook
# use '--skip-tags=grub,bootloader,rescue,sudoers' to skip DANGEROUS items
---
- hosts: all
become: yes
vars:
update_all_packages: no
do_cat1: yes
do_cat2: yes
do_cat3: no
@tb3088
tb3088 / group_vars::RedHat7.yaml
Created November 22, 2018 16:04
new 'smart' playbook and supporting files
---
rhel7stig_cat1: "{{ apply_cat1 }}"
rhel7stig_cat2: "{{ apply_cat2 }}"
rhel7stig_cat3: "{{ apply_cat3 }}"
rhel7stig_logon_banner: "{{ login_banner }}"
rhel7stig_update_all_packages: "{{ not package is defined or package.update_all }}"
rhel7stig_bootloader_password: "{{ not bootloader is defined or bootloader.password }}"
# !disable 'exec' on NFS
rhel_07_021021: false

Keybase proof

I hereby claim:

  • I am tb3088 on github.
  • I am mpattoncs (https://keybase.io/mpattoncs) on keybase.
  • I have a public key ASBXoXGWFnDHS-EK4hHY_AnEQuaDYFIa36BsUaZDCMoDigo

To claim this, I am signing this object:

@tb3088
tb3088 / gist:83b3f8761456ace5ee3761cd613acd6b
Created December 16, 2018 01:42
IAM user self-management
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
"Action": [
"iam:ListAccountAliases",
"iam:ListUsers",
"iam:ListGroups",
#!/bin/bash -e
set -o pipefail; LC_COLATE=C
: "${LETTERS:=5}"
: "${ROUNDS:=7}"
: "${DICTIONARY:=/usr/share/dict/words}"
#https://www.shellhacks.com/bash-colors/
hit='\e[30;102m'; match='\e[30;103m'; miss='\e[30;107m'; reset='\e[0m'
pool=`printf '%s' {a..z}`