Skip to content

Instantly share code, notes, and snippets.

View cwgem's full-sized avatar

Chris White cwgem

View GitHub Profile
@cwgem
cwgem / ssm_doc.json
Last active April 20, 2020 03:47
Sample SSM Doc
{
"schemaVersion":"0.3",
"description":"Updates AMI with Linux distribution packages and Amazon software. For details,see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sysman-ami-walkthrough.html",
"assumeRole":"{{AutomationAssumeRole}}",
"parameters":{
"SourceAmiId":{
"type":"String",
"description":"(Required) The source Amazon Machine Image ID.",
"default":"ami-8b92b4ee"
},
@cwgem
cwgem / weird_python.py
Created February 12, 2017 22:45
Python and default keyword args fun
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> # Let's make a function!
... def myfunc(value,mylist=[]):
... mylist.append(value)
... print(mylist)
...
>>> # Now let's run it a few times!
... myfunc(1)
[1]
@cwgem
cwgem / .config
Created December 5, 2016 09:37
VMWare Workstation 4.x kernel config (server oriented)
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 4.4.26-gentoo Kernel Configuration
#
#
# Gentoo Linux
#
CONFIG_GENTOO_LINUX=y
CONFIG_GENTOO_LINUX_UDEV=y
@cwgem
cwgem / user_chroot.sh
Created May 20, 2016 21:09
Running something in chroot with a specific user (inside the root)
user_chroot() {
local user=$1; shift;
local mount_point=$2; shift;
chroot "${mount_point}" /bin/su - "${user}" -c "$*"
}
@cwgem
cwgem / openssl_fixes.md
Created May 3, 2016 19:24
OpenSSL May 3rd CVE git commits
@cwgem
cwgem / echo.c
Last active August 29, 2015 14:19
C Echo Server (utilizing linux namespaces)
/*Required Headers*/
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sched.h>
#include <stdlib.h>
@cwgem
cwgem / gist:abc8de5679cfd0d3526d
Last active August 29, 2015 14:07
Bash Shellshock Fixes

Introduction

This is meant to provide a summary of CVEs and fixes for them revolving around the shellshock collection of bugs. These bugs were primarily related to how bash does parsing of environment variables. Correlation between CVEs and upstream patches/releases has been fairly messy so I'm going to just summarize everything here. This pretty much comes from this oss-sec thread.

Checking for vulns

Currently I use hannob's bashceck script to do testing for shellshock related vulns.

Fix through latest versions

@cwgem
cwgem / nginx.conf
Created January 24, 2014 21:16
Testing nginx proxying
user deploy deploy;
worker_processes 8;
worker_rlimit_nofile 10240;
pid /var/run/nginx.pid;
events {
worker_connections 8192;
use epoll;
}
diff -ru linux-3.8.8-hardened.orig/arch/x86/Kconfig.cpu linux-3.8.8-hardened/arch/x86/Kconfig.cpu
--- linux-3.8.8-hardened.orig/arch/x86/Kconfig.cpu 2013-04-25 21:35:02.808773679 -0700
+++ linux-3.8.8-hardened/arch/x86/Kconfig.cpu 2013-04-26 02:12:55.479540082 -0700
@@ -139,7 +139,7 @@
config MK6
- bool "K6/K6-II/K6-III"
+ bool "AMD K6/K6-II/K6-III"
depends on X86_32
@cwgem
cwgem / java-acronyms.md
Last active December 16, 2015 08:49
Java Enterprise Acronyms Expanded

Acronyms order alphabetically. Descriptions pulled mostly from Oracle website.

Acronym Expansion Description
CP Class Path The CLASSPATH variable is one way to tell applications, including the JDK tools, where to look for user classes
EAR Enterprise ARchive A Java EE application is delivered in an Enterprise Archive (EAR) file, a standard Java Archive (JAR) file with an .ear extension. Using EAR files and modules makes it possible to assemble a number of different Java EE applications using some of the same components. No extra coding is needed; it is only a matter of assembling (or packaging) various Java EE modules into Java EE EAR files.
EJB Enterprise Java Beans Enterprise JavaBeans (EJB) technology is the server-side component architecture fo