Skip to content

Resources and instructions on setting up a capture the flag server

Notifications You must be signed in to change notification settings

evanmarlo/CTFd-Tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

  1. Introduction
  2. Installation
  3. Hosting Locally
  4. Self Hosting
  5. Hosting Through CTFd
  6. Setup

Introduction

CTFd is an easy capture the flag framework. This tutorial will guide you through the steps of setting up a CTFd server. The CTFd code can be found here. Official online documentation can be found here.

Your first step will be deciding how to host your server. You have a few options when it comes to hosting:

  1. Because CTFd is open source, hosting locally is 100% free. This allows anyone on your network to access your CTF.

  2. You can also self host publicly, but you will want your own computer to use as a server, and will need to pay if you want a (good) domain name. This is also a fairly complicated option.

  3. The easist option to host publicly is through CTFd itself. You can get a ctfd.io URL. The only downside is this will cost $10 monthly.

If you want to host through CTFd, you can skip installation and head straight to Hosting Remotely Through CTFd.

If you choose options 1 and 2 and want to host the server yourself, continue to the installation section.

Installation

The first step is to clone this repository. If you are new to using SSH, you can access this tutorial for help setting up a key.

Clone this repository with the following command:

git clone https://github.com/evanmarlo/CTFd-Tutorial.git

Change directories into the submodule:

cd CTFd

Clone the CTFd submodule. It is not necessary to understand submodules to set this up, but if you are unfamiliar with submodules you can learn more here.

git submodule init
git submodule update

Then install dependencies (might take a minute, if you have python 3 and python 2 installed, you might need to use pip3):

pip install -r requirements.txt

Next, you will need to install Docker here.

If you do not already have Docker Compose installed, install it here.

Hosting Locally

Start Docker with the following command:

docker run -p 8000:8000 -it ctfd/ctfd

While docker is running, open up the following URL in a web browser: http://localhost:8000/setup

From there you can follow the Setup instructions to setup your CTF. When you are done you can close the container through the terminal by pressing control + c. You can also run and close your container through the docker desktop app. This is how you will save changes to your CTF. Alternatively, you can export entire CTFd instance data. See the screenshot below.

In order for to share your CTF with other devices on your network, you will need to know your IP address. If you are on Windows and don't know your machine's IP address already, run the following:

ipconfig

If you are on Mac or Linux, use the ifconfig command. Your IP address will be at "IPv4 Address". Here is a screenshot example:

Then, share the following link, replacing "ipaddress" with your own IP address: http://ipaddress:8000

For example, if my IP address were 123.45.678.9, I would share the link http://123.45.678.9:8000.

From here, if all you want to do is host locally, you can skip to the Setup section.

Self Hosting

First, you will want a (probably Linux) machine to act as your server and run your server.

Your first step to self hosting will be getting a domain name. You can usually get a domain name fairly cheap through a registrar. I can't recommend one specifically but some examples you can use are Wix, GoDaddy, Mailchimp, or AWS.

If you are really interested in setting up the domain name yourself, here is an article that details how you may do that.

Once you have your domain name setup, you can host it with docker. Here is a useful repo that comes with an article that details how to host with docker.

Hosting Remotely Through CTFd

Hosting through CTFd is easy and intuitive. If you would like an educational discount, you can request one through their contact form.

Once you have setup the educational discount, head to their pricing page and select a plan, and create a new instance.

Setup

Once you have your server setup, CTFd has a great tutorial on how to setup your challenges.

About

Resources and instructions on setting up a capture the flag server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published