diff --git a/README.md b/README.md index 42d127b..3c73a6d 100644 --- a/README.md +++ b/README.md @@ -50,19 +50,56 @@ Running A Production Server XXX: Update this -How to set it up +How to install it -------------------- It's made to be virtualized, so you can run multiple contests at once if you want. -If you were to want to run it out of `/opt/koth`, +If you were to want to run it out of `/srv/moth`, do the following: - $ mkdir -p /opt/koth/mycontest - $ ./install /opt/koth/mycontest - $ cp kothd /opt/koth + $ mothinst=/srv/moth/mycontest + $ mkdir -p $mothinst + $ install.sh $mothinst -Yay, you've got it set up. + Yay, you've got it installed. + +How to run a contest +------------------------ + +`mothd` runs through every contest on your server every few seconds, +and does housekeeping tasks that make the contest "run". +If you stop `mothd`, people can still play the contest, +but their points won't show up on the scoreboard. + +A handy side-effect here is that if you need to meddle with the points log, +you can just kill `mothd`, +do you work, +then bring `mothd` back up. + + $ cp src/mothd /srv/moth + $ /srv/moth/mothd + +You're also going to need a web server if you want people to be able to play. + + +How to run a web server +----------------------------- + +Your web server needs to serve up files for you contest out of +`$mothinst/www`. + +If you don't want to fuss around with setting up a full-featured web server, +you can use `tcpserver` and `eris`, +which is what we use to run our contests. + +`tcpserver` is part of the `uscpi-tcp` package in Ubuntu. +You can also use busybox's `tcpsvd` (my preference, but a PITA on Ubuntu). + +`eris` can be obtained at https://woozle.org/neale/g.cgi/net/eris/about/ + + $ mothinst=/srv/moth/mycontest + $ $mothinst/bin/httpd Installing Puzzle Categories @@ -71,18 +108,9 @@ Installing Puzzle Categories Puzzle categories are distributed in a different way than the server. After setting up (see above), just run - $ /opt/koth/mycontest/bin/install-category /path/to/my/category + $ /srv/koth/mycontest/bin/install-category /path/to/my/category -Running It -------------- - -Get your web server to serve up files from -`/opt/koth/mycontest/www`. - -Then run `/opt/koth/kothd`. - - Permissions ---------------- diff --git a/src/bin/award b/bin/award similarity index 100% rename from src/bin/award rename to bin/award diff --git a/bin/httpd b/bin/httpd new file mode 100755 index 0000000..854aa5b --- /dev/null +++ b/bin/httpd @@ -0,0 +1,16 @@ +#!/bin/sh -e + +# Starts a standalone server using tcpsvd and eris + +echo "Figuring out web user..." +for www in www-data http tc _ _www; do + id $www && break +done +if [ $www = _ ]; then + echo "Unable to determine httpd user on this system. Dying." + exit 1 +fi + +cd $(dirname $0)/../www +tcpserver -RHI localhost -u $www -g $www 0 80 eris -c -. + diff --git a/src/bin/install-category b/bin/install-category similarity index 100% rename from src/bin/install-category rename to bin/install-category diff --git a/src/bin/mktokens b/bin/mktokens similarity index 100% rename from src/bin/mktokens rename to bin/mktokens diff --git a/src/bin/new b/bin/new similarity index 100% rename from src/bin/new rename to bin/new diff --git a/src/bin/once b/bin/once similarity index 96% rename from src/bin/once rename to bin/once index 7645174..82ee920 100755 --- a/src/bin/once +++ b/bin/once @@ -7,6 +7,8 @@ else fi basedir=$(pwd) +printf "Updating moth instance in %s\n" $(pwd) + # Do nothing if `disabled` is present if [ -f disabled ]; then exit diff --git a/src/bin/points b/bin/points similarity index 100% rename from src/bin/points rename to bin/points diff --git a/src/bin/puzzles b/bin/puzzles similarity index 100% rename from src/bin/puzzles rename to bin/puzzles diff --git a/tools/devel-server.py b/tools/devel-server.py index f7a9157..bf80ac3 100755 --- a/tools/devel-server.py +++ b/tools/devel-server.py @@ -36,7 +36,7 @@ def page(title, body): {title} - +

