Skip to content
solidshadwPublic

About

Terraform to deploy sliver C2

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Terraform Walk-Through

Please refer to the SETUP document, if you don't have AWS cli and Terraform installed. You will also need to setup some AWS credentials.

Shoutout to David Thurn (@packetmonster) since I got most of the documentation and the main.tf from his workshop at SaintCon2023. Credits to him as I will using some of that code

Git Clone Command - if not already done.

git clone https://github.com/solidshadw/terraSliv.git

Start terraform ec2 commands

Explanation of terraform commands is below:

cd terraSliv
terraform init
terraform fmt
terraform plan
terraform apply

Please wait a few minutes for the bash script to complete after EC2 has been deployed

After you are done, destroy your environment. If not, you will be charged by AWS after your free tier hours are up. Don't tell I didn't tell you...

terraform destroy

1: Base Configuration

Rename the following "example" to your desired name:

resource "aws_vpc" "example"
resource "aws_internet_gateway" "example"
resource "aws_subnet" "example"
resource "aws_route_table" "example"
resource "aws_route" "default_route"
resource "aws_route_table_association" "example"
resource "aws_security_group" "example"
resource "aws_instance" "example"

value = aws_instance.example.public_ip

Once your have chosen your friendly names, update the associated references in the main.tf file.
Each line below represents a reference that needs to be updated.

vpc_id          = aws_vpc.example.id
vpc_id          = aws_vpc.example.id
vpc_id          = aws_vpc.example.id
route_table_id  = aws_route_table.example.id
gateway_id      = aws_internet_gateway.example.id
subnet_id       = aws_subnet.example.id
route_table_id  = aws_route_table.example.id
vpc_id          = aws_vpc.example.id
subnet_id       = aws_subnet.example.id 
aws_security_group.example.id

value = aws_instance.example.public_ip

Modify the security group with your current IP.

  ingress {
    from_port = 22
    to_port   = 22
    protocol  = "tcp"
    cidr_blocks = ["66.0.0.97/32"] # Change this to your current ip
  }
    ingress {
    from_port = 80
    to_port   = 80
    protocol  = "tcp"
    cidr_blocks = ["66.0.0.97/32"] # Change this to your current ip
  }
    ingress {
    from_port = 443
    to_port   = 443
    protocol  = "tcp"
    cidr_blocks = ["66.0.0.97/32"] # Change this to your current ip
  }

2: Terraform Commands

  1. terraform init is used to initialize a new or existing Terraform project. When you run this command in a directory containing your Terraform configuration files (usually with a main.tf file), Terraform initializes the working directory by downloading any required provider plugins and modules defined in your configuration.
terraform init
  1. terraform fmt is used to format (auto-format) your Terraform configuration files to adhere to a consistent and standardized style.
terraform fmt
  1. terraform plan is used to create an execution plan for your Terraform configuration. When you run this command, Terraform analyzes your configuration and infrastructure state and provides a detailed preview of the changes it's going to make when you apply your configuration.
terraform plan
  1. terraform apply is used to apply the changes defined in your Terraform configuration to your infrastructure. After running terraform plan and reviewing the execution plan, you can use terraform apply to enact the changes. This command will create, update, or delete resources as specified in your configuration.
terraform apply
  1. USE only to destroy environment terraform destroy is used to destroy the infrastructure and resources created by your Terraform configuration. When you run this command, Terraform will determine which resources are managed by your configuration and initiate the process of destroying them
terraform destroy

About

Terraform to deploy sliver C2

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages