This repository serves as a basic example for creating a simple containerized exploit lab in AWS. It deploys a vulnerable docker image from vulhub along with a Kali Linux container.
This is for educational purposes only! Be safe and be nice!
- Install Terraform onto your machine
- Install AWS CLI
- Generate SSH key
You will need to install the AWS CLI onto the machine
Generate SSH key
ssh-keygen -f ~/.ssh/id_rsa_terraform
Create keys and secrets in AWS.
Clone the repository with git clone https://github.com/nericksen/terraform-exploit-lab-example.git
.
Change directories into the newly cloned repository and run terraform init
.
Review the main.tf file.
Note there are no security groups assigned to this image in order to keep it simple.
It uses the default settings for a region.
The default security group could therefore be modified to allow for a single IP access over ssh,
or more secure setup would be to setup a private subnet with access via VPN or AWS SSM agent or similar.
Run terraform plan
to see the proposed infrastructure changes.
Run terraform apply
to create the infrastructure.
Note you may want to install all the default Kali linux metapackages.
You can do so with apt update && apt -y install kali-linux-headless
once inside the Kali container.
The containers can be inspected with sudo docker ps -a
.
The Kali shell can be accessed with sudo docker exec -it <container_id> /bin/bash
.
You may also want some vulnerability scanning capabilites in nmap.
cd /usr/share/nmap/scripts/
git clone https://github.com/vulnersCom/nmap-vulners.git
nmap --script nmap-vulners/ -sV 172.17.0.1
Study up while it updates and get ready to hack!