Skip to content

ItzyBitzySpider/dunhack.me

Repository files navigation

dunhack.me

CTF Platform built with Next.JS React Framework.

Installation & Setup

Installation

Clone with git clone --recurse-submodules

The platform is built with the following node.js and npm versions. For how to install node.js and npm, refer to this guide.

$ node -v
v16.13.0

$ npm -v
8.1.0

To get started, simply install dependencies with

$ npm install --legacy-peer-deps

Configuring environment variables

You will need to create a .env file in the project root. Refer to the env.example file for the environment variables required. The following is how you may obtain some of their values.

  1. Database URL
    If you are using planning to use the docker-compose provided, you may leave the value as is. However, if you plan on hosting the database instance separately, please modify the value as follows:
    postgresql://<USERNAME>:<PASSWORD>@<HOST>:<PORT>/<DATABASE_NAME>

  2. Email Server
    This field would contain the details required to send emails for user logins. The EMAIL_SERVER field uses the following format:
    smtp://<USERNAME>:<PASSWORD>@<SERVER NAME>:<PORT>
    Below are some guides on how to set up SMTP server for different email providers.

    1. Gmail
    2. Yahoo
    3. TurboSMTP
  3. OAuth Client ID and Secrets
    These fields contain the necessary details for the OAuth providers to authenticate users. See below on how to set up an OAuth application with the respective providers.

    1. GitHub
    2. Google
    3. Discord

    When setting up the OAuth applications, ensure to change the Callback URL for each provider. E.g. Discord Callback URL should be: https://<yourdomain>/api/auth/callback/discord

  4. Next Auth URL
    When deploying to production, set the NEXTAUTH_URL environment variable to the canonical URL of your site.

To make use of runner, you will have to edit the configuration in /runner/config. A README.md is provided there.

To run with Docker, do also remember to add your SSL Certs to the nginx config. More details can be found in docker-miisc/README.md.

Database setup

If you are using the docker-compose file, you may skip this step. The platform uses a Postgres database. One can initialise the database with the script found in docker-misc

Usage

There are several scripts available for development and deployment.

License

dunhack.me is MIT licensed