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.
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 in compose.yml
.POSTGRES_PASSWORD
: Database password, needs to be configured in compose.yml
and appsettings.json
.XOR_KEY
: A random string used to encrypt the competition private key, needs to be configured in appsettings.json
.PUBLIC_ENTRY
: External access address, can be IP or domain name, needs to be configured in appsettings.json
, used to provide the address of the problem container for players to access.Save the following content as the appsettings.json
file, and fill with your initialization parameters, please refer to appsettings.json
configuration for detailed configuration instructions.
Save the following content as the compose.yml
file, and replace with your initialization parameters.
You might encounter network segment conflicts, please refer to compose.yml
subnet configuration or /etc/docker/daemon.json
subnet configuration.
docker compose up -d
to start GZCTF, then you can access GZCTF through the browser.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:
If you want to use 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.yml
file
appsettings.json
file
Then restart GZCTF with docker compose up -d
.
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 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.
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.