To manipulate our Terraform Provider for CTFd along with the Chall-Manager plugin. This enable reusing the configuration thus integrate seamlessly.
Install the Terraform Provider for CTFd by setting the following in your main.tf file.
terraform {
required_providers {
ctfdcm = {
source = "registry.terraform.io/ctfer-io/ctfdcm"
}
}
}
provider "ctfdcm" {
url = "https://my-ctfd.lan"
}We recommend setting the environment variable CTFD_API_KEY to enable the provider to communicate with your CTFd instance.
Then, you could use a ctfdcm_challenge_dynamiciac resource to setup your CTFd challenge, with for instance the following configuration.
resource "ctfdcm_challenge_dynamiciac" "my_challenge" {
name = "My Challenge"
category = "Some category"
description = <<-EOT
My superb description !
And it's multiline :o
EOT
state = "visible"
value = 500
shared = true
destroy_on_flag = true
mana_cost = 1
scenario = "localhost:5000/some/scenario:v0.1.0"
timeout = 600
}Understanding what is going on under the hood or what could fail throughout the CTF lifecycle remains an important concern, even with such provider. For better understandability, we ship support for OpenTelemetry.
You can configure it using the SDK environment variables.
Note that CTFd does not support it natively, you may want to use our instrumented and packaged CTFd or proceed similarly for auto-instrumentation.
Also, the provider uses the always sampler hence we recommend you use a Collector probability sampler. An example follows, with arbitrary values.
processors:
probabilistic_sampler:
hash_seed: 22
sampling_percentage: 22
service:
pipelines:
traces:
receivers: [...]
processors: [probabilistic_sampler, ...]
exporters: [...]A more complete example is available here.