add router sanity check, fix mcp race condition

This commit is contained in:
Neale Pickett 2011-10-19 16:16:57 -06:00
parent 3619508209
commit 543b0a5b1b
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
hostname mcp
# Bring up address
IP=$(cat ip.txt)
ip addr add $IP dev eth0
ip monitor | grep -q $IP
ip addr add $IP dev eth0 || true
# Link in puzzles and web pages
install -d /var/www
for d in /opt/*; do
if [ -d $d/puzzles ]; then
ln -sf $d/puzzles /var/www/$(basename $d)
w=/var/www/$(basename $d)
if [ -d $d/puzzles ] && ! [ -d $w ]; then
ln -sf $d/puzzles $w
fi
if [ -d $d/www ]; then
ln -sf $d/www/* /var/www/

View File

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

View File

@ -1,9 +1,9 @@
#! /bin/sh
port=8888
host=${1:-[::1]}
host=[${1:-::1}]
blooper=$(tempfile)
blooper=/tmp/bloop.$$
trap "rm $blooper" 0
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
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
# Bring up main ethernet interface

View File

@ -2,6 +2,6 @@
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