Giter VIP home page Giter VIP logo

ctfdeploy's Introduction

CTFdeployment

This deployment script is used for FRESH deployments of CTFd using Docker. Used to cut the time of deployment on new instances of CTFd. Can be customized for specific config, admins, challenges, and pages, as to skip the setup step for a premade CTF. Also includes automatic setup of HTTPS with SSL Certificate.

Not meant to replace export/import from CTFd, rather used for FRESH deployments.

Make sure to read through the CTFd documentation and install their dependencies before using this script, as it is dependent on it.

Guide

Dependencies

Local setup:
  1. Docker, Install docker.
  2. Docker-compose, Install docker-compose.
  3. CTFd, pull CTFd in CTFdeploy as a submodule: git submodule update --init
  4. Python3, PyYAML, pycountry
    - python3 -m pip install -r requirements.txt
    • PyYAML: Used to check for syntax errors in setup.yml before deployment.
    • pycountry: Used to check the countrycode given to users when going through setup.yml syntax.
  5. Curl, install either via your package manager or from source.
Remote setup:
  • WIP

YAML

The setup is controlled by a single YAML file. The different sections control how the CTF is setup.

Make sure setup.yml is configured to your liking. It is located in OCD/setup.yml.

Start

  1. Configure setup.yml.
  2. Move used files into their folders.
    - For config - OCD/config_files.
    - For pages - OCD/pages_files.
    - For challenges - OCD/challenge_files.
  3. OPTIONAL: Configure Docker challenge containers.
    - Copy your docker-compose.yml into OCD/docker_challenges along with their Docker builds. - Set DOCKER_COMPOSE to 1 in start.sh and they will be started after CTFd setup.
  4. OPTIONAL: Configure SSL Certificate setup.
    - Copy your private key and certificate into OCD/ssl_cert.
    - Edit start.sh and define you hostname URL, certificate filename, and private key filename. Also set NGINX_SSL to 1 to enable SSL.
  5. Start the CTFd server
    - # ./start -s

Cleaning up

Clean up CTFd if you changed your mind and want to start over. Doesn't touch your config in CTFdeploy.

# ./start -c

This stops CTFd, Nginx, MariaDB, and redis Docker containers, resets altered files, removes CTFdeploy files, and clears the cache so CTFd can be started from fresh again.

Remember to commit your changes in CTFd if you want to preserve them. ./start -c will get rid of uncommitted changes.

How does it work?

Notice

CTFdeploy will alter the following files in CTFd: requirements.txt and docker-entrypoint.sh. This is to integrate CTFdeploy, read through the documentation and read the source code if you are in doubt about either integrity or safety.

References

The project is based upon the CTFd CTF-framework and is a modification-script of this software. The project is not using a forked version of CTFd but is a separate project related to CTFd and dependent on it.

The project plan is for school purposes.

OCD = One-Click Deployment

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.