Packages set their own IPs

This commit is contained in:
Neale Pickett 2011-02-07 13:10:02 -07:00
parent c6456f8a00
commit 352ed1639e
8 changed files with 19 additions and 7 deletions

View File

@ -1,6 +1,7 @@
#! /bin/sh
while true; do
# Get new tokens
for dn in /opt/*/tokens/*; do
[ -d $dn ] || continue
puzzle=$(basename $dn)
@ -9,5 +10,16 @@ while true; do
-e /opt/tokens/bin/tokencli $category $dn/category.key 3>&1 | \
/opt/tokens/bin/arc4 $dn/enc.key > /var/lib/ctf/tokens/$puzzle
done
# Fetch list of teams
wget -q -P /var/lib/ctf http://10.0.0.2/teams.txt &
# Archive state
state=/var/www/state.tar.gz.rc4
tar cf - /var/lib/ctf | \
gzip -c | \
KEY='crashmaster' arc4 > $state.tmp
mv $state.tmp $state
sleep 60
done

View File

@ -2,11 +2,11 @@
exec 2>&1
# Set up networking for all CTF packages
# Set up networking for all CTF ip
ip link set eth0 up
if ! ip route | grep -q default; then
ip route add default via 10.0.0.1 || exit 1
fi
install -o root -m 0755 -d /var/lib/ctf/tokens
exec ./update-tokens
exec ./ctfd

View File

@ -2,5 +2,5 @@
exec 2>&1
IP=$(cat ip.txt)
ip addr add $IP dev eth0
ip addr add $IP label eth0:logger dev eth0
exec tcpsvd ${IP#/*} 1958 /opt/logger/bin/logger

View File

@ -2,7 +2,7 @@
exec 2>&1
ip addr add 10.0.0.2/24 dev eth0
ip addr add 10.0.0.2/24 label eth0:mcp dev eth0
DB=/var/lib/ctf/tokens.db

View File

@ -2,5 +2,5 @@
exec 2>&1
IP=$(cat ip.txt)
ip addr add $IP dev eth0
ip addr add $IP label eth0:octopus dev eth0
exec /opt/octopus/bin/octopus ${IP%/*}

View File

@ -3,7 +3,7 @@
exec 2>&1
IP=$(cat ip.txt)
ip addr add $IP dev eth0
ip addr add $IP label eth0:printf dev eth0
# So I say to him, "Alex, what's a good high port number for a CTF category?"
# And he says, "6"

View File

@ -2,7 +2,7 @@
# Configure IP address
IP=$(cat ip.txt)
ip addr add $IP dev eth0
ip addr add $IP label eth0:pwnables dev eth0
# Set up chroot environment
# We never umount any of this since it's all just in RAM