ErdemOzgen / blackcart

Custom Black arch based docker container for continuous automated red teaming
GNU General Public License v3.0
13 stars 5 forks source link

Add terraform script for aws to create Red Team Infrastructure #16

Open ErdemOzgen opened 10 months ago

KBErdogdu commented 9 months ago

Here is a template for AWS-EC2. Creates an instance using Blackcart installed AMI and a security group called "blackcart.app_sg".

terraform { required_providers { aws = { source = "hashicorp/aws" version = "5.26.0" } } }

provider "aws" { region = "REGION" }

Creates EC2 from the blackcart-ami-*. Uses the most recent one.

data "aws_ami" "packer_ami" { most_recent = true

filter { name = "name" values = ["blackcart-ami-*"] }

owners = ["self"] }

Security Group Configurations

resource "aws_security_group" "blackcart.app_sg" { name = "blackcart.app_sg" description = "All Traffic Allowed"

ingress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } egress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] ipv6_cidr_blocks = ["::/0"] } }

resource "aws_instance" "pentest_blackcart_app" { instance_type = "t2.micro" ami = data.aws_ami.packer_ami.id vpc_security_group_ids = [aws_security_group.blackcart.app_sg.id]

user_data = <<-EOF

!/bin/bash

          sudo systemctl start docker 
          EOF

}