Skip to content

Instantly share code, notes, and snippets.

@luckylittle
luckylittle / DO425.md
Last active January 10, 2025 19:46
Red Hat DO425 Notes

Red Hat Security: Securing Containers & OpenShift (DO425)

Last update: Tue Jan 14 23:15:49 UTC 2020 by @luckylittle


Objectives

  1. Understand, identify, and work with containerization features
  2. Deploy a preconfigured application and identify crucial features such as namespaces, SELinux labels, and cgroups
@snixon
snixon / security-group-cleanup.py
Last active August 25, 2022 18:08 — forked from TomRyan-321/security-group-cleanup.py
Fancy Security Group Cleanup
#!/usr/bin/env python
import os
import boto3
import argparse
import json
# `pip install -U PTable` will get you the right fork of PrettyTable
from prettytable import PrettyTable
from botocore.exceptions import ClientError
# Split all objects and pass them to each filter below
# Create/Delete Namespace
(select(.verb == "create" and .objectRef.resource=="namespaces") |
"[" + .stageTimestamp + "] " + "Namespace Created: name=" + .objectRef.name),
(select(.verb == "delete" and .objectRef.resource=="namespaces") |
"[" + .stageTimestamp + "] " + "Namespace Deleted: name=" + .objectRef.name),
# Create/Delete Deployment
@qoomon
qoomon / aws-cloudformation-deploy-watcher.sh
Last active May 26, 2020 06:24
Watch CloudFormation Events during `aws cloudformation deploy`
#!/usr/bin/env bash
set -o errexit # exit when a command line fails
set -o pipefail # pipes exit code will be the last non-zero exit code of all pipe commands
set -o nounset # exit on read a undeclared variable
#set -o xtrace # enable debug logging
#### Source: https://gist.github.com/qoomon/d6633abe35eea297f475260478f86c8c
### Usage ###
#
@mateobur
mateobur / kubernetesmetadata.txt
Created March 1, 2019 11:59
Kubernetes monitoring, metadata for a pod
$ kubectl describe pod db-6b8968c69-dq2v2
Name: db-6b8968c69-dq2v2
Namespace: example-voting-app
Node: ip-10-0-0-12.ec2.internal/10.0.0.12
Controlled By: ReplicaSet/db-6b8968c69
Labels: app=example-voting-app
name=db
pod-template-hash=264524725
role=sqldb
IP: 10.129.0.140
@pietervogelaar
pietervogelaar / filter_detect_parser.rb
Created February 14, 2019 15:18
Fluentd parser detection with Kubernetes annotations
require 'fluent/plugin/filter'
# This filter detects the parser to use based on Kubernetes annotations.
#
# Annotation: fluentd.org/parser[_stream][-container]
#
# Suggest a pre-defined parser. The parser must be already registered by Fluentd. If present,
# the stream (stdout or stderr) will restrict that specific stream. If present, the container can
# override a specific container in a Pod.
#
@pavgup
pavgup / aws-resource-count-ucsf.sh
Created November 20, 2018 23:29
Updated RedLock Count Resources (command line argument for credentials profile)
#!/bin/bash
aws_regions=(us-east-1 us-east-2 us-west-1 us-west-2 ap-south-1 ap-northeast-1 ap-northeast-2 ap-southeast-1 ap-southeast-2 eu-central-1 eu-west-1 sa-east-1 eu-west-2 ca-central-1)
echo "Total regions: "${#aws_regions[@]}
ec2_instance_count=0;
rds_instance_count=0;
elb_count=0;
elasticache_count=0;
redshift_count=0;
@bzcorn
bzcorn / aws_log_splitter.py
Created November 19, 2018 09:52
This is for a lambda to respond to new cloudtrail or config logs hitting an s3 bucket and forwarding to sumologic. Some logs are >65kb in size and need to be broken up and sent to Sumologic. Package this (along with the requisite python libs) and have it listen to ObjectCreate events in your S3 bucket that cloudtrail/config logs are sent to. Thi…
import aiohttp
import asyncio
import async_timeout
import gzip
import os
import json
import boto3
import urllib.parse
import botocore
@alexanderilyin
alexanderilyin / README.md
Created November 15, 2018 00:58
Auto-increment Minor Semantic Version using Docker Hub API v2

For example your latest image with semantic versioning looks like this:

${DOCKER_HUB_ORG}/${DOCKER_HUB_REPO}:v1.20.0

Example provided above will do the folowing:

  1. Generate token using your github username and password.
  2. Get list of all tags from repository.
@tallclair
tallclair / gke-node-security.md
Created September 28, 2018 21:19
Software Engineering Position: Google Kubernetes Engine - Node Security

Software Engineering Position:
Google Kubernetes Engine - Node Security

Full-time
Based in Sunnyvale, CA

Mission

To secure critical node infrastructure in Kubernetes, the open source platform that is taking the cloud by storm ;D