-
Notifications
You must be signed in to change notification settings - Fork 259
Quick Tutorial
Each Red Barron module configures a defined resource and abstracts most of the code necessary to configure the underlying Terraform provider.
Let's take a look at an extremely simple example (this was taken from the basic_http_c2_linode.tf example config file):
module "http_c2" {
source = "./modules/linode/http-c2"
}
module "http_rdir" {
source = "./modules/linode/http-rdir"
redirect_to = "${module.http_c2.ips}"
}
-
We define the
http_c2
module and give it the source which in this case is the folder located at./modules/linode/http-c2
. As the name entails, this module will create a HTTP C2 server in Linode. If you take a look at the linode/http-c2 module documentation you will see that it doesn't have any required arguments so we don't really need to specify anything else. -
We now want an HTTP redirector in order to obfuscate our C2 server. We define the
http_rdir
module and give it the appropriate module source location. Looking at the linode/http-rdir module docs we see the only required argument is a list of IPs to redirect HTTP traffic to. Luckily the output of thehttp_c2
module gives us exactly that! All we now need to do is feed the output of thehttp_c2
module to theredirect_to
argument. This also creates an implicit dependency meaning that Terraform will first create the HTTP C2 before the HTTP redirector since we need it's IP.
All modules generate unique SSH keys for each instance and are outputted to the ./ssh_keys
directory once the resource has been successfully created.
You're now ready to create your Red Team infrastructure! Once you've set the environment variables with the appropriate API keys (in our example you'd only need the Linode API key), save the above example to the root folder of the repository and run the following:
-
terraform init
(Documentation) -
terraform plan
(Documentation)
Finally let's create our infrastructure and watch all the magic happen automatically:
-
terraform apply
(Documentation)