This deployment script is used for FRESH deployments of CTFd using Docker. Used to cut the time of deployment on new instances of CTFd. Can be customized for specific config, admins, challenges, and pages, as to skip the setup step for a premade CTF. Also includes automatic setup of HTTPS with SSL Certificate.
Not meant to replace export/import from CTFd, rather used for FRESH deployments.
Make sure to read through the CTFd documentation and install their dependencies before using this script, as it is dependent on it.
- Docker, Install docker.
- Docker-compose, Install docker-compose.
- CTFd, pull CTFd in CTFdeploy as a submodule:
git submodule update --init
- Python3, PyYAML, pycountry
-python3 -m pip install -r requirements.txt
PyYAML
: Used to check for syntax errors insetup.yml
before deployment.pycountry
: Used to check the countrycode given to users when going throughsetup.yml
syntax.
- Curl, install either via your package manager or from source.
- WIP
The setup is controlled by a single YAML file. The different sections control how the CTF is setup.
Make sure setup.yml
is configured to your liking. It is located in OCD/setup.yml.
- Configure setup.yml.
- Move used files into their folders.
- For config - OCD/config_files.
- For pages - OCD/pages_files.
- For challenges - OCD/challenge_files. - OPTIONAL: Configure Docker challenge containers.
- Copy yourdocker-compose.yml
into OCD/docker_challenges along with their Docker builds. - SetDOCKER_COMPOSE
to 1 instart.sh
and they will be started after CTFd setup. - OPTIONAL: Configure SSL Certificate setup.
- Copy your private key and certificate into OCD/ssl_cert.
- Editstart.sh
and define youhostname URL
,certificate filename
, andprivate key filename
. Also setNGINX_SSL
to 1 to enable SSL. - Start the CTFd server
-# ./start -s
Clean up CTFd if you changed your mind and want to start over. Doesn't touch your config in CTFdeploy.
# ./start -c
This stops CTFd, Nginx, MariaDB, and redis Docker containers, resets altered files, removes CTFdeploy files, and clears the cache so CTFd can be started from fresh again.
Remember to commit your changes in CTFd if you want to preserve them. ./start -c will get rid of uncommitted changes.
CTFdeploy will alter the following files in CTFd: requirements.txt and docker-entrypoint.sh. This is to integrate CTFdeploy, read through the documentation and read the source code if you are in doubt about either integrity or safety.
The project is based upon the CTFd CTF-framework and is a modification-script of this software. The project is not using a forked version of CTFd but is a separate project related to CTFd and dependent on it.
The project plan is for school purposes.
OCD = One-Click Deployment