Submission server/infrastructure for the SRS challenge at FIC https://fic.srs.epita.fr/
Go to file
nemunaire 8aba067d05 settings: Convert JSON strings to the given type 2022-10-29 17:21:50 +02:00
admin sync: Report custom errors 2022-10-29 17:21:50 +02:00
backend backend: Check file error 2022-06-08 17:13:41 +02:00
configs frontend: Fix chbase.sh using new version of svelte 2022-06-10 18:56:00 +02:00
dashboard Remove all favicon 2022-06-12 14:48:55 +02:00
evdist evdist: Fix some segv 2022-06-08 12:31:08 +02:00
fickit-pkg fickit: Add kexec 2022-06-04 14:59:32 +02:00
frontend ui: Home button redirect to main_link 2022-06-12 13:18:18 +02:00
libfic fic: Use user order to sort exercices in interface 2022-10-29 17:21:50 +02:00
password_paper password_paper: Update 2022-05-31 16:42:17 +02:00
qa Remove all favicon 2022-06-12 14:48:55 +02:00
remote remote-challenge-sync-airbus: WIP 2022-06-08 02:57:29 +02:00
repochecker sync: Report custom errors 2022-10-29 17:21:50 +02:00
settings settings: Convert JSON strings to the given type 2022-10-29 17:21:50 +02:00
udev udev: ready to FIC2019 2019-01-22 08:49:44 +01:00
.dockerignore Add .dockerignore 2022-06-12 13:18:18 +02:00
.drone-manifest-fic-admin.yml CI: create Docker manifest image 2021-02-23 09:11:47 +01:00
.drone-manifest-fic-backend.yml CD: Fix deployment of fic-backend image 2021-07-21 11:23:06 +02:00
.drone-manifest-fic-dashboard.yml CI: create Docker manifest image 2021-02-23 09:11:47 +01:00
.drone-manifest-fic-evdist.yml evdist: New project to handle settings programming 2022-06-08 02:57:29 +02:00
.drone-manifest-fic-frontend.yml CI: create Docker manifest image 2021-02-23 09:11:47 +01:00
.drone-manifest-fic-nginx.yml Introduce fic-nginx 2021-07-21 03:03:25 +02:00
.drone-manifest-fic-qa.yml CI: create Docker manifest image 2021-02-23 09:11:47 +01:00
.drone-manifest-fic-repochecker.yml CI: add Dockerfile for repochecker (used for student's CI) 2021-05-14 00:44:55 +02:00
.drone.yml sync: Report custom errors 2022-10-29 17:21:50 +02:00
.gitignore Add .dockerignore 2022-06-12 13:18:18 +02:00
Dockerfile-admin sync: Report custom errors 2022-10-29 17:21:50 +02:00
Dockerfile-backend chore(deps): update dependency alpine to v3.16 2022-05-31 22:23:19 +02:00
Dockerfile-dashboard dashboard: Fix dockerfile 2022-06-08 11:23:55 +02:00
Dockerfile-evdist evdist: New project to handle settings programming 2022-06-08 02:57:29 +02:00
Dockerfile-frontend chore(deps): update dependency alpine to v3.16 2022-05-31 22:23:19 +02:00
Dockerfile-frontend-ui dockerfile: Update to node 16 + alpine 3.15 2022-06-12 12:06:02 +02:00
Dockerfile-nginx dockerfile: Update to node 16 + alpine 3.15 2022-06-12 12:06:02 +02:00
Dockerfile-qa Remove all favicon 2022-06-12 14:48:55 +02:00
Dockerfile-remote-challenge-sync-airbus Introduce remote-challenge-sync-airbus 2022-06-06 12:56:07 +02:00
Dockerfile-remote-scores-sync-zqds chore(deps): update dependency alpine to v3.16 2022-05-31 22:23:19 +02:00
Dockerfile-repochecker sync: Report custom errors 2022-10-29 17:21:50 +02:00
LICENSE Add LICENSE: chose MIT 2018-05-11 15:03:11 +02:00
README.md Update README.md 2021-09-09 15:00:23 +02:00
default.nix Add Nix flakes 2022-05-31 00:09:27 +02:00
docker-compose.yml configs: Update scripts and config for new ui 2021-08-30 19:43:35 +02:00
entrypoint-frontend.sh frontend: Fix chbase.sh using new version of svelte 2022-06-10 18:56:00 +02:00
fickit-backend.yml Remove from frontend the settings distribution role 2022-06-08 02:57:29 +02:00
fickit-boot.yml fickit: Update boot image 2022-06-04 14:59:32 +02:00
fickit-frontend.yml Remove from frontend the settings distribution role 2022-06-08 02:57:29 +02:00
fickit-prepare.yml fickit: Use DHCP during preparation and update 2022-06-04 14:59:32 +02:00
fickit-update.yml fickit: Use DHCP during preparation and update 2022-06-04 14:59:32 +02:00
flake.lock Add Nix flakes 2022-05-31 00:09:27 +02:00
flake.nix build: reduce nix cache miss. 2022-08-27 00:43:15 +02:00
go.mod deps: Update vendorSha256 with script. 2022-08-24 00:51:49 +02:00
go.sum deps: Update vendorSha256 with script. 2022-08-24 00:51:49 +02:00
htdocs-admin admin: Embed static assets into binary 2021-06-09 23:26:40 +02:00
htdocs-dashboard dashboard: came back online 2018-12-08 20:35:36 +01:00
htdocs-qa qa: New service to handle QA testing by students 2020-09-08 12:50:41 +02:00
qa-fill-todo.sh QA: Add new script to migrate QA content from a DB to another 2021-02-05 16:56:27 +01:00
qa-fill-view.sh QA: Add new script to migrate QA content from a DB to another 2021-02-05 16:56:27 +01:00
qa-merge-db.sh QA: Add new script to migrate QA content from a DB to another 2021-02-05 16:56:27 +01:00
renovate.json renovate: Automerge some go packages 2022-02-08 07:00:27 +01:00
shell.nix Add Nix flakes 2022-05-31 00:09:27 +02:00
update-deps.sh deps: Update vendorSha256 with script. 2022-08-24 00:51:49 +02:00

README.md

FIC Forensic CTF Platform

This is a CTF server for distributing and validating challenges. It is design to be robust, so it uses some uncommon technics like client certificate for authentication, lots of state of the art cryptographic methods and aims to be deployed in a DMZ network architecture.

This is a monorepo, containing several micro-services :

  • admin is the web interface and API used to control the challenge and doing synchronization.
  • backend is an inotify reacting service that handles submissions checking and team's files generation.
  • dashboard is a public interface to explain and follow the conquest, aims to animate the challenge for visitors.
  • frontend is only responsible for receiving submissions. It is the only dynamic part accessibe to players, so it's codebase is reduce to the minimum. It does not parse or try to understand players submissions, it just write it down to a file in the file system. Parsing and treatment is made by the backend.
  • qa is an interface dedicated to challenge development, it stores reports to be treated by challenges creators.
  • remote/scores-sync-zqds is an inotify reacting service that allows us to synchronize scores with the ZQDS scoring platform.
  • repochecker is a side project to check offline for synchronization issues.

In the production setup, each micro-service runs in a dedicated container, isolated from each other. Moreover, two physical machines should be used:

  • deimos communicates with players: displaying the web interface, authenticate teams and players, storing contest files and handling submissions retrieval without understanding them. It can't access phobos so its job stop after writing requests on the filesystem.
  • phobos is hidden from players, isolated from the network. It can only access deimos via a restricted ssh connection, to retrieve requests from deimos filesystem and pushing to it newly generated static files.

So, the general filesystem is organized this way:

  • DASHBOARD contains files structuring the content of the dashboard screen(s).
  • FILES stores the contest file to be downloaded by players. To be accessible without authentication and to avoid bruteforce, each file is placed into a directory with a hashed name (the original file name is preserved). It's rsynced as is to deimos.
  • PKI takes care of the PKI used for the client certiciate authorization process, and more generaly, all authentication related files (htpasswd, dexidp config, ...). Only the shared subdirectory is shared with deimos, private key and teams P12 don't go out.
  • SETTINGS stores the challenge config as wanted by admins. It's not always the config in use: it uses can be delayed waiting for a trigger.
  • SETTINGSDIST is the challenge configuration in use. It is the one shared with players.
  • startingblock keep the started state of the challenge. This helps nginx to know when it can start distributing exercices related files.
  • TEAMS stores the static files generated by the backend, there is one subdirectory by team (id of the team), plus some files at the root, which are common to all teams. There is also symlink pointing to team directory, each symlink represent an authentication association (certificate ID, OpenID username, htpasswd user, ...).
  • submissions is the directory where the frontend writes requests. It creates subdirectories at the name of the authentication association, as seen in TEAMS, backend then resolve the association regarding TEAMS directory. There is also a special directory to handle team registration.

Local developer setup

Using Docker

Use docker-compose build, then docker-compose up to launch the infrastructure.

After booting, you'll be able to reach the main interface at: http://localhost:8042/ and the admin one at: http://localhost:8081/.

Import folder

Local import folder

The following changes is only required if your are trying to change the local import folder ~/fic location.

Make the following changes inside this file docker-compose.yml:

23    volumes:
24 -     - ~/fic:/mnt/fic:ro
24 +     - <custom-path-to-import-folder>/fic:/mnt/fic:ro
Owncloud import folder

If your are trying to use the folder available with the Owncloud service, make the following changes inside this file docker-compose.yml:

29 -    command: --baseurl /admin/ -localimport /mnt/fic -localimportsymlink
29 +    command: --baseurl /admin/ -clouddav=https://owncloud.srs.epita.fr/remote.php/webdav/FIC%202019/ -clouduser <login_x> -cloudpass '<passwd>'

Manual builds

Running this project requires a web server (configuration is given for nginx), a database (currently supporting only MySQL/MariaDB), a Go compiler for the revision 1.16 at least and a inotify-aware system.

  1. First, you'll need to retrieve the dependencies:

     go mod vendor
    
  2. Then, build the three Go projects:

     go build -o fic-admin ./admin
     go build -o fic-backend ./backend
     go build -o fic-dashboard ./dashboard
     go build -o fic-frontend ./frontend
     go build -o fic-qa ./qa
     go build -o fic-repochecker ./repochecker
     ...
    
  3. Before launching anything, you need to create a database:

     mysql -u root -p <<EOF
     CREATE DATABASE fic;
     CREATE USER fic@localhost IDENTIFIED BY 'fic';
     GRANT ALL ON fic.* TO fic@localhost;
     EOF
    

    By default, expected credentials for development purpose is fic, for both username, password and database name. If you want to use other credentials, define the corresponding environment variable: MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD and MYSQL_DATABASE. Those variables are the one used by the mysql docker image, so just link them together if you use containers.

  4. Launch it!

     ./fic-admin &
    

    After initializing the database, the server will listen on http://localhost:8081/: this is the administration part.

     ./fic-backend &
    

    This daemon generates static and team related files and then waits for new submissions (expected in submissions directory). It only watchs modifications on the file system, it has no web interface.

     ./fic-frontend &
    

    This one exposes an API that gives time synchronization to clients and handle submission reception (but without treating them).

     ./fic-dashboard &
    

    This last server runs the public dashboard. It serves all file, without the need of a webserver. It listens on port 8082 by default.

For the moment, a web server is mandatory to serve static files, look at the samples given in the configs/nginx directory. You need to pick one base configation flavor in the configs/nginx/base directory, and associated with an authentication mechanism in configs/nginx/auth (named the file fic-auth.conf in /etc/nginx), and also pick the corresponding configs/nginx/get-team file, you named fic-get-team.conf.