This repo houses the CTFd app, Terraform files to deploy, and some automation to glue everything together. This has been scrubbed so you will need to add in your own Terraform values and AWS account ID in the makefile
CTFd has been modified so config.py grabs secrets from AWS parameter store directly. It is possible to just wrap CTFd in a script to inject the params into the environment so you don't need to clone the whole repo so feel free to make a PR for that.
- Make
- git
- Docker
- bash or zsh
- AWS
start local dev
make up
(ctrl+c to stop)
stop local dev
make stop
delete local dev
make down
deploy
make deploy ENV=dev|prod
Build the container
make build
Run make up
Open localhost:8000 in a browser
If running this for the first time, set up the admin info in the first UI (Name = 'CTF', admin credentials = anything you want, its not important for local dev)
Make changes and updates to challenges as needed
Once done, navigate to Admin Panel -> Config -> Backup -> Export
Move this file to ./Config
. This file should be checked in and updated as it will be an archive of the latest state.
For anyone who wants to work with the latest changes:
Navigate to Admin Panel -> Config -> Backup -> Import
Choose the latest backup file in ./Config
and import it.
Note this will update the name and admin password for the local instance
Start the app, import the config, export your new changes, commit and push
An example config is located in ./Config
Deploy the infra
make deploy ENV=dev|prod
Add the secrets to parameter store
scripts/add_params.sh
Deploy the containers
make buildx push
Create the database and user in mysql
scripts/make_db.sh $DB_HOST
Restart the container in ecs