add router sanity check, fix mcp race condition

This commit is contained in:
Neale Pickett 2011-10-19 16:16:57 -06:00
parent 3d4b401396
commit ce9b172ecb
6 changed files with 23 additions and 15 deletions

View File

@ -1,4 +0,0 @@
#! /bin/sh
IP=$(cat ip.txt)
ip addr del $IP dev eth0

View File

@ -1,17 +1,19 @@
#! /bin/sh #! /bin/sh -e
exec 2>&1 exec 2>&1
hostname mcp
# Bring up address # Bring up address
IP=$(cat ip.txt) IP=$(cat ip.txt)
ip addr add $IP dev eth0 ip addr add $IP dev eth0 || true
ip monitor | grep -q $IP
# Link in puzzles and web pages # Link in puzzles and web pages
install -d /var/www install -d /var/www
for d in /opt/*; do for d in /opt/*; do
if [ -d $d/puzzles ]; then w=/var/www/$(basename $d)
ln -sf $d/puzzles /var/www/$(basename $d) if [ -d $d/puzzles ] && ! [ -d $w ]; then
ln -sf $d/puzzles $w
fi fi
if [ -d $d/www ]; then if [ -d $d/www ]; then
ln -sf $d/www/* /var/www/ ln -sf $d/www/* /var/www/

View File

@ -46,7 +46,7 @@ h1:first-child {
h1:first-child:before { h1:first-child:before {
letter-spacing: -0.1em; letter-spacing: -0.1em;
content: "Capture The Flag: "; content: "NSM FIRE: ";
} }
/**** body ****/ /**** body ****/

View File

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
port=8888 port=8888
host=${1:-[::1]} host=[${1:-::1}]
blooper=$(tempfile) blooper=/tmp/bloop.$$
trap "rm $blooper" 0 trap "rm $blooper" 0
echo foo | socat -t 0.01 STDIO UDP6:$host:$port | tail -n +5 > $blooper echo foo | socat -t 0.01 STDIO UDP6:$host:$port | tail -n +5 > $blooper

View File

@ -4,9 +4,19 @@ exec 2>&1
PFX=fd84:b410:3441 PFX=fd84:b410:3441
hostname router log () {
echo "router: $@"
echo "router: $@" > /dev/console
}
# We're a router if [ $(mount | grep -c /opt/) -gt 1 ]; then
log "cannot run alongside other packages" > /dev/console
exit 1
fi
# I'm a router
hostname router
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
# Bring up main ethernet interface # Bring up main ethernet interface

View File

@ -2,6 +2,6 @@
exec 2>&1 exec 2>&1
[ -r /etc/passwd ] || echo 'root:$1$xAJ7KwiU$BeKJjYGs9r/hY9Ag4qv4I1:0:0:root:/tmp:/bin/sh' > /etc/passwd echo 'root:$1$xAJ7KwiU$BeKJjYGs9r/hY9Ag4qv4I1:0:0:root:/tmp:/bin/sh' > /etc/passwd
exec dropbear -r ./rsa.key -E -F exec dropbear -r ./rsa.key -E -F