Skip to content

Commit ec9a898

Browse files
authored
Updated docs (#88)
* updated readme * added build page * added missing link for making discord webhooks * detailed instructions for rev proxy * env example file renaming * updated build instruction for excalidraw * moved all the rest of the docs into `root/docs`
1 parent f11ff1d commit ec9a898

File tree

8 files changed

+215
-136
lines changed

8 files changed

+215
-136
lines changed

README.md

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,51 +23,36 @@ _Note_: If you're looking for a platform for hosting CTFs use [CTFd](https://git
2323

2424
A non-exhaustive list of features:
2525

26-
- Full Django + Python 3.10 code
27-
- Clean (Bootstrap 5+) interface
26+
- Django 4 running on Python 3.10, with a clean Bootstrap 5 interface
2827
- Key-in-hands setup via [`docker-compose`](https://docs.docker.com/compose)
2928
- Fully integrated around [HedgeDoc](https://github.com/hedgedoc/hedgedoc): smart markdown note mechanism, with [tons of features](https://demo.hedgedoc.org/features)
30-
- Possibility to create and play private CTFs
31-
- Create "guests" to your CTFs
29+
- Possibility to create and play private CTFs for one player only, making it easy to track your progress on learning platforms like [Root-Me](https://www.root-me.org/), [PicoCTF](https://picoctf.com/), [PentesterLab](https://pentesterlab.com/) and others.
30+
- Add "guests" to specific CTFs, allowing non team members to have a limited view of the context
3231
- View CTF stats, and track members' involment through a cool podium ranking
33-
- [Jitsi](https://meet.jit.si) integration: instantly jump on video chat with your team mate
34-
- CTFTime integration: import CTF (+ data) from CTFTime in 2 clicks
32+
- CTFTime API integration: CTF information from CTFTime in one click
3533
- CTFd/rCTF challenge(s) can optionally be pre-populated locally
3634
- Basic search engine
37-
- One step "challenge-notes" → "blog post" export feature
35+
- Easily export your challenge notes to create a blog post on Github Pages
36+
- [Jitsi](https://meet.jit.si) integration: instantly jump on video chat with your team mate
3837
- Public & Self-hosted [Excalidraw](https://github.com/excalidraw/excalidraw) integration: draw & share ideas with your team mates
39-
- Discord notifications
40-
- ...and more to come...
41-
- and of course, a Dark mode
38+
- [Discord](https://discord.gg) notifications on events (CTF registration, challenge scoring, etc.)
39+
- and of course, a Dark mode to save your eyes during those painful sleepless nights
4240

4341

4442
## Build
4543

46-
4744
For most people, this will suffice:
4845

4946
```bash
50-
$ git clone https://github.com/hugsy/ctfhub
51-
$ cd ctfhub
47+
$ git clone https://github.com/hugsy/ctfhub && cd ctfhub
5248
$ cp .env.example .env
5349
### CHANGE THE CREDENTIALS IN .env ###
5450
$ nano .env
5551
### BUILD EXCALIDRAW USING .env VARIABLES ###
56-
$ make build
5752
$ docker compose up -d --build
5853
```
5954

60-
If you want to use SSL locally, follow the [instructions to generate local SSL certificates](./conf/certs/README.md)
61-
and run:
62-
63-
```bash
64-
$ cp scripts/proxy/.env.nginx-proxy.example scripts/proxy/.env
65-
$ nano scripts/proxy/.env
66-
### Edit the file to your need
67-
$ docker compose -f scripts/proxy/docker-compose.yml -f ./docker-compose.yml up -d --build
68-
```
69-
70-
If you're migrating from the first versions called `ctpad`, check out see [PR #83](https://github.com/hugsy/ctfhub/pull/83) to migrate the data to the new environment, search the `Setup > Migration` part.
55+
For more advanced building cases, refer to the [Build page](docs/build.md) in the documentation.
7156

7257

7358
## Gallery

docs/build.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Build an instance
2+
3+
## Basic setup
4+
5+
```bash
6+
$ git clone https://github.com/hugsy/ctfhub
7+
$ cd ctfhub
8+
$ cp .env.example .env
9+
### CHANGE THE CREDENTIALS IN .env ###
10+
$ nano .env
11+
### BUILD EXCALIDRAW USING .env VARIABLES ###
12+
$ docker compose up -d --build
13+
```
14+
15+
## SSL + nginx reverse-proxy on Docker
16+
17+
A standard secure way to deploy an instance of CTFHub is to use it over an SSL layer, and behind a reverse proxy.
18+
Using [Let's Encrypt](https://letsencrypt.org/) you can easily generate a valid SSL certificate, which can be used with an nginx container acting as a reverse-proxy. A boilerplate template was provided to you in `scripts/nginx`, which you can use in combination of the [instructions to generate local SSL certificates](./ssl-setup.md). Then run `docker compose` with multiple files as such:
19+
20+
```bash
21+
$ cp scripts/proxy/.env.nginx-proxy.example scripts/proxy/.env
22+
$ nano scripts/proxy/.env
23+
### Edit the file to your need
24+
$ docker compose -f ./docker-compose.yml -f scripts/proxy/docker-compose.yml up -d --build
25+
```
26+
27+
Note that the example env file have default variables that may not suit your environment. Adjust them to your needs.
28+
29+
## Deploy your instance for Excalidraw
30+
31+
In `scripts/excalidraw` :
32+
33+
```bash
34+
$ cd scripts/excalidraw
35+
$ cp .env.example .env
36+
$ nano .env
37+
### edit .env to match your configuration
38+
$ cd ../..
39+
$ nano .env
40+
### update the CTFHUB_EXCALIDRAW_URL setting to point to your local excalidraw
41+
$ docker compose -f ./docker-compose.yml -f scripts/excalidraw/docker-compose.yml up -d --build
42+
```
43+
44+
Note that the example env file have default variables that may not suit your environment. Adjust them to your needs.
45+
46+
## Receive Discord notifications
47+
48+
Create a [HTTP Webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) on your Discord and paste that link to the setting `CTFHUB_DISCORD_WEBHOOK_URL` in your `.env` file.
49+
50+
## Receive Email notifications
51+
52+
Edit your `.env` and populate the following fields:
53+
54+
```conf
55+
CTFHUB_EMAIL_SERVER_HOST='' # smtp.gmail.com or mailgun, or sendgrid etc.
56+
CTFHUB_EMAIL_SERVER_PORT=0
57+
CTFHUB_EMAIL_USERNAME=''
58+
CTFHUB_EMAIL_PASSWORD=''
59+
```
60+
61+
With the appropriate values
62+
63+
64+
## Migration
65+
66+
If you're migrating from the first versions called `ctpad`, check out see [PR #83](https://github.com/hugsy/ctfhub/pull/83) to migrate the data to the new environment, search the `Setup > Migration` part.
67+

docs/gallery.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
# Gallery
2-
3-
## Dashboard
4-
5-
![dashboard](https://i.imgur.com/vWvgjQ1.png)
6-
7-
## View CTF
8-
9-
![ctf](https://i.imgur.com/kEJo9Jj.png)
10-
![ctf2](https://i.imgur.com/fe3vvfC.png)
11-
12-
## Import CTFs from CTFtime
13-
14-
![ctftime](https://i.imgur.com/TnOupMe.png)
15-
16-
17-
## Challenge
18-
19-
![challenge1](https://i.imgur.com/YRvXs3u.png)
20-
21-
22-
## Statistics
23-
24-
![stats](https://i.imgur.com/PGsPztU.png)
1+
# Gallery
2+
3+
## Dashboard
4+
5+
![dashboard](https://i.imgur.com/vWvgjQ1.png)
6+
7+
## View CTF
8+
9+
![ctf](https://i.imgur.com/kEJo9Jj.png)
10+
![ctf2](https://i.imgur.com/fe3vvfC.png)
11+
12+
## Import CTFs from CTFtime
13+
14+
![ctftime](https://i.imgur.com/TnOupMe.png)
15+
16+
17+
## Challenge
18+
19+
![challenge1](https://i.imgur.com/YRvXs3u.png)
20+
21+
22+
## Statistics
23+
24+
![stats](https://i.imgur.com/PGsPztU.png)
25+
Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
Place your TLS certificate + private key(s) for your domain here like
2-
3-
```
4-
./<domain>/fullchain.pem
5-
./<domain>/privkey.pem
6-
```
7-
8-
Then edit `../nginx/nginx.conf` to update the path to the chain/key.
1+
# Using SSL Certificates for a reverse-proxy
92

10-
Note:
11-
-----
3+
## Development usage
124

135
For local development, you can use [mkcert](https://github.com/FiloSottile/mkcert) to generate the certificates.
146

157
Example with default settings working with the provided `nginx.conf`:
168

179

18-
```
10+
```bash
1911
# If this is the first time you are using mkcert, create a local CA:
2012
mkcert -install
2113

@@ -29,3 +21,32 @@ mv ctfhub.mydomain.com*.pem ./conf/certs/ctfdad.mydomain.com/fullchain.pem
2921
```
3022

3123
If `ctfhub.mydomain.com` is in the `/etc/hosts` file of your machine, then go to `https://ctfhub.mydomain.com` and enjoy the app!
24+
25+
26+
## Production usage
27+
28+
### Using Let's Encrypt
29+
30+
Generate your LetsEncrypt keys and certificates
31+
32+
```bash
33+
sudo apt-get update && sudo apt-get install certbot # if not already installed
34+
sudo certbot certonly --manual --preferred-challenges=dns
35+
```
36+
37+
Follow the prompt. Certificates will be generated in `/etc/letsencrypt/live/<domain>` in the containers, which can be found in `./certs` on your host.
38+
39+
Use that path to update the nginx configuration file (in `../nginx/nginx.conf`) and run `docker compose up` including the docker-compose file from this folder.
40+
41+
### Using your own certificates
42+
43+
Place your TLS certificate + private key(s) for your domain here like
44+
45+
```
46+
./<domain>/fullchain.pem
47+
./<domain>/privkey.pem
48+
```
49+
50+
Then edit `../nginx/nginx.conf` to update the path to the chain/key.
51+
52+

scripts/excalidraw/.env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Redis (required for Excalidraw)
3+
#
4+
REDIS_PASSWORD=123234345123123 # Change here
5+
REACT_APP_BACKEND_V2_GET_URL=http://localhost:3001/api/v2/scenes/ # to Excalidraw
6+
REACT_APP_BACKEND_V2_POST_URL=http://localhost:3003/api/v2/scenes/ # to Excalidraw-Storage-Backend
7+
REACT_APP_LIBRARY_URL=https://libraries.excalidraw.com
8+
REACT_APP_LIBRARY_BACKEND=https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries/
9+
REACT_APP_STORAGE_BACKEND=http
10+
REACT_APP_HTTP_STORAGE_BACKEND_URL=http://localhost:3003/api/v2 # to Excalidraw-Storage-Backend
11+
REACT_APP_WS_SERVER_URL=http://localhost:3002 # to Excalidraw-Room
12+
REACT_APP_PORTAL_URL='' # THIS NEED TO BE LEFT BLANK
13+
EXCALIDRAW_NODE_ENV=production
Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
#
2+
# Override settings here.
3+
#
4+
5+
#
16
# CTFHub
7+
#
28
CTFHUB_DEBUG=0 # Change here
39
CTFHUB_HOSTNAME=ctfhub.mydomain.com # Change here to your server public IP / FQDN
410
CTFHUB_PORT=443 # Change here to your server public port for CTFHub
@@ -20,20 +26,7 @@ POSTGRES_DB=ctfhub # (opt.) Change here
2026
POSTGRES_USER=ctfhub # (opt.) Change here
2127
POSTGRES_PASSWORD=tookahlaiphee2KieTeeg5ooxutang4o # Change here
2228

23-
# Excalidraw stack
24-
REACT_APP_BACKEND_V2_GET_URL=https://excalidraw.mydomain.com/api/v2/scenes/
25-
REACT_APP_BACKEND_V2_POST_URL=https://excalidraw.mydomain.com/api/v2/scenes/
26-
REACT_APP_LIBRARY_URL=https://libraries.excalidraw.com
27-
REACT_APP_LIBRARY_BACKEND=https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries/
28-
REACT_APP_STORAGE_BACKEND=http
29-
REACT_APP_HTTP_STORAGE_BACKEND_URL=https://excalidraw.mydomain.com/api/v2
30-
REACT_APP_WS_SERVER_URL=https://collab.excalidraw.mydomain.com
31-
REACT_APP_PORTAL_URL= # THIS NEED TO BE LEFT BLANK
32-
33-
# Redis
34-
REDIS_PASSWORD=redis123 # Change here
35-
36-
# hedgedoc
29+
# Hedgedoc
3730
CMD_DOMAIN=hedgedoc.mydomain.com
3831
CMD_URL_ADDPORT=false
3932
CMD_PORT=

0 commit comments

Comments
 (0)