Skip to main content

Tool for CI/CD pipelines to deploy CTFs

Project description

ctf-cicd

ctf-cicd is a tool designed to automate the deployment of CTF challenges in CTFd. It aims to address the limitations of ctfcli for continuous deployment making use of environment variables, eliminating the need for config files in the repository.

This tool leverages the features of ctfcli and is inspired by a blog post from Rohan Mukherjee.

Getting Started

Prerequisites

Ensure you have the following installed:

  • Python 3.x
  • pip

Running and configure this tool

ctf-cicd deploys all challenges (challenge.yml) that are detected in the current directory or any of its subfolders. To define challenges, they must respect the ctfcli specification.

Step 1: Installation

You can either clone the repository or install it directly using pip:

# Alternative 1: Cloning the repository
$ git clone https://github.com/MrSuicideParrot/ctf-cicd.git

# Alternative 2: Using pip
$ python -m pip install ctfcicd

# After having the source code you should install the project requirements
$ pip install .

Note: You can (and should) make use of virtual environments.

Step 2: Configuration

Set the following environment variables to configure ctf-cicd:

  • CTFD_TOKEN: CTFd Admin Access Token (ex. d41d8cd98f00b204e9800998ecf8427e)

  • CTFD_URL: CTFd instance URL (ex. https://demo.ctfd.io)

  • DEPLOY_HOST: URI of the method that you want to use to deploy your dockerized challenge (More info).

  • DEPLOY_NETWORK: (Optional) variable to specify to which network you want the container attached.

Example configuration:

export CTFD_TOKEN="your_ctfd_token"
export CTFD_URL="https://your_ctfd_instance"
export DEPLOY_HOST="ssh://your_deploy_host"
export DEPLOY_NETWORK="your_network"

Step 3: Running

# Alternative 1: Deploying all challenges
$ ctfcicd

# Alternative 2: Deploy a list of challenges
$ ctfcicd --chalenges chall1 chall2 chall3

Contributing

Contributions from the community are welcome! To contribute:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature-branch)
  3. Make your changes
  4. Commit your changes (git commit -am 'Add new feature')
  5. Push to the branch (git push origin feature-branch)
  6. Create a new Pull Request

Usage Examples

This project can be used to automate the deployment of challenges either locally or using github actions. An example of how to do so can be seen in here.

If you come up with other usages of this project, feel free to open a Pull Request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

This tool was inspired by a blog post from Rohan Mukherjee. Special thanks to the ctfcli community for their foundational work.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ctfcicd-1.2.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

ctfcicd-1.2.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file ctfcicd-1.2.0.tar.gz.

File metadata

  • Download URL: ctfcicd-1.2.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for ctfcicd-1.2.0.tar.gz
Algorithm Hash digest
SHA256 b63003fcd3a2b8268f0aed725bb4a8a9a4bd9709082734eee8f525a5c9fd3174
MD5 03ed243a2bd4996f09e02fab88bb811d
BLAKE2b-256 2023868e55b73781e6b923b89c082998764d966d52540b008249d250f99dbd29

See more details on using hashes here.

File details

Details for the file ctfcicd-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: ctfcicd-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for ctfcicd-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cf1836c9d87582522fecc4f64b19d4d0de60499289ca6b650f24388d3694bbb
MD5 71a9afee1c25591ef2f1137e2c2392a9
BLAKE2b-256 66b9bdcb8ff674b06db563f2a64faba62d331f3be9a89260d976b1d31a8347c2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page