A challenge is represented by a YAML file like the following:
- !ext4_file_recovery
name: "Ext4 File Recovery"
flag: "flag{this_is_a_test}"
config:
deleted_evidence: evidence
fluff: fluff
The type of challenge is determined by the YAML tag (starts with a !). Values in the config
field allow you customize the challenge to your competition.
Challenge environments host other challenges and can also be configured to fit the competition. They have the same fields as Challenges but also "link" to other challenges through the chals
subfield. An example is shown below.
- !jekyll_blog
name: Jekyll Blog
flag: "flag{test}"
config:
meta:
title: Chance's Cooking Blog!
posts:
- 2014-06-08-post1.md
- 2014-06-08-post2.md
chals:
- Vigenere
- Docx Carving
Challenges link through the name
field. Challenge environments can't be made/run through the python main.py gen
command, so you must use python main.py comp gen
.
Competitions are structured in a tree-like fashion, with some Challenge Environments serving as entrypoints. An example structure is shown below. In this case, Fesbuc is an entrypoint.
A competition folder has a config.yaml
that specifies the entrypoints and chals
folder that contains the challenges. You can look at the example in /competitions/middle-school-teaser-2021
python main.py gui -f <relative path of the competition folder>
After running the above command, a GUI will pop up to help scaffold your competition. You can create a challenge map and after clicking create competition files, a folder with all the nessecary YAML files will be created. You cab edit these YAML file to customize your competition.
python main.py chal gen -c <relative path of the challenge YAML>
This command generates all the files for challenges and builds the docker image if needed.
python main.py chal run -c <relative path of the challenge YAML>
This command runs the docker image for local testing. You must run python main.py chal gen
before in order to create all the files and build.
python main.py comp gen -f <relative path of the competition> -r <registry to push images to>
This command builds all of the Kubernetes files needed to deploy to a prexisting Kubernetes cluster. Upon completion, a graph of the challenges will be generated. The graph will be located at evidence_graph.png
file in the competition folder.
Note: If you are using an M1 or M2 Macbook, you must put export DOCKER_DEFAULT_PLATFORM=linux/amd64
in your ~/.zshrc
or ~/.bashrc
file. This is because the docker images must be built for linux/amd64 and not arm64. Change this to export DOCKER_DEFAULT_PLATFORM=linux/arm64
if you are running locally.
python main.py comp gen -f <relative path of the competition> -l
This command assumes you have minikube
installed. Install it here. By default, this command uses the challenges-lock.json
to only generate challenges that have been changed. If you want to regenerate all challenges, use the -a
flag. This command will also generate a graph of the challenges. The graph will be located at evidence_graph.png
file in the competition folder.
Once you are done, you can run kubectl delete namespace challenges
to delete the competition and minikube delete
to delete the cluster.
- Obtain a domain name with a wildcard SSL certificate
- Create a Google Cloud account here
- Create a project in Google Cloud
- Go to the Google Cloud Console
- Click on the dropdown next to the Google Cloud logo and select "New Project"
- Give your project a name and click "Create"
- Use the Codespaces button in our repo to create a new Codespace OR install the Pre-reqs and clone the repo.
- Install the Google Cloud SDK here if running locally
- Run
gcloud auth login
and follow the instructions to login to your Google Cloud account - Create a Kubernetes cluster in Google Cloud
gcloud container clusters create <cluster-name> --num-nodes=<number of node> --zone=<zone>
- You can change the zone to any of the zones listed here
- You can change the number of nodes to any number you want
- Get the credentials for your cluster
gcloud container clusters get-credentials <cluster-name> --zone=<zone>
- Run
python main.py comp gen -f <relative path of the competition> -r <registry to push images to>
- Docker Hub is a free registry to use, check it out here
- All images will be public, however, so you may want to create a private repo
- You can also use a private registry, check out the instructions here
- Once you create a private registry, you will need to run
gcloud auth configure-docker
to authenticate with your registry
- Docker Hub is a free registry to use, check it out here
- Update your domain's DNS records to point to the ingress IP address of your cluster
- Run
kubectl get ingress -n challenges
to get the IP address - Update your domain's DNS records to point to the IP address
- Run