Skip to content

Instantly share code, notes, and snippets.

{
"gcp_image_family": "rhel-7",
"gcp_zone": "asia-southeast1-a",
"gcp_ssh_user": "gce-user",
"aws_region": "ap-southeast-1",
"aws_ami_filter_name": "RHEL-7.7*x86*",
"aws_base_ami_owner": "309956199498",
"aws_ami_name": "RHEL-7.7",
"aws_instance_type": "t2.medium",
"aws_ssh_user": "ec2-user"
---
- name: Harden the image
hosts: all
become: true
roles:
- dev-sec.os-hardening
- dev-sec.ssh-hardening
vars:
ssh_use_pam: true # to allow access with our key on ec2
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
"aws_instance_type": "{{env `AWS_INSTANCE_TYPE`}}",
"aws_ami_name": "{{env `AWS_AMI_NAME`}}",
"aws_region": "{{env `AWS_REGION`}}",
"aws_ami_filter_name": "{{env `AWS_AMI_FILTER_NAME`}}",
"aws_base_ami_owner": "{{env `AWS_BASE_AMI_OWNER`}}"
},
ARG ALPINE_VERSION=3.11
FROM alpine:${ALPINE_VERSION}
# packages version
ARG PACKER_VERSION=1.6.0
# PARAMETERS
ARG PACKER_URL="https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip"
{
"Statement": [
{
"Sid": "PackerSecurityGroupAccess",
"Action": [
"ec2:CreateSecurityGroup",
"ec2:DeleteSecurityGroup",
"ec2:DescribeSecurityGroups",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:RevokeSecurityGroupIngress"
@Bharathkumarraju
Bharathkumarraju / list_all_k8s_resources.sh
Last active May 19, 2020 03:05
List all available api resources in all namespaces in kubernetes cluster
#! /bin/bash
ALL_RESOURCES=$(kubectl api-resources | awk 'NR>1' | awk '{print $1}' | xargs echo)
for i in $ALL_RESOURCES
do
echo -e "$i\n------------------------------------------------------------------"
kubectl get $i --all-namespaces
echo -e "\n"
done
jobs:
should_run:
name: should run the next job
runs-on: ubuntu-latest
steps:
- name: check if vb is the commiter
if: github.event.pusher.name != 'vibou'
run: exit 1 # the job fails if not vibou
perform_action:
name: should run the next job
@Bharathkumarraju
Bharathkumarraju / networking.tf
Created October 1, 2019 03:52 — forked from duduribeiro/networking.tf
Terraform staging - networking.tf
module "networking" {
source = "../modules/networking"
environment = "${var.environment}"
vpc_cidr = "${var.vpc_cidr}"
public_subnet_cidr = "${var.public_subnet_cidr}"
private_subnet_cidr = "${var.private_subnet_cidr}"
region = "${var.region}"
availability_zone = "${var.availability_zone}"
key_name = "${var.key_name}"
}
@Bharathkumarraju
Bharathkumarraju / Dockerfile
Created October 1, 2019 03:51 — forked from duduribeiro/Dockerfile
Dockerfile 2
# dump build stage
FROM postgres:11-alpine as dumper
COPY test_dump.sql /docker-entrypoint-initdb.d/
RUN ["sed", "-i", "s/exec \"$@\"/echo \"skipping...\"/", "/usr/local/bin/docker-entrypoint.sh"]
ENV PG_USER=postgres
ENV PGDATA=/data
#!/bin/bash
aws ecr describe-repositories | jq -r '.repositories[].repositoryName'