Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit 85edaa3

Browse files
authored
Merge branch 'master' into refactor/auth-ts
2 parents 496a7cc + 101814c commit 85edaa3

File tree

17 files changed

+122
-59
lines changed

17 files changed

+122
-59
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ yarn-error.log*
99
/data
1010
/conf.d/*
1111
!/conf.d/.keep
12+
/docs/site
1213

1314
# Upload provider dir
1415
/uploads

.readthedocs.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://github.com/redpwn/rCTF/workflows/CI/badge.svg?branch=master)](https://github.com/redpwn/rCTF/actions?query=workflow%3ACI+branch%3Amaster)
44
[![Code Coverage](https://img.shields.io/codecov/c/github/redpwn/rctf.svg)](https://codecov.io/github/redpwn/rctf/)
5-
[![Docs](https://img.shields.io/readthedocs/rctf/latest)](https://rctf.redpwn.net/)
5+
[![Netlify Status](https://api.netlify.com/api/v1/badges/ae459ed6-1a84-43ff-b113-5561f3e4bd82/deploy-status)](https://rctf.redpwn.net)
66

77
rCTF is redpwnCTF's CTF platform. It is developed and maintained by the [redpwn](https://redpwn.net) CTF team.
88

docs/content/configuration.md

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,50 @@ meta:
3535

3636
## Configuration
3737

38+
### Core
39+
40+
Important values to configure to customize your CTF.
41+
3842
YAML/JSON name|environment name|required|default value|type|description
3943
-|-|-|-|-|-
44+
`ctfName`|`RCTF_NAME`|yes|_(none)_|string|name of the CTF throughout the UI
45+
`meta.description`|`RCTF_META_DESCRIPTION`|yes|`''`|string|OpenGraph and Twitter embed description
46+
`meta.imageUrl`|`RCTF_IMAGE_URL`|yes|`''`|string|OpenGraph and Twitter embed image URL
47+
`origin`|`RCTF_ORIGIN`|yes|_(none)_|string|public URL of the rCTF instance
48+
`homeContent`|`RCTF_HOME_CONTENT`|yes|`''`|string|markdown content for the homepage of the CTF. [documentation](management/home.md)
49+
`startTime`|`RCTF_START_TIME`|yes|_(none)_|integer|time at which the CTF starts, in milliseconds since the epoch
50+
`endTime`|`RCTF_END_TIME`|yes|_(none)_|integer|time at which the CTF ends, in milliseconds since the epoch
51+
`divisions`|_(none)_|yes|_(none)_|object|division IDs and their respective names. [documentation](management/divisions.md)
52+
`defaultDivision`|_(none)_|no|_(none)_|string|default division ID. [documentation](management/divisions.md)
53+
`divisionACLs`|_(none)_|no|_(none)_|array|ACLs for restricting division access. [documentation](management/divisions.md)
54+
55+
### Additional
56+
57+
Optional configuration to enable additional features.
58+
59+
YAML/JSON name|environment name|required|default value|type|description
60+
-|-|-|-|-|-
61+
`sponsors`|_(none)_|yes|`[]`|array|list of CTF sponsors. [documentation](management/home.md)
62+
`globalSiteTag`|`RCTF_GLOBAL_SITE_TAG`|no|_(none)_|string|Google Analytics site tag
63+
`logoUrl`|`RCTF_LOGO_URL`|no|_(none)_|string|URL to raster image of the CTF's logo. used in emails
64+
`email.provider`|_(none)_|no|_(none)_|provider|provider for email sending. [documentation](providers/emails/index.md)
65+
`email.from`|_(none)_|no|_(none)_|provider|`from:` address when sending email. [documentation](providers/emails/index.md)
66+
`ctftime.clientId`|`RCTF_CTFTIME_CLIENT_ID`|no|_(none)_|string|CTFtime OAuth client ID. [documentation](integrations/ctftime.md)
67+
`ctftime.clientSecret`|`RCTF_CTFTIME_CLIENT_SECRET`|no|_(none)_|string|CTFtime OAuth client secret. [documentation](integrations/ctftime.md)
68+
69+
### Advanced
70+
71+
Configuration for advanced users - sane defaults are automatically set by the installation script.
72+
73+
YAML/JSON name|environment name|required|default value|type|description
74+
-|-|-|-|-|-
75+
`tokenKey`|`RCTF_TOKEN_KEY`|yes|_(none)_|string|base64 encoded 32 byte key used for encrypting tokens
76+
`loginTimeout`|`RCTF_LOGIN_TIMEOUT`|yes|3600000|integer|lifetime of registration, email update, and recovery links, in milliseconds
77+
`userMembers`|`RCTF_USER_MEMBERS`|yes|`true`|boolean|whether to allow a user to provide emails for individual members
78+
`database.migrate`|`RCTF_DATABASE_MIGRATE`|yes|`never`|`before | only | never`|how to run postgreSQL migrations. [documentation](management/migration.md)
79+
`instanceType`|`RCTF_INSTANCE_TYPE`|yes|`all`|`all | frontend | leaderboard`|what type of instance to run. [documentation](management/scaling.md)
80+
`challengeProvider`|_(none)_|yes|`database`|provider|provider for challenges. [documentation](providers/challenges/index.md)
81+
`uploadProvider`|_(none)_|yes|`local`|provider|provider for challenge file uploads. [documentation](providers/uploads/index.md)
4082
`database.sql`|`RCTF_DATABASE_URL`|either `database.sql` or `database.sql.*`|_(none)_|string|`postgres://` connection URI
4183
`database.sql.host`|`RCTF_DATABASE_HOST`|either `database.sql` or `database.sql.*`|_(none)_|string|hostname of a postgreSQL server
4284
`database.sql.port`|`RCTF_DATABASE_PORT`|either `database.sql` or `database.sql.*`|_(none)_|string|port number that postgreSQL is running on
@@ -48,38 +90,12 @@ YAML/JSON name|environment name|required|default value|type|description
4890
`database.redis.post`|`RCTF_REDIS_PORT`|either `database.sql` or `database.sql.*`|_(none)_|string|port number that redis is running on
4991
`database.redis.password`|`RCTF_REDIS_PASSWORD`|either `database.sql` or `database.sql.*`|_(none)_|string|redis password to authenticate with
5092
`database.redis.database`|`RCTF_REDIS_DATABASE`|either `database.sql` or `database.sql.*`|_(none)_|string|redis numerical database ID to use
51-
`database.migrate`|`RCTF_DATABASE_MIGRATE`|yes|`never`|`before | only | never`|how to run postgreSQL migrations. [See migration doc for more](../management/migration)
52-
`instanceType`|`RCTF_INSTANCE_TYPE`|yes|`all`|`all | frontend | leaderboard`|what type of instance to run. [See scaling doc for more](../management/scaling)
53-
`tokenKey`|`RCTF_TOKEN_KEY`|yes|_(none)_|string|base64 encoded 32 byte key used for encrypting tokens
54-
`origin`|`RCTF_ORIGIN`|yes|_(none)_|string|public URL of the rCTF instance
55-
`ctftime.clientId`|`RCTF_CTFTIME_CLIENT_ID`|no|_(none)_|string|CTFtime OAuth client ID. [See CTFtime doc for more](../integrations/ctftime)
56-
`ctftime.clientSecret`|`RCTF_CTFTIME_CLIENT_SECRET`|no|_(none)_|string|CTFtime OAuth client secret. [See CTFtime doc for more](../integrations/ctftime)
57-
`userMembers`|`RCTF_USER_MEMBERS`|yes|`true`|boolean|whether to allow a user to set emails for individual members
58-
`sponsors`|_(none)_|yes|`[]`|array|list of CTF sponsors. [See home doc for more](../management/home)
59-
`homeContent`|`RCTF_HOME_CONTENT`|yes|`''`|string|markdown content for the homepage of the CTF. [See home doc for more](../management/home)
60-
`ctfName`|`RCTF_NAME`|yes|_(none)_|string|name of the CTF throughout the UI
61-
`meta.description`|`RCTF_META_DESCRIPTION`|yes|`''`|string|OpenGraph and Twitter embed description
62-
`meta.imageUrl`|`RCTF_IMAGE_URL`|yes|`''`|string|OpenGraph and Twitter embed image URL
63-
`logoUrl`|`RCTF_LOGO_URL`|no|_(none)_|string|URL to raster image of the CTF's logo. used in emails
64-
`globalSiteTag`|`RCTF_GLOBAL_SITE_TAG`|no|_(none)_|string|Google Analytics site tag
65-
`challengeProvider`|_(none)_|yes|`database`|provider|provider for challenges. [See challenge provider doc for more](../providers/challenges/index)
66-
`uploadProvider`|_(none)_|yes|`local`|provider|provider for challenge file uploads. [See upload provider doc for more](../providers/uploads/index)
67-
`email.provider`|_(none)_|no|_(none)_|provider|provider for email sending. [See email doc for more](../providers/emails/index)
68-
`email.from`|_(none)_|no|_(none)_|provider|`from:` address when sending email. [See email doc for more](../providers/emails/index)
69-
`divisions`|_(none)_|yes|_(none)_|object|division IDs and their respective names. [See division doc for more](../management/divisions)
70-
`defaultDivision`|_(none)_|no|_(none)_|string|default division ID. [See division doc for more](../management/divisions)
71-
`divisionACLs`|_(none)_|no|_(none)_|array|ACLs for restricting division access. [See division doc for more](../management/divisions)
72-
`startTime`|`RCTF_START_TIME`|yes|_(none)_|integer|time at which the CTF starts, in milliseconds since the epoch
73-
`endTime`|`RCTF_END_TIME`|yes|_(none)_|integer|time at which the CTF ends, in milliseconds since the epoch
7493
`leaderboard.maxLimit`|`RCTF_LEADERBOARD_MAX_LIMIT`|yes|100|integer|maximum number of users retrievable in a single leaderboard request
7594
`leaderboard.maxOffset`|`RCTF_LEADERBOARD_MAX_OFFSET`|yes|4294967296|integer|maximum offset from the beginning of the leaderboard
7695
`leaderboard.updateInterval`|`RCTF_LEADERBOARD_UPDATE_INTERVAL`|yes|10000|integer|interval at which the leaderboard is recalculated, in milliseconds
7796
`leaderboard.graphMaxTeams`|`RCTF_LEADERBOARD_GRAPH_MAX_TEAMS`|yes|10|integer|maximum number of users retrievable in a graph request
7897
`leaderboard.graphSampleTime`|`RCTF_LEADERBOARD_GRAPH_SAMPLE_TIME`|yes|1800000|integer|interval at which the score graph is sampled, in milliseconds
79-
`loginTimeout`|`RCTF_LOGIN_TIMEOUT`|yes|3600000|integer|lifetime of registration, email update, and recovery links, in milliseconds
8098

8199
## Custom `conf.d` location
82100

83-
The `conf.d` directory can be renamed or moved elsewhere.
84-
85-
To do so, set the `RCTF_CONF_PATH` environment variable to the location of a directory of YAML or JSON configuration files. If specified as a relative path, the path is evaluated from the current working directory.
101+
The `conf.d` directory can be renamed or moved elsewhere. To do so, set the `RCTF_CONF_PATH` environment variable to the location of a directory of YAML or JSON configuration files. If specified as a relative path, the path is evaluated from the current working directory.

docs/content/development/manual-installation.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,23 @@
22

33
Manual installation of rCTF is useful to develop and modify the project.
44

5-
If you want to install rCTF on your local machine, you will need `yarn` installed. rCTF currently targets node 12, so you should either install that version locally or use nvm, for example with `nvm use --delete-prefix v12.16.1`.
5+
To run rCTF locally, you'll need [node](https://nodejs.org/) and [yarn](https://yarnpkg.com/).
66

7-
```shell
8-
git clone https://github.com/redpwn/rCTF.git && cd rCTF
7+
Clone the rCTF repository:
8+
```bash
9+
git clone https://github.com/redpwn/rctf
910
```
1011

11-
After cloning, you will need to setup the configuration files.
12-
13-
```shell
14-
cp -nR config/yml.example config/yml
15-
cp .env.example .env
16-
```
17-
18-
Before you run rCTF for the first time, set the [mandatory configuration options](../configuration.md#configuration-options).
12+
After cloning, you will need to setup the configuration files in the `conf.d` directory. [An example `conf.d`](https://github.com/redpwn/rctf/blob/master/test/conf-test.yaml) is used for testing.
1913

2014
To develop rCTF, run:
2115

22-
```shell
16+
```bash
2317
yarn dev
2418
```
2519

2620
To simulate a full production build, run:
2721

28-
```shell
22+
```bash
2923
yarn build && yarn start
3024
```

docs/content/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
rCTF is redpwnCTF's CTF platform. It is developed and maintained by the
44
[redpwn](https://redpwn.net) CTF team.
5+
6+
To install rCTF, see [the installation doc](installation.md).

docs/content/installation.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ You can install rCTF in one command with [the installer script](https://get.rctf
55
```bash
66
curl https://get.rctf.redpwn.net | sh
77
```
8+
9+
## After installation
10+
11+
To configure rCTF, see [the configuration doc](configuration.md).
12+
13+
To update the CTF's challenges, see [the admin doc](management/admin.md).
14+
15+
To scale up rCTF, see the [migration](management/migration.md) and [scaling](management/scaling.md) docs.

docs/content/management/admin.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Challenge Admin
2+
3+
rCTF integrates with [rCDS](https://github.com/redpwn/rcds), which can automatically deploy challenges and sync them to rCTF.
4+
5+
To use rCTF without rCDS, create an admin user normally. Then, connect to postgreSQL and run:
6+
```sql
7+
UPDATE users SET perms=3 WHERE id='your user id';
8+
```
9+
10+
After running, you can manage the CTF's challenges using a web UI at:
11+
```
12+
https://your-rctf.example.com/admin/challs
13+
```

docs/content/management/divisions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Every user must be in exactly one division, although users can change their divi
88
* `divisionACLs` is a priority list of ACL elements. Only one element matches an email at a time, and each element contains `match`, `value`, and an allowed `divisions` list. If the `divisions` list contains multiple elements, the first element is used while registering.
99

1010
Possible `match` values are:
11+
1112
* `domain`: The `value` contains a domain which the user's email must be from.
1213
* `email`: The `value` contains an exact email which the user's must match.
1314
* `regex`: The `value` contains a RegEx used to match the user's domain.

docs/content/management/scaling.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Scaling
22

33
rCTF can be split into two types of instances.
4+
45
* Frontend instances are horizontally scalable and handle incoming requests
56
* A single leaderboard instance does leaderboard and graph data calculations.
67

0 commit comments

Comments
 (0)