{title}

diff --git a/src/www/cgi-bin/cgi.lua b/www/cgi-bin/cgi.lua similarity index 100% rename from src/www/cgi-bin/cgi.lua rename to www/cgi-bin/cgi.lua diff --git a/src/www/cgi-bin/koth.lua b/www/cgi-bin/koth.lua similarity index 100% rename from src/www/cgi-bin/koth.lua rename to www/cgi-bin/koth.lua diff --git a/src/www/cgi-bin/puzzler.cgi b/www/cgi-bin/puzzler.cgi similarity index 100% rename from src/www/cgi-bin/puzzler.cgi rename to www/cgi-bin/puzzler.cgi diff --git a/src/www/cgi-bin/register.cgi b/www/cgi-bin/register.cgi similarity index 100% rename from src/www/cgi-bin/register.cgi rename to www/cgi-bin/register.cgi diff --git a/src/www/cgi-bin/token.cgi b/www/cgi-bin/token.cgi similarity index 100% rename from src/www/cgi-bin/token.cgi rename to www/cgi-bin/token.cgi diff --git a/src/www/credits.html b/www/credits.html similarity index 100% rename from src/www/credits.html rename to www/credits.html diff --git a/src/www/index.html b/www/fancypants.html similarity index 100% rename from src/www/index.html rename to www/fancypants.html diff --git a/src/www/fonts/MicroFLF-Bold.ttf b/www/fonts/MicroFLF-Bold.ttf similarity index 100% rename from src/www/fonts/MicroFLF-Bold.ttf rename to www/fonts/MicroFLF-Bold.ttf diff --git a/src/www/fonts/MicroFLF-BoldItalic.ttf b/www/fonts/MicroFLF-BoldItalic.ttf similarity index 100% rename from src/www/fonts/MicroFLF-BoldItalic.ttf rename to www/fonts/MicroFLF-BoldItalic.ttf diff --git a/src/www/fonts/MicroFLF-Italic.ttf b/www/fonts/MicroFLF-Italic.ttf similarity index 100% rename from src/www/fonts/MicroFLF-Italic.ttf rename to www/fonts/MicroFLF-Italic.ttf diff --git a/src/www/fonts/MicroFLF.css b/www/fonts/MicroFLF.css similarity index 100% rename from src/www/fonts/MicroFLF.css rename to www/fonts/MicroFLF.css diff --git a/src/www/fonts/MicroFLF.ttf b/www/fonts/MicroFLF.ttf similarity index 100% rename from src/www/fonts/MicroFLF.ttf rename to www/fonts/MicroFLF.ttf diff --git a/src/www/fonts/maven_pro.css b/www/fonts/maven_pro.css similarity index 100% rename from src/www/fonts/maven_pro.css rename to www/fonts/maven_pro.css diff --git a/src/www/fonts/maven_pro_black-webfont.eot b/www/fonts/maven_pro_black-webfont.eot similarity index 100% rename from src/www/fonts/maven_pro_black-webfont.eot rename to www/fonts/maven_pro_black-webfont.eot diff --git a/src/www/fonts/maven_pro_black-webfont.svg b/www/fonts/maven_pro_black-webfont.svg similarity index 100% rename from src/www/fonts/maven_pro_black-webfont.svg rename to www/fonts/maven_pro_black-webfont.svg diff --git a/src/www/fonts/maven_pro_black-webfont.ttf b/www/fonts/maven_pro_black-webfont.ttf similarity index 100% rename from src/www/fonts/maven_pro_black-webfont.ttf rename to www/fonts/maven_pro_black-webfont.ttf diff --git a/src/www/fonts/maven_pro_black-webfont.woff b/www/fonts/maven_pro_black-webfont.woff similarity index 100% rename from src/www/fonts/maven_pro_black-webfont.woff rename to www/fonts/maven_pro_black-webfont.woff diff --git a/src/www/fonts/maven_pro_bold-webfont.eot b/www/fonts/maven_pro_bold-webfont.eot similarity index 100% rename from src/www/fonts/maven_pro_bold-webfont.eot rename to www/fonts/maven_pro_bold-webfont.eot diff --git a/src/www/fonts/maven_pro_bold-webfont.svg b/www/fonts/maven_pro_bold-webfont.svg similarity index 100% rename from src/www/fonts/maven_pro_bold-webfont.svg rename to www/fonts/maven_pro_bold-webfont.svg diff --git a/src/www/fonts/maven_pro_bold-webfont.ttf b/www/fonts/maven_pro_bold-webfont.ttf similarity index 100% rename from src/www/fonts/maven_pro_bold-webfont.ttf rename to www/fonts/maven_pro_bold-webfont.ttf diff --git a/src/www/fonts/maven_pro_bold-webfont.woff b/www/fonts/maven_pro_bold-webfont.woff similarity index 100% rename from src/www/fonts/maven_pro_bold-webfont.woff rename to www/fonts/maven_pro_bold-webfont.woff diff --git a/src/www/fonts/maven_pro_medium-webfont.eot b/www/fonts/maven_pro_medium-webfont.eot similarity index 100% rename from src/www/fonts/maven_pro_medium-webfont.eot rename to www/fonts/maven_pro_medium-webfont.eot diff --git a/src/www/fonts/maven_pro_medium-webfont.svg b/www/fonts/maven_pro_medium-webfont.svg similarity index 100% rename from src/www/fonts/maven_pro_medium-webfont.svg rename to www/fonts/maven_pro_medium-webfont.svg diff --git a/src/www/fonts/maven_pro_medium-webfont.ttf b/www/fonts/maven_pro_medium-webfont.ttf similarity index 100% rename from src/www/fonts/maven_pro_medium-webfont.ttf rename to www/fonts/maven_pro_medium-webfont.ttf diff --git a/src/www/fonts/maven_pro_medium-webfont.woff b/www/fonts/maven_pro_medium-webfont.woff similarity index 100% rename from src/www/fonts/maven_pro_medium-webfont.woff rename to www/fonts/maven_pro_medium-webfont.woff diff --git a/src/www/fonts/maven_pro_regular-webfont.eot b/www/fonts/maven_pro_regular-webfont.eot similarity index 100% rename from src/www/fonts/maven_pro_regular-webfont.eot rename to www/fonts/maven_pro_regular-webfont.eot diff --git a/src/www/fonts/maven_pro_regular-webfont.svg b/www/fonts/maven_pro_regular-webfont.svg similarity index 100% rename from src/www/fonts/maven_pro_regular-webfont.svg rename to www/fonts/maven_pro_regular-webfont.svg diff --git a/src/www/fonts/maven_pro_regular-webfont.ttf b/www/fonts/maven_pro_regular-webfont.ttf similarity index 100% rename from src/www/fonts/maven_pro_regular-webfont.ttf rename to www/fonts/maven_pro_regular-webfont.ttf diff --git a/src/www/fonts/maven_pro_regular-webfont.woff b/www/fonts/maven_pro_regular-webfont.woff similarity index 100% rename from src/www/fonts/maven_pro_regular-webfont.woff rename to www/fonts/maven_pro_regular-webfont.woff diff --git a/src/www/images/brown-circles.jpg b/www/images/brown-circles.jpg similarity index 100% rename from src/www/images/brown-circles.jpg rename to www/images/brown-circles.jpg diff --git a/src/www/images/doe.png b/www/images/doe.png similarity index 100% rename from src/www/images/doe.png rename to www/images/doe.png diff --git a/src/www/images/lanl.png b/www/images/lanl.png similarity index 100% rename from src/www/images/lanl.png rename to www/images/lanl.png diff --git a/src/www/images/sandia.png b/www/images/sandia.png similarity index 100% rename from src/www/images/sandia.png rename to www/images/sandia.png diff --git a/src/www/images/tf6.png b/www/images/tf6.png similarity index 100% rename from src/www/images/tf6.png rename to www/images/tf6.png diff --git a/src/www/images/tf6bg.png b/www/images/tf6bg.png similarity index 100% rename from src/www/images/tf6bg.png rename to www/images/tf6bg.png diff --git a/www/index.html b/www/index.html new file mode 100644 index 0000000..ffdc778 --- /dev/null +++ b/www/index.html @@ -0,0 +1,75 @@ + + + + + + Welcome + + + +

