Giter Site home page Giter Site logo

liikt / eno-landing-page Goto Github PK

View Code? Open in Web Editor NEW

This project forked from enowars/eno-landing-page

0.0 1.0 0.0 2.79 MB

ENOWARS Landing Page

License: MIT License

Python 39.83% HTML 33.94% TSQL 9.36% Dockerfile 0.37% Shell 2.86% CSS 9.42% JavaScript 4.23%

eno-landing-page's Introduction

EnoTeams

CTF team registration page based on Flask, Gunicorn and Nginx.

Recommended Code Style: https://www.python.org/dev/peps/pep-0008/

Development

cp app/postgres.cfg.example app/postgres.cfg
cp app/flask.cfg.example app/flask.cfg
mkdir postgres_data
docker-compose up -d nginx gunicorn postgres

Add 127.0.0.1 enowars.local to your hosts.txt to access the page through enowars.local .

Production

Postgres needs an empty data folder (we can't add that to git) therefore create the folder postgres_data in the root directory.

 mkdir postgres_data 

Make sure to use nginx.live.conf in Nginx Dockerfile and run deployment_ini_letsencrypt.sh once to create dummy certificates before nginx start.

Cronjob to set download files permission:

*/2 * * * * /bin/chmod -R 0644 /eno/enoteams/static/files/*

SQL Dump

pg_dump -d postgres -h 127.0.0.1 -p 5432 -U postgres -W dump.psql

Reset Postgres Sequenze

ALTER SEQUENCE users_id_seq RESTART;

Updating

git pull
sudo docker-compose restart gunicorn 

Emails

To send an email to all registered teams use the script in app/team_mail.py
Before adapt the content of the script to send your actual text to the team and NOT the dummy data. Invoke it from within the gunicorn container:

docker-compose exec gunicorn sh
$python3 team_mail.py

Team data

Description

id: integer,
username: email,
team_name: text,
country: text,
university: text,
mail_verified: boolean,
active: boolean
  • id is a incremented number starting from `1
  • username is an email address (re.match(r"[^@]+@[^@]+\.[^@]+", email))
  • team_name is a string (3 < length < 20)
  • country is a string (2 character, ISO 3166-1 Alpha-2 code)
  • university is a string (re.match("^[A-Za-z äöüÄÖÜß]*$", university))
  • mail_verified is a boolean
  • active is a boolean

Get the data

Get access to the host

Use secret/export?pw=password from flask.cfg

http://enowars.local/secret/export?pw=test

Downloads

Put all public or large files (e.g. vms) in /root/eno-landing-page/static/files and secret or small files (e.g. config files & keys) in /root/eno-landing-page/app/downloads/ at the registration host (enowars.com). Use the following name scheme:

root@localhost:~/eno-landing-page/static/files# ls
team_router.tar.gz
test_vm.tar.gz
vm.tar.gz

root@localhost:~/eno-landing-page/app/downloads# ls
team1.conf
vm.key
  • Router: team_router.tar.gz
  • Test VM: test_vm.tar.gz
  • VM: vm.tar.gz
  • VM Key: vm.key
  • VPN Configurations: teamX.conf with X increasing int (team 1 will be able to download the file team1.conf, team 2 team2.conf etc.)

Authenticated downloads can be enabled/disabled through the flask.cfg:

DOWNLOAD_CONFIG_ENABLED=True
DOWNLOAD_KEY_ENABLED=True

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.