Skip to content

Instantly share code, notes, and snippets.

@callum-p
callum-p / root-logon-alert.yaml
Created November 26, 2019 21:51
CloudFormation Root Logon Alert
Description: Creates alerts for root logins
Parameters:
emailRecipients:
Type: CommaDelimitedList
Default: 'xx.xx@xx.co,xx.xx@xx.co'
slackChannel:
Type: String
Default: '#security-task-force'
slackToken:
docker run --rm -v $PWD:/analyse node:10.8.0-alpine /bin/sh -c "npm install -g audit-ci && cd /analyse && npm audit --json" | xclip -sel clip
/usr/local/bin/audit-ci -> /usr/local/lib/node_modules/audit-ci/bin/audit-ci
+ audit-ci@1.3.1
added 56 packages from 12 contributors in 2.685s
{
"actions": [
{
"module": "babel-preset-env",
"resolves": [
{
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
@callum-p
callum-p / logstash-cloudwatch.yml
Last active August 24, 2021 21:31
Deploys lambda functions to forward cloudwatch logs to logstash
Description: Deploys lambda functions to forward cloudwatch logs to logstash
Parameters:
coreNetworkingStackName:
Type: String
Resources:
lambdaRole:
Type: "AWS::IAM::Role"
Properties:
import boto3
import copy
table = "${destTableName}"
def handler(event, context):
// do some assume role stuff into another account here
// client = boto3.client('iam')
// response = client.assume_role(
// RoleArn=arn,
// RoleSessionName=username,
// DurationSeconds=timeout
@callum-p
callum-p / Jenkinsfile
Created May 22, 2018 23:34 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage concurrency constraints, ...
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
/*
Please make sure to add the following environment variables:
HEROKU_PREVIEW=<your heroku preview app>
HEROKU_PREPRODUCTION=<your heroku pre-production app>
HEROKU_PRODUCTION=<your heroku production app>