Quick Start
GZCTF is distributed as a Docker image, you can deploy a fully functional CTF platform with docker-compose. Please note that this is not the only way to deploy GZCTF, we recommend using Kubernetes to deploy. Please refer to for related deployment methods.
The security and front-end functions (such as operating the clipboard) of GZCTF depend on HTTPS. The deployment method described in this section does not provide HTTPS support, so it is not suitable for production environments. For local testing only.
This document does not cover how to configure HTTPS. Please refer to the configuration and usage of software such as nginx and traefik. Please note that the websocket function of GZCTF may also need to be configured independently. If you encounter problems such as the inability to push competition notifications, please check whether the reverse proxy is configured correctly.
Installation and configuration
You will need to install Docker and docker-compose to get started with GZCTF. You can find the relevant installation instructions on the Docker official website.
-
To prepare for the following configuration, please prepare the following initialization parameters:
GZCTF_ADMIN_PASSWORD: Initial administrator password, effective when the database is not initialized, needs to be set at the first startup. It should be configured incompose.yml.POSTGRES_PASSWORD: Database password, needs to be configured incompose.ymlandappsettings.json.XOR_KEY: A random string used to encrypt the competition private key, needs to be configured inappsettings.json.PUBLIC_ENTRY: External access address, can be IP or domain name, needs to be configured inappsettings.json, used to provide the address of the problem container for players to access.
-
Save the following content as the
appsettings.jsonfile, and fill with your initialization parameters, please refer toappsettings.jsonconfiguration for detailed configuration instructions. -
Save the following content as the
compose.ymlfile, and replace with your initialization parameters. Available backend languages areen-US,zh-CN,zh-TW,ja-JP,id-ID,ko-KR,ru-RU,de-DE,fr-FR,es-ES,vi-VN.
You might encounter network segment conflicts, please refer to compose.yml subnet configuration or /etc/docker/daemon.json subnet configuration.
- Run
docker compose up -dto start GZCTF, then you can access GZCTF through the browser.
Initial administrator
Production environment does not have administrative users by default, you need to set the initial administrator password when starting for the first time by setting the GZCTF_ADMIN_PASSWORD environment variable, and log in through the Admin account.
You can also manually change the database entry to set a currently registered user as an administrator. After the administrator registration is completed and successfully logged in, enter the selected database table and execute:
You may need the following commands:
Use Garnet/Redis as cache
If you want to use Garnet/Redis as a cache to get a more seamless version switching and server restart experience, you can add the following content to the above configuration:
-
compose.ymlfile -
appsettings.jsonfile
Then restart GZCTF with docker compose up -d.
Container image
GZCTF has been pre-built and packaged as a unified Docker image, you can find the relevant image on Docker Hub.
Please use the following two container registries to get the image:
Please use the develop image tag for test and development versions.
Challenges configuration
Challenges configuration and examples can be found in the GZCTF-Challenges repository.
You can also refer to and learn from the public challenges repository of W4terCTF 2023. The challenges in this repository try to ensure that the Docker Image is small enough to be quickly deployed during the competition while keeping the challenges working properly.
It is recommended to use the GZCTF Challenge Base image as the base image for your challenge containers. We have minimized these base images as much as possible and update them regularly; using them can ensure that your challenge containers share image layers to the greatest extent possible, reducing storage space usage and image pull times.
GZCTF distributes dynamic flags by injecting the GZCTF_FLAG environment variable into the container, so please make sure that the text in this environment variable is placed in the appropriate location in the container initialization script of the challenge. Please note that this environment variable is initialized when the container is started, not when the container image is built.