banner
lca

lca

真正的不自由,是在自己的心中设下牢笼。

CTFd Platform Setup Record

image

Introduction to CTFd#

CTFd is a free and open-source CTF (Capture the Flag) platform that provides a powerful set of tools and solutions for creating, organizing, managing, and hosting CTF competitions and challenging activities. CTFd is designed to meet the needs of users with various skill levels and backgrounds, offering an easy-to-use and configurable interface.

CTFd supports various types of challenges, including Web, reverse engineering, cryptography, binaries, forensics, and miscellaneous, and provides multiple competition types, including individual competitions, team competitions, and directed competitions.

CTFd also offers a range of powerful plugins and themes that can be configured and extended as needed.

CTFd Installation#

  • Set up using this article, simple and easy to understand

https://mp.weixin.qq.com/s/oMI9h_hBc373poVsR2CiVw

The project address based on the above article:

GitHub - Un1kTeam/CTFd: CTFs as you need them

This project version is 3.3.0, which can be localized, and also includes frp, ctfd-whale @ 138b042, ctf-whale can be downloaded and installed separately.

The general process is as follows:

  1. Create a single server cluster, then join the cluster
  1. View nodes and get the id value
  1. Update the label information on the docker node
  1. Once the setup is complete, you can start building the image
  1. After finishing, open the browser and visit http://127.0.0.1:9124

Notes:

  • Sometimes due to network issues, you may need to run docker-compose up -d multiple times.
  • When pulling the environment with docker, there may be issues with the internal ubuntu container not being able to access the aliyun source, so you need to set the DNS resolution in ubuntu as follows:

Simplified Installation#

Directly using someone else's virtual machine setup can be a bit troublesome to set up yourself, here I will record some issues and experiences during the usage process.

  • There is also an automatic setup script for CTFd that uses the nip.io domain.

Project address: GitHub - pwnthebox/ctfd-auto-deploy

The values that need to be manually entered are as follows:

Http Domain Suffix: domain/ip
External Http Port: target machine http mapping port (cannot be 80 here, as 80 is assigned to CTFd)
Direct Minimum/Maximum Port: target machine port open range

image

CTFd Environment Testing#

Open the browser and enter http://127.0.0.1:9124 to access, returning the following interface:

image

After setting everything step by step, if the banner size is too large there may be some issues with the style, once the setup is complete, it can be used.

Dynamic Target Configuration#

After logging in, enter the management interface and click on the Whale plugin

image

If there is no domain, the Http Domain Suffix can be left blank.

image

Fill in the Direct IP Address with the IP address of the virtual machine.

image

Create Questions#

Select dynamic_docker

image

Write the question title, category, description, etc. For the docker image, fill in the address of the docker image, change the Frp Redirect Type to Direct, and set the Frp Redirect Port to the internal port of the docker container, which is usually specified in the dockerfile.

image

Set the score for the question, Initial Value is the initial score, Decay Limit is the number of decay times, after a question is answered twice, it starts using the score set in Minimum Value, and Score Type is set to Dynamic Score. If the Decay Limit is set to 0 and no minimum score setting is made, then Score Type can only be changed to Static Score.

image

After creating the question, test it.

image

image

Visit the question environment

image

Test submitting the flag.

image

image

Thus, the environment setup is complete.

Other Settings and Notes#

Dynamic Flag Generation in Dockerfile#

CTFd Page Management Settings#

  • Modify the homepage

image

Mapping CTFd Platform to the External Network#

After the CTFd platform is installed, settings can be done at any time, not necessarily before setting up the CTFd platform. The following places need to be set:

  1. Map the platform port (9124) on the router at the internet exit.
  2. Map the environment port (28000-28200) on the router at the internet exit.
  3. Configure whale (as shown in the figure)

image.png

In the Frps config template [generated], set subdomain_host to the public IP or domain.

image.png

The above settings will suffice.

Read-only File System Solution (Untested)#

Modify the docker-compose.yml file, remove the :ro on line 22.

Some Target Environments Cannot Access the Internet (Untested)#

You need to modify the docker-compose.yml file, as shown in the figure below:

image

The container has started, and modifying this part will cause an error.

CTFd Localization#

Import the files into the CTFd directory.

Project address: GitHub - Gu-f/CTFd_chinese_CN: Localization records for various versions of the CTFd platform. key: Chinese, localization, translation, Chinese, CN, CTFd

The localized version has been pushed to the hub docker.

References#

ctfd-whale/install.zh-cn.md at master · frankli0324/ctfd-whale · GitHub

How to Properly Use Docker to Create a CTF Question - Von's Blog | Von Blog

GitHub - antlers12/CTFd_sqlilabs

CTFd&ctfd-whale Dynamic Target Machine Setup and Maintenance · Yuque

GitHub - CTFTraining/CTFTraining: CTF Training Classic Problem Reproduction Environment

BUUCTF Question Contribution Guide – glzjin

https://www.lewiserii.top/%E7%AB%9E%E8%B5%9B/ctf%E5%B9%B3%E5%8F%B0%E6%90%AD%E5%BB%BA%E5%92%8C%E5%87%BA%E9%A2%98%E6%8C%87%E5%8D%97.html

https://www.r00team.cc/wiki/ctf_deploy.html#web%E7%B1%BB

GitHub - frankli0324/ctfd-whale: A plugin for CTFd which allows your users to deploy standalone instances for challenges.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.