Cyber FIRE

+ + + +
+

Getting Started

+ +

+ Here is what you need to do: +

+ +
    +
  1. + Register your team. + This only needs to happen once per team, + so if somebody else on your team has already done it, + you don't need to. +
  2. + +
  3. + Get an overview of puzzles, + and start working on something. + The list of open puzzles changes over time, + you need to reload the page to get the current version! +
  4. + +
  5. + Check the scoreboard + in another tab, + to see how your team is doing. +
  6. +
+
+ +
+

Reading Material

+ +

+ Stuck? Taking a break? + Here are some things to read. +

+ + +
+ +
+ Los Alamos National Laboratory + US Department Of Energy + Sandia National Laboratories +
+ + diff --git a/src/www/projections.json b/www/projections.json similarity index 100% rename from src/www/projections.json rename to www/projections.json diff --git a/src/www/projector.html b/www/projector.html similarity index 100% rename from src/www/projector.html rename to www/projector.html diff --git a/src/www/puzzles.html b/www/puzzles.html similarity index 51% rename from src/www/puzzles.html rename to www/puzzles.html index 343bd8d..f273602 100644 --- a/src/www/puzzles.html +++ b/www/puzzles.html @@ -4,7 +4,13 @@ Open Puzzles - + + + + + + +

Open Puzzles

