Skip to content

Instantly share code, notes, and snippets.

View rogerbush8's full-sized avatar

Roger Bush rogerbush8

  • Everyonesocial
  • Oakland, CA
View GitHub Profile
@rogerbush8
rogerbush8 / vpn-list-connections
Created April 20, 2015 22:21
Output info on active vpn connections (assumes use of pppd)
#!/usr/bin/perl
# Looks at the output of ps to determine how many pppd children are running,
# each of which corresponds to an active connection. Assumes use of pppd
# as the authenticating agent for the vpn.
my $cmd = 'ps auxwww';
open (my $in, "$cmd |") or die "Couldn't execute command '$cmd'";
@rogerbush8
rogerbush8 / nat-heartbeat-failover-monitor-python-script-for-aws
Last active April 3, 2022 18:16
nat-heartbeat-failover-monitor-script-for-aws
#!/usr/bin/python
# aws-instance-monitor
#
# This is a command-line tool, as well as a monitor/failover script that is designed
# for HA NAT, but should be usable when the following conditions are met:
#
# 1. Used in AWS VPC Route Table - VPC routing describes methods of egress
# for outbound traffic. Typically, a NAT will have a 0.0.0.0/0 rule
# and the route will be in a table associated with a Private Subnet.
@rogerbush8
rogerbush8 / configure-linux-as-nat-rhel
Last active August 29, 2015 14:17
configure-linux-as-nat-rhel
# This script configures a linux box as a NAT router (PAT), suitable for use
# for AWS instances in a VPC Private Subnet to communicate with the Internet
#
# To setup a NAT:
# # Create an AWS instance in Public Subnet
# # Disable src./dest. check (networking menu in UI)
#
# To install, login to instance:
# sudo su -
# curl http://gist.github.com/.../raw/... | bash -s
@rogerbush8
rogerbush8 / install-and-build-nodejs-from-source
Last active August 29, 2015 14:16
install-and-build-nodejs-from-source
#### Pulls Nodejs Source, Builds and Installs
#
# I've run this successfully on an AWS EC2 instance running a RHEL AMI. It
# should work fine for installs on recent RHEL descended distros.
#
# Installation is done by pulling this script from curl, and piping it
# through bash, with appropriate parameters. This must be run as root,
# and local files (e.g. temp files) will be created relative to the
# current working directory.
#
@rogerbush8
rogerbush8 / install-libreswan-ipsec-vpn-regional-vpc-tunnel-on-aws-ec2_aws_linux_ami_201409
Last active April 26, 2024 07:32
install-libreswan-ipsec-vpn-regional-vpc-tunnel-on-aws-ec2_aws_linux_ami_201409
#!/bin/sh
#
# Shell script for installation and setup of L2TP/IPsec VPN tunnel in site-to-site
# mode (e.g. connecting two inter-regional VPCs). VPN software is libreswan.
#
# This should work on linux systems that are RHEL based.
#
# To install directly from this gist, you can curl the "raw" version and pipe that to
# "bash -s" while also defining the environment variables:
#
@rogerbush8
rogerbush8 / install-libreswan-xl2tpd-ipsec-vpn-remote-access-on-aws-ec2_aws_linux_ami_201409
Last active December 23, 2018 18:44
install-libreswan-xl2tpd-ipsec-vpn-remote-access-on-aws-ec2_aws_linux_ami_201409
#!/bin/sh
#
# Shell script for installation and setup of L2TP/IPsec VPN tunnel in remote access
# mode. Remote access mode allaows individual users to login using username/password
# and be allocated IP on the private network. Uses shared secret (PSK) and username/password
# in file (ppp chap-secret) for authentication. VPN software is libreswan + xl2tpd + pppd.
#
# This should work on linux systems that are RHEL based.
#
# To install directly from this gist, you can curl the "raw" version and pipe that to
@rogerbush8
rogerbush8 / install-simple-nodejs-webserver-on-ec2_aws_linux_ami_201409
Last active April 3, 2022 18:05
Install Simple Node.js (Express) WebServer on bare AWS EC2 Linux AMI (201409, Fedora 19 "like")
#### Installs Nodejs and Express on a new AWS EC2 instance, running Linux AMI.
# "Webserver" is about 10 lines of code in Express.js/Node
# This works on RHEL systems (i.e. yum).
# To install, do this on target machine (make sure to get the link from RAW gist):
#
# $ sudo su -
# $ curl https://gist...../raw/... | bash -s
#### Step 1: Note OS
# Installing Nodejs depends on which OS you're on. Since I was on a AWS AMI
@rogerbush8
rogerbush8 / install-debian-wheezy-wordpress
Last active August 29, 2015 14:13
Clean interactive install on Debian Wheezy of Latest WordPress # /var/www
# Shell commands to interactively install wordpress on Debian Wheezy
# This is not an automatic script (but could be easily converted). Assumes you have root.
# Assumes you have Apache2, PHP and MySQL already installed.
# @see https://gist.github.com/rogerbush8/db4266946b4a02e967ed - rogerbush8/install-debian-wheezy-apache2-php-mysql
# which could be performed as a prerequisite.
# Pull latest tarball directly from wordpress.org and untar it to /var/www.
# All files will end up in /var/www/wordpress.
cd /tmp
@rogerbush8
rogerbush8 / install-debian-wheezy-apache2-php-mysql
Last active August 29, 2015 14:13
Clean interactive install on Debian Wheezy of Apache2 with PHP and MySQL support
# Shell commands to interactively install Apache2 with PHP and MySQL support on Debian Wheezy
# This is not an automatic script (but could be easily converted). Assumes you have root.
# @see https://gist.github.com/rogerbush8/945baf7a3f1a9ae99ab1 - rogerbush8/install-debian-wheezy-mariadb-10
# which could be performed as a prerequisite for simple client/server install.
# Update
apt-get update
apt-get upgrade --show-upgraded
@rogerbush8
rogerbush8 / install-debian-wheezy-mariadb-10
Last active May 17, 2017 01:31
Clean interactive install of MariaDB 10.0+ on Debian Wheezy.
# Shell commands to interactively install MariaDB 10.0 on Debian Wheezy
# This is not an automatic script (but could be easily converted). Assumes you have root.
# Update
apt-get update
apt-get upgrade
# Add MariaDB repo and key for Debian Wheezy MariaDB 10.0 (SF mirror)