diff --git a/packages/00admin/00admin.mk b/packages/00admin/00admin.mk index 33dae36..6c77dc0 100644 --- a/packages/00admin/00admin.mk +++ b/packages/00admin/00admin.mk @@ -1,7 +1,12 @@ 00ADMIN_PKGDIR = $(TARGET)/00admin +ifndef PASSWORD +$(error PASSWORD not defined) +endif + 00admin-install: $(call COPYTREE, packages/00admin/service, $(00ADMIN_PKGDIR)/service) + echo "$(PASSWORD)" > $(00ADMIN_PKGDIR)/password mkdir -p $(00ADMIN_PKGDIR)/sbin cp packages/00admin/sbin/* $(00ADMIN_PKGDIR)/sbin diff --git a/packages/00admin/service/sshd/run b/packages/00admin/service/sshd/run index f4a6692..b2e99dd 100755 --- a/packages/00admin/service/sshd/run +++ b/packages/00admin/service/sshd/run @@ -2,7 +2,9 @@ exec 2>&1 -echo 'root:$1$i/EeZyl6$5C6Z8s0ftEdTKFLUli1wP1' | chpasswd --encrypted +read password < /opt/00admin/password + +printf 'root:%s' "$password" | chpasswd --md5 # Bring up the NIC; this will get us at least a link-local address, and # hopefully a global address with stateless autoconfiguration. diff --git a/packages/mcp/bin/addteam b/packages/mcp/bin/addteam index c7db910..76694d8 100755 --- a/packages/mcp/bin/addteam +++ b/packages/mcp/bin/addteam @@ -17,13 +17,6 @@ set -C base=${CTF_BASE:-/var/lib/ctf} www=${CTF_BASE:-/var/www} -if which backup-team >/dev/null 2>&1 ; then - if [ ! -e $base/pass ]; then - echo "\nYou should consider running backup-pass or new-contest." - echo "DBTL Altocumulus™ backup system will not work without it.\n" - fi -fi - mkdir -p $base/teams/names mkdir -p $base/teams/colors diff --git a/packages/mcp/bin/backup b/packages/mcp/bin/backup deleted file mode 100755 index e4c929f..0000000 --- a/packages/mcp/bin/backup +++ /dev/null @@ -1,25 +0,0 @@ -#! /bin/sh -e - -base=${CTF_BASE:-/var/lib/ctf} -www=${CTF_BASE:-/var/www} -pass=$base/pass -img=$www/bkup.png -time=$(date +%s) -output=bkup-${time}.png - -if [ ! -e $img -o ! -e $pass ]; then - exit 0 -fi - -# clean up all other backup images -if ls $www/bkup-*.png >/dev/null 2>&1 ; then - rm $www/bkup-*.png -fi - -# This is a tested method. -#(cat $img; tar -cf - $base 2>/dev/null | gzip -c ) > $www/$output - -# This is not a tested method. -(cat $img; tar -cvf - $base 2>/dev/null | gzip -c | rc4 3< $pass) > $www/$output - -echo $output diff --git a/packages/mcp/bin/backup-pass b/packages/mcp/bin/backup-pass deleted file mode 100755 index 4c34961..0000000 --- a/packages/mcp/bin/backup-pass +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -e - -trap "stty echo; echo ''; echo 'Passfile not written'; exit 42" 1 2 3 15 - -askpass () { - echo "Password: " - stty -echo - read pass1 - echo "Retype password: " - read pass2 - stty echo - if [ "${pass1}" = "${pass2}" ]; then - echo "Got it.\n" - return 0 - else - echo "Authentication token manipulation error.\n" - return 1 - fi -} - -base=${CTF_BASE:-/var/lib/ctf} -passfile=$base/pass - -if [ -e $passfile ]; then - echo "\nDanger! Danger!\n" - echo "Wipes out current passfile. It's ok as long as note the current" - echo "timestamp ($(date +%s)) and the new pass will be applied on the" - echo "next scoreboard update.\n" -fi - -echo "Enter passphrase for backups" -echo "To exit, press ctrl+c" -until askpass; do true; done - -echo -e "${pass1}" > $passfile -echo "Passfile written" -stty echo - diff --git a/packages/mcp/bin/scoreboard b/packages/mcp/bin/scoreboard index ff62e5a..cd6c21e 100755 --- a/packages/mcp/bin/scoreboard +++ b/packages/mcp/bin/scoreboard @@ -77,27 +77,31 @@ BEGIN { tslen = 0 nteams = 0; - while (1 == getline) { - time = $1 - team = $2 - cat = $3 - points = int($4) +} - if (! start) { - start = time - } +# MAINLOOP +{ + time = $1 + team = $2 + cat = $3 + points = int($4) - if (time > (outtime + interval)) { - outtime = time - output() - } - lasttime = time - - teams[team] = nteams++ - points_by_cat[cat] += points - points_by_cat_team[cat, team] += points + if (! start) { + start = time } + if (time > (outtime + interval)) { + outtime = time + output() + } + lasttime = time + + teams[team] = nteams++ + points_by_cat[cat] += points + points_by_cat_team[cat, team] += points +} + +END { output() # Get team colors and names @@ -180,7 +184,8 @@ BEGIN { print " " print " " print "

Scoreboard

" - print "

" + print "

" + print " \"\"" print " " print " " print " " diff --git a/packages/mcp/mcp.mk b/packages/mcp/mcp.mk index ed90ab2..b9bc2c8 100644 --- a/packages/mcp/mcp.mk +++ b/packages/mcp/mcp.mk @@ -31,6 +31,7 @@ mcp-install: $(MCP_BUILDDIR)/build $(call COPYTREE, packages/mcp/bin, $(MCP_PKGDIR)/bin) cp packages/mcp/src/pointscli $(MCP_PKGDIR)/bin/ cp packages/mcp/src/puzzles.cgi $(MCP_PKGDIR)/bin/ + cp packages/mcp/src/tea $(MCP_PKGDIR)/bin/ cp $(MCP_BUILDDIR)/eris/eris $(MCP_PKGDIR)/bin/ diff --git a/packages/mcp/service/pointsd/bkup.png b/packages/mcp/service/pointsd/bkup.png new file mode 100644 index 0000000..aea1424 Binary files /dev/null and b/packages/mcp/service/pointsd/bkup.png differ diff --git a/packages/mcp/service/pointsd/pointsd b/packages/mcp/service/pointsd/pointsd index a27e152..c9c9ba0 100755 --- a/packages/mcp/service/pointsd/pointsd +++ b/packages/mcp/service/pointsd/pointsd @@ -1,16 +1,31 @@ -#! /bin/sh +#! /bin/sh -e fn=$2/$3 -POINTS=/var/lib/ctf/points.log -SCOREBOARD=/var/www/scoreboard.html + +WWW=${CTF_BASE:-/var/www} +BASE=${CTF_BASE:-/var/lib/ctf} +OPT=${CTF_BASE:-/opt} + +POINTS=$BASE/points.log +BACKUP=$WWW/backup.png +SCOREBOARD=$WWW/scoreboard.html # Only do this if this score hasn't yet been recorded if ! cut -d' ' -f2- $POINTS | grep -Fqx "$(cut -d' ' -f2- $fn)"; then - cat $fn >> $POINTS && rm $fn + cat $fn >> $POINTS + rm $fn fi -# Render scoreboard if [ $POINTS -nt $SCOREBOARD ]; then - /opt/mcp/bin/scoreboard < $POINTS > $SCOREBOARD.new && mv $SCOREBOARD.new $SCOREBOARD + # Generate new backup + ( + cat bkup.png; + tar cvf - $BASE | gzip -c | $OPT/00admin/bin/tea 3< $OPT/00admin/password + ) > $BACKUP.new + mv $BACKUP.new $BACKUP + + # Render scoreboard + /opt/mcp/bin/scoreboard < $POINTS > $SCOREBOARD.new + mv $SCOREBOARD.new $SCOREBOARD fi diff --git a/packages/mcp/www/bkup.png b/packages/mcp/www/bkup.png deleted file mode 100644 index 89c959c..0000000 Binary files a/packages/mcp/www/bkup.png and /dev/null differ diff --git a/packages/multicaster/src/multicaster.c b/packages/multicaster/src/multicaster.c index 0689959..5b62255 100644 --- a/packages/multicaster/src/multicaster.c +++ b/packages/multicaster/src/multicaster.c @@ -27,7 +27,6 @@ main(int argc, char *argv[]) char* multicastIP; /* Arg: IP Multicast address */ char* multicastPort; /* Arg: Server port */ char token[100]; - size_t tokenlen; struct addrinfo * multicastAddr; /* Multicast address */ struct addrinfo hints = { 0 }; /* Hints for name lookup */ struct timeval timeout = { 0 }; @@ -44,7 +43,6 @@ main(int argc, char *argv[]) if (NULL == fgets(token, sizeof(token), stdin)) { DieWithError("Unable to read token"); } - tokenlen = strlen(token); /* Resolve destination address for multicast datagrams */ hints.ai_family = PF_INET6; diff --git a/packages/router/router.mk b/packages/router/router.mk index f9e5158..a8a42b1 100644 --- a/packages/router/router.mk +++ b/packages/router/router.mk @@ -59,7 +59,7 @@ $(ECMH_BUILDDIR): $(ECMH_CACHE) router-build: $(ROUTER_BUILDDIR)/ecmh-build $(ROUTER_BUILDDIR)/ecmh-build: $(ECMH_BUILDDIR) - $(MAKE) -C $(ECMH_BUILDDIR)/src ECMH_VERSION=dbtl-git STRIP=$(STRIP) + $(MAKE) -C $(ECMH_BUILDDIR)/src ECMH_VERSION=dbtl-git STRIP=echo $(MAKE) -C $(ECMH_BUILDDIR)/tools/mtrace6 touch $@
Overall