Skip to content

Instantly share code, notes, and snippets.

View fijimunkii's full-sized avatar
🦁
𐂃͠

Harrison Powers fijimunkii

🦁
𐂃͠
View GitHub Profile
@fijimunkii
fijimunkii / docker_cleanup_prune
Created June 18, 2018 21:38
clean up docker images (prune df)
docker system df
docker system prune -a
@fijimunkii
fijimunkii / aws_cloudwatch_logs_and_metrics.sh
Last active May 10, 2018 14:54
aws cloudwatch logs and metrics setup
# ensure the instance has a role with CloudWatchAgentServerPolicy
# cloudwatch logs (awslogs)
curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O
sudo python ./awslogs-agent-setup.py --region us-east-1
# cloudwatch metrics
wget https://s3.amazonaws.com/amazoncloudwatch-agent/linux/amd64/latest/AmazonCloudWatchAgent.zip
unzip AmazonCloudWatchAgent.zip
sudo ./install.sh
@fijimunkii
fijimunkii / install_certs_linux.sh
Created April 24, 2018 20:33
install p12 certs to linux nssdb
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -d "$HOME/.pki/nssdb" ]; then
echo "cert db already initialized"
@fijimunkii
fijimunkii / gist:fbbc9beaf1c3fda76d10fa36e80ef618
Created April 12, 2018 14:12
check if aws security group is used
aws ec2 describe-network-interfaces --filters Name=group-id,Values=sg-123abc45
update kernel https://github.com/fijimunkii/linux-kernel-utilities
`sudo reboot`
update packages
disable root ssh login
compile outdated packages
@fijimunkii
fijimunkii / google-authenticator.md
Created March 23, 2018 19:27 — forked from troyfontaine/google-authenticator.md
Getting Google Authenticator working on Ubuntu for SSH Authentication

Google Authenticator for SSH How-To

Installing the Google Authenticator pam package alone does not configure a system for 2 Factor Authentication when connecting via SSH.

Overview

The Google Authenticator package can be installed on Ubuntu via apt-get on Ubuntu 14.04.3 and later (that I've confirmed).

It provides a pam module that allows you to prompt a user for a code generated via a Google Authenticator app or other compatible TOTP app (such as 1Password). The script below enables the authenticator prompt when using ssh and password authentication.

A few things to keep in mind:

  • You cannot enable Google Authenticator for Public Key-based authentication at the same time as Password-based authentication
@fijimunkii
fijimunkii / mount_ebs.sh
Created March 22, 2018 19:18 — forked from stingh711/mount_ebs.sh
How to mount another EBS as /var on EC2 (ubuntu)
#!/bin/bash
#attach the EBS to /dev/sdf before running it
#format EBS
mkfs -t ext4 /dev/xvdf
#copy original /var to /dev/xvdf
mkdir /mnt/new
mount /dev/xvdf /mnt/new
cd /var
@fijimunkii
fijimunkii / aws-temp-token.sh
Created February 22, 2018 15:04 — forked from ogavrisevs/aws-temp-token.sh
Script to generate AWS STS token
#!/bin/bash
#
# Sample for getting temp session token from AWS STS
#
# aws --profile youriamuser sts get-session-token --duration 3600 \
# --serial-number arn:aws:iam::012345678901:mfa/user --token-code 012345
#
# Based on : https://github.com/EvidentSecurity/MFAonCLI/blob/master/aws-temp-token.sh
#
@fijimunkii
fijimunkii / gist:61bf2b4d528d519520a5f4fde974771d
Created February 13, 2018 17:32
loop through pm2 jlist array
pm2 jlist | jq 'map(.pm_id) | .[]' -r | xargs -I pm_id sh -c '{ pm2 restart pm_id; sleep 5; }'
@fijimunkii
fijimunkii / gist:90b445b769608435c8de04e898c51849
Created February 13, 2018 17:31
check if ec2 instance supports Enhanced Networking
aws ec2 describe-instances --instance-ids $INSTANCE_ID --query "Reservations[].Instances[].EnaSupport"