diff --git a/src/www/register.html b/www/register.html similarity index 100% rename from src/www/register.html rename to www/register.html diff --git a/src/www/res/Inconsolata-Bold.ttf b/www/res/Inconsolata-Bold.ttf similarity index 100% rename from src/www/res/Inconsolata-Bold.ttf rename to www/res/Inconsolata-Bold.ttf diff --git a/src/www/res/Inconsolata-Regular.ttf b/www/res/Inconsolata-Regular.ttf similarity index 100% rename from src/www/res/Inconsolata-Regular.ttf rename to www/res/Inconsolata-Regular.ttf diff --git a/src/www/res/Lato-Black.ttf b/www/res/Lato-Black.ttf similarity index 100% rename from src/www/res/Lato-Black.ttf rename to www/res/Lato-Black.ttf diff --git a/src/www/res/Lato-BlackItalic.ttf b/www/res/Lato-BlackItalic.ttf similarity index 100% rename from src/www/res/Lato-BlackItalic.ttf rename to www/res/Lato-BlackItalic.ttf diff --git a/src/www/res/Lato-Bold.ttf b/www/res/Lato-Bold.ttf similarity index 100% rename from src/www/res/Lato-Bold.ttf rename to www/res/Lato-Bold.ttf diff --git a/src/www/res/Lato-BoldItalic.ttf b/www/res/Lato-BoldItalic.ttf similarity index 100% rename from src/www/res/Lato-BoldItalic.ttf rename to www/res/Lato-BoldItalic.ttf diff --git a/src/www/res/Lato-Hairline.ttf b/www/res/Lato-Hairline.ttf similarity index 100% rename from src/www/res/Lato-Hairline.ttf rename to www/res/Lato-Hairline.ttf diff --git a/src/www/res/Lato-HairlineItalic.ttf b/www/res/Lato-HairlineItalic.ttf similarity index 100% rename from src/www/res/Lato-HairlineItalic.ttf rename to www/res/Lato-HairlineItalic.ttf diff --git a/src/www/res/Lato-Italic.ttf b/www/res/Lato-Italic.ttf similarity index 100% rename from src/www/res/Lato-Italic.ttf rename to www/res/Lato-Italic.ttf diff --git a/src/www/res/Lato-Light.ttf b/www/res/Lato-Light.ttf similarity index 100% rename from src/www/res/Lato-Light.ttf rename to www/res/Lato-Light.ttf diff --git a/src/www/res/Lato-LightItalic.ttf b/www/res/Lato-LightItalic.ttf similarity index 100% rename from src/www/res/Lato-LightItalic.ttf rename to www/res/Lato-LightItalic.ttf diff --git a/src/www/res/Lato-Regular.ttf b/www/res/Lato-Regular.ttf similarity index 100% rename from src/www/res/Lato-Regular.ttf rename to www/res/Lato-Regular.ttf diff --git a/src/www/res/Lato.css b/www/res/Lato.css similarity index 100% rename from src/www/res/Lato.css rename to www/res/Lato.css diff --git a/src/www/res/brown-lines.jpg b/www/res/brown-lines.jpg similarity index 100% rename from src/www/res/brown-lines.jpg rename to www/res/brown-lines.jpg diff --git a/src/www/res/common.js b/www/res/common.js similarity index 100% rename from src/www/res/common.js rename to www/res/common.js diff --git a/src/www/res/luna-moth.png b/www/res/luna-moth.png similarity index 100% rename from src/www/res/luna-moth.png rename to www/res/luna-moth.png diff --git a/src/www/res/luna-moth.svg b/www/res/luna-moth.svg similarity index 100% rename from src/www/res/luna-moth.svg rename to www/res/luna-moth.svg diff --git a/src/www/res/main.js b/www/res/main.js similarity index 100% rename from src/www/res/main.js rename to www/res/main.js diff --git a/src/www/res/md5.min.js b/www/res/md5.min.js similarity index 100% rename from src/www/res/md5.min.js rename to www/res/md5.min.js diff --git a/src/www/res/messages.js b/www/res/messages.js similarity index 100% rename from src/www/res/messages.js rename to www/res/messages.js diff --git a/src/www/res/overview.js b/www/res/overview.js similarity index 100% rename from src/www/res/overview.js rename to www/res/overview.js diff --git a/src/www/res/preview.png b/www/res/preview.png similarity index 100% rename from src/www/res/preview.png rename to www/res/preview.png diff --git a/src/www/res/puzzles.js b/www/res/puzzles.js similarity index 88% rename from src/www/res/puzzles.js rename to www/res/puzzles.js index 8edb066..bbba387 100644 --- a/src/www/res/puzzles.js +++ b/www/res/puzzles.js @@ -31,11 +31,12 @@ function puzzlesRefresh(term, obj) { if (points == 0) { i.textContent = "‡"; } else { - var a = createElement('span'); + var a = createElement('a'); i.appendChild(a); a.className = "link"; a.textContent = points; - a.addEventListener("click", loadPuzzle.bind(undefined, cat, id, points)); + a.href = cat + "/" + id + "/index.html"; + // a.addEventListener("click", loadPuzzle.bind(undefined, cat, id, points)); } } diff --git a/src/www/res/scoreboard.js b/www/res/scoreboard.js similarity index 100% rename from src/www/res/scoreboard.js rename to www/res/scoreboard.js diff --git a/src/www/res/style.css b/www/res/style.css similarity index 100% rename from src/www/res/style.css rename to www/res/style.css diff --git a/src/www/res/terminal.js b/www/res/terminal.js similarity index 100% rename from src/www/res/terminal.js rename to www/res/terminal.js diff --git a/src/www/restore.html b/www/restore.html similarity index 100% rename from src/www/restore.html rename to www/restore.html diff --git a/src/www/scoreboard.html b/www/scoreboard.html similarity index 100% rename from src/www/scoreboard.html rename to www/scoreboard.html diff --git a/src/www/scoreboard.js b/www/scoreboard.js similarity index 100% rename from src/www/scoreboard.js rename to www/scoreboard.js diff --git a/src/www/scoring.html b/www/scoring.html similarity index 100% rename from src/www/scoring.html rename to www/scoring.html diff --git a/src/www/style.css b/www/style.css similarity index 100% rename from src/www/style.css rename to www/style.css diff --git a/src/www/terminal.js b/www/terminal.js similarity index 100% rename from src/www/terminal.js rename to www/terminal.js