Skip to content

Registration Website

Sebastiano Mariani edited this page Mar 31, 2020 · 1 revision

Setup Machine

  • Register a new domain (for instance, ictf.love).
  • Find a free machine with a public IP address (IP address for instance: 192.35.222.159).
  • Make the domain points to your public IP address.
  • Create a new API token on Sengrid and authenticate your domain following this guide
  • Clone https://git.seclab.cs.ucsb.edu/ictf/ictf-framework/ on your machine and checkout on branch ictf2020_reg_website
  • Modify the sendgrid API_KEY in ictf-framework/ictf_website/mailer.py
  • Install the dependencies list in ictf-framework/ictf_website/deps_install.txt
  • Install the python packages in ictf-framework/ictf_website/requirements.txt

Setup MySQL

  • Login as root
    • mysql -u root -p
  • Create new user/database/table
    • CREATE USER 'ictf'@'localhost' IDENTIFIED BY 'user_password';
    • CREATE DATABASE ictf_db;
      • CREATE TABLE teams ( id INTEGER NOT NULL AUTO_INCREMENT, email TEXT NOT NULL, name TEXT NOT NULL, country TEXT NOT NULL, url TEXT NOT NULL, academic INTEGER NOT NULL, flag_token TEXT, email_confirmed INTEGER, email_confirmed_on DATETIME, email_verification_token TEXT, PRIMARY KEY(id) );
    • grant all privileges on ictf_db.* to 'ictf'@'localhost';
    • EXIT
  • Verify you can login with the new user and query the table teams.

Setup Flask-Website

  • Deploy the website following this
  • In the ictf_website.service configuration (/etc/systemd/system/ictf_website.service) remember to export the following env-vars:
    • export ICTF_WEBSITE_ADMIN_USER=ictf
    • export ICTF_WEBSITE_ADMIN_PASSWORD=user_password
    • export SENDGRID_API_TOKEN=<NEW_SENDGRID_TOKEN>

Useful Commands

  • sudo systemctl stop ictf_website
  • sudo systemctl start ictf_website
  • sudo systemctl restart nginx
  • sudo less /var/log/nginx/error.log | show nginx errors
  • sudo journalctl -u ictf_website | Show log of the flask application
  • sudo journalctl --unit=my.service -n 100 --no-pager
  • MySQL Commands: *
    • show databases;
    • use ictf_db;
    • delete from teams; | drops every row in the table teams.
  • curl ifconfig.co | get your public IP.
  • watch -n 5 python current_teams.py
  • mysqldump ictf_db > ictf_db.bak | dump sql backup
Clone this wiki locally