This document outlines how to automate the deployment of a complete Command-and-Control (C2) infrastructure using Terraform, Nebula, Caddy, and Cobalt Strike. The objective is to achieve rapid, repeatable, and resilient infrastructure deployment for red team operations.
The automation covers:
Cloud virtual machine provisioning
Encrypted overlay networking
Cobalt Strike team server deployment
This setup enables fast infrastructure spin-up and teardown with minimal manual effort.
Linux system (Kali Linux recommended)
Cloud provider account (e.g., Linode)
Valid Cobalt Strike license
Project Structure
Download and install Terraform:
Initialize and manage infrastructure:
Core Terraform files used:
DNS Configuration
Terraform automatically manages DNS records for HTTPS and DNS-based C2 traffic.
Nebula Overlay Network
Nebula creates an encrypted overlay network between all infrastructure components.
Nodes include Lighthouse, Team Server, Redirectors, and Operator.
Caddy HTTPS Setup
Caddy is used as a reverse proxy with automatic TLS using ACME.
Cobalt Strike Setup
Convert TLS certificates:
Convert to Java Keystore:
Start the team server:
Install dependencies:
Example configuration:
Automating C2 infrastructure ensures consistency, speed, and improved operational security for red team engagements.