Giter VIP home page Giter VIP logo

c2-terraform's Introduction

C2 Deployment on AWS / Azure with Terraform

Terraform scripts to create HTTP/S redirectors on AWS and Azure along with Cobalt Strike server on Azure. Besides the resources deployment automates the following:

  • Setup the nginx for redirection with custom config to forward CS beacon requests only.
  • Generation and registration of SSL certificate via Let's Encrypt and certbot.
  • Deploy dummy web site instead of default nginx page
  • CS installation delivery to the C2 server and preps required to run the teamserver.

Building C2 Server

  • Archive your Cobalt Strike folder to cs.tar and copy to azure-cobalt\configs folder.
  • Fill in azure-cobalt\terraform.tfvars with Azure secrets.
  • Execute the build.
cd azure-cobalt; terraform init; terraform apply

SSH key will be generated and saved in the current folder. Note the public IP of the server.

Building HTTP/S redirect server on Azure / AWS

  • Ensure you have a domain name registered.
  • Open the DNS Management for your domain and be ready to change the A Record to the IP generated during the following build process.
  • For Azure, fill in azure-redir\terraform.tfvars with your domain name, Public IP of previously created C2 server and Azure secrets. Change AAA in arm_subnet_id to your subscription ID.
  • For AWS fill in aws\terraform.tfvars with your domain name, Public IP of previously created C2 server and AWS secrets.
  • Execute the build.
cd azure-redir; terraform init; terraform apply
cd aws; terraform init; terraform apply

Important!!! Follow the server creation process. Once the public IP is printed to the screen, update the DNS A Record in your domain DNS Management immediately. It will be used on the last build stage by the certbot during the SSL certificate registration.

SSH key will be generated and saved in the current folder.

Destroying C2

Ensure you follow the next order:

cd azure-redir; terraform destroy -auto-approve
cd azure-cobalt; terraform destroy -auto-approve
cd aws; terraform destroy -auto-approve

Post deployment (optional)

Check post-install.bat which locks down the 443 ports on C2 Server to accept connections from redirect server only and uploads the redirect server SSL keystore to C2 server.

c2-terraform's People

Contributors

cepxeo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.