Skip to content

Instantly share code, notes, and snippets.

View gene1wood's full-sized avatar
🎩

Gene Wood gene1wood

🎩
View GitHub Profile
@gene1wood
gene1wood / get_github_pubkey.py
Created January 9, 2015 22:01
A script to fetch a users ssh public key from github to be used with sshd and AuthorizedKeysCommand
#!/bin/env python
import sys
import requests
import re
# To use this script with openssh-server 6.2 or newer
# Add these lines to /etc/ssh/sshd_config
#
# AuthorizedKeysCommand /path/to/get_github_pubkey.py
#!/usr/bin/python
import argparse, sys, re, time
from boto.vpc import connect_to_region
import boto.exception
import boto
import boto.ec2
#----------------------------------------------------------
def create_connection_to_aws(region):
#!/usr/bin/python
import argparse, sys, re, time
from boto.vpc import connect_to_region
import boto.exception
# import boto
#----------------------------------------------------------
def create_connection_to_aws(region):
#----------------------------------------------------------
#!/usr/bin/env python
import boto.sts
region = 'us-west-2'
saml_assertion = ''.join(sys.stdin.readlines())
conn_sts = boto.sts.connect_to_region('us-east-1')
credentials = conn_sts.assume_role_with_saml(
role_arn = "arn:aws:iam::248062938574:role/okta_webops",
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Creates VPC, 3 AZes, 2 public subnets, 1 shared services private subnet, 4 private per-app-subnets, NATs and a BastionHost",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
"Type": "AWS::EC2::KeyPair::KeyName",
"ConstraintDescription" : "must be the name of an existing EC2 KeyPair."
@gene1wood
gene1wood / show-puppet-facts.sh
Created June 4, 2015 22:51
Show puppet facter facts for a local puppet masterless node
puppet facts find `hostname` --render-as yaml
$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
$ ruby symbol_literals.rb
valid as first char:
@$_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
valid as middle char:
_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
valid as end char:
!_=?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
@gene1wood
gene1wood / chef-lwrp-object-name-guide.md
Created August 14, 2015 16:39
Chef LWRP Resource Object Name

In the Chef LWRP documentation it is unclear how to derive the object name. For example in this section, callbacks,

https://docs.chef.io/lwrp.html#callbacks

this object is shown

Chef::Resource::GunicornConfig.validate_server_hook_hash_keys(hooks)

and here

@gene1wood
gene1wood / get_github_team_members_missing_2fa.py
Created September 1, 2015 17:13
Search a GitHub orgnaizational team for users without two factor auth enabled
#!/usr/bin/env python
import github3
import sys
from getpass import getpass, getuser
import logging
LOG_LEVEL = logging.ERROR
ORG_NAME = 'Mozilla'
TEAM_NAME = 'Core'
@gene1wood
gene1wood / check-persona-url.py
Created August 22, 2012 08:32 — forked from jrgm/check-persona-url.py
enumerate possible urls
#!/usr/bin/env python
import json
import os
import requests
# https://bugzilla.mozilla.org/show_bug.cgi?id=781838
# - POSTs MUST never redirect
# - POST over non-SSL MUST fail 400 Bad Non-SSL
# - GETs to the old domains MUST redirect to the new domain
# - www. MUST always redirect