Hosted Challenge Deployment

Container Servers

Managing challenges for CTFs can be an ordeal.

Our hosted challenge platform makes it easy to automatically deploy and manage challenges with technologies you're already familiar with.

ctf init
Please enter CTFd instance URL: https://demo.ctfd.io
Please enter CTFd Admin Access Token:
Initialized empty Git repository in /Users/user/event/.git/

Create an event

ctfcli turns the current folder into a CTF event git repo.

This will create the .ctf folder with the config file that will specify the URL, access token, and keep a record of all challenges dedicated for this event.

# app.py
from flask import Flask

app = Flask(__name__)

@app.route("/")
def flag():
    return "<p>flag{that_was_easy!}</p>"

# challenge.yml
name: "Webserver"
author: "unknown"
category: web
description: "Can you find the flag on the webserver?"
value: 500
image: .
flags:
  - "flag{that_was_easy!}"

# Dockerfile
FROM python:3
RUN pip install flask
COPY app.py .
EXPOSE 5000
CMD flask run --host=0.0.0.0

Build your challenge

Events are made of challenges.

ctfcli provides a challenge specification (challenge.yml).

In addition you can provide a Dockerfile that builds your challenge server.

Every challenge processed by ctfcli should have a challenge.yml file at its root.

Add the challenge to your event

Add a challenge from a local folder or pull one in from another repository - a reference is kept in your .ctf/config file.

ctf challenge add webserver
ctf challenge install webserver
Found webserver/challenge.yml
Loaded webserver
Installing webserver
Success!

Install to CTFd

Installing a challenge automatically creates it in your CTFd instance using the API.

ctf challenge deploy web/webserver
Deploying challenge service 'webserver' with CloudDeploymentHandler ...
The push refers to repository [registry.ctfd.io/demo/webserver]
Awaiting service deployment [0/180s]
Saving connection_info in challenge.yml
Challenge service deployed at: https://demo-webserver.chals.io
Creating challenge 'webserver'
Success!

Deploy

Once installed, you can run the ctf challenge deploy command to deploy your Dockerfile. ctfcli will build, push, and deploy the challenge server.

The challenge will go from building to built to deployed until finally your challenge will automatically be given a URL to access.

For challenges that need a TCP port one can be automatically assigned through the protocol field of challenge.yml.

Or a port can be assigned manually. Read about Requesting a TCP Port

Sync Changes

Whenever you make changes to challenge.yml, sync them to your instance the same way:

ctf challenge sync webserver
Found webserver/challenge.yml
Loaded webserver
Syncing webserver
Success!

Challenge deployment is as easy as docker push.

Check out our hosted plans 
v1 v2