From aa5803e0e3368172d7674ff760983c568118df16 Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Mon, 19 Nov 2012 10:43:42 +0100 Subject: [PATCH 001/106] testing: Switch to Debian based guest images Instead of extracting a downloaded Gentoo filesystem tree into a file containing a reiserfs filesystem, create an ext3 filesystem inside a sparse file, mount it and debootstrap an up-to-date Debian system. Use this image as base for all UML guest images. Also, drop support for the various consoles and use xterm unconditionally. --- testing/do-tests.in | 19 +---- testing/make-testing | 32 ++++---- testing/scripts/build-baseimage | 66 ++++++++++++++++ testing/scripts/build-hostconfig | 14 +++- testing/scripts/build-sshkeys | 86 --------------------- testing/scripts/build-umlhostfs | 33 ++++---- testing/scripts/build-umlkernel | 13 +--- testing/scripts/build-umlrootfs | 100 ++++++++++++------------ testing/scripts/function.sh | 17 +---- testing/scripts/gstart-umls | 126 ------------------------------- testing/scripts/kstart-umls | 126 ------------------------------- testing/scripts/load-testconfig | 7 +- testing/scripts/start-umls | 18 +---- testing/scripts/xstart-umls | 126 ------------------------------- testing/start-testing | 23 +----- testing/testing.conf | 38 ++++------ 16 files changed, 189 insertions(+), 655 deletions(-) create mode 100755 testing/scripts/build-baseimage delete mode 100755 testing/scripts/build-sshkeys delete mode 100755 testing/scripts/gstart-umls delete mode 100755 testing/scripts/kstart-umls delete mode 100755 testing/scripts/xstart-umls diff --git a/testing/do-tests.in b/testing/do-tests.in index 82e027078..137bb31fb 100755 --- a/testing/do-tests.in +++ b/testing/do-tests.in @@ -558,14 +558,14 @@ do for file in clients.conf eap.conf radiusd.conf proxy.conf users do - scp $SSHCONF $HOSTLOGIN:/etc/raddb/$file \ + scp $SSHCONF $HOSTLOGIN:/etc/freeradius/$file \ $TESTRESULTDIR/${host}.$file > /dev/null 2>&1 done scp $SSHCONF $HOSTLOGIN:/etc/strongswan.conf \ $TESTRESULTDIR/${host}.strongswan.conf > /dev/null 2>&1 - scp $SSHCONF $HOSTLOGIN:/var/log/radius/radius.log \ + scp $SSHCONF $HOSTLOGIN:/var/log/freeradius/radius.log \ $TESTRESULTDIR/${host}.radius.log > /dev/null 2>&1 chmod a+r $TESTRESULTDIR/* @@ -584,7 +584,6 @@ do @@ -648,18 +647,6 @@ do done - ########################################################################## - # get a copy of /var/log/daemon.log - # - - for host in $RADIUSHOSTS - do - eval HOSTLOGIN=root@\$ipv4_${host} - ssh $SSHCONF $HOSTLOGIN grep imcv /var/log/daemon.log \ - >> $TESTRESULTDIR/${host}.daemon.log - done - - ########################################################################## # stop tcpdump if necessary # @@ -777,7 +764,7 @@ cecho "" # copy the test results to the apache server # -HTDOCS="/var/www/localhost/htdocs" +HTDOCS="/var/www" cecho-n "Copying test results to winnetou.." ssh $SSHCONF root@${ipv4_winnetou} mkdir -p $HTDOCS/testresults > /dev/null 2>&1 diff --git a/testing/make-testing b/testing/make-testing index 7cd3324e0..42f089e88 100755 --- a/testing/make-testing +++ b/testing/make-testing @@ -21,6 +21,7 @@ source $DIR/scripts/function.sh [ -f $DIR/testing.conf ] || die "!! Configuration file 'testing.conf' not found." source $DIR/testing.conf +rm -f $LOGFILE if [ "$#" -eq 0 ] then @@ -29,6 +30,16 @@ else HOSTS=$* fi +########################################################################## +# build base image +# +if [ $ENABLE_BUILD_BASEIMAGE = "yes" ] +then + cecho "Building base image" + $DIR/scripts/build-baseimage +fi + + ########################################################################## # build the UML kernel based on a vanilla kernel form kernel.org # and a matching UML patch from user-mode-linux.sourceforge.net @@ -40,12 +51,13 @@ then fi ########################################################################## -# Adding the ssh RSA public keys to ~/.ssh/known_hosts +# build a generic UML root file system based on a Gentoo root file system. +# compile and install a specified strongSwan release into the file system. # -if [ $ENABLE_BUILD_SSHKEYS = "yes" ] +if [ $ENABLE_BUILD_UMLROOTFS = "yes" ] then - cecho "Adding ssh public keys of the uml instances (scripts/build-sshkeys)" - $DIR/scripts/build-sshkeys + cecho "Building uml base image (scripts/build-umlrootfs)" + $DIR/scripts/build-umlrootfs fi ########################################################################## @@ -58,22 +70,12 @@ then $DIR/scripts/build-hostconfig fi -########################################################################## -# build a generic UML root file system based on a Gentoo root file system. -# compile and install a specified strongSwan release into the file system. -# -if [ $ENABLE_BUILD_UMLROOTFS = "yes" ] -then - cecho "Building uml root file system with strongSwan (scripts/build-umlrootfs)" - $DIR/scripts/build-umlrootfs -fi - ########################################################################## # Creating the root filesystems for the specified UML instances # if [ $ENABLE_BUILD_UMLHOSTFS = "yes" ] then - cecho "Building uml host root file systems (scripts/build-umlhostfs)" + cecho "Building uml host images (scripts/build-umlhostfs)" $DIR/scripts/build-umlhostfs $HOSTS fi diff --git a/testing/scripts/build-baseimage b/testing/scripts/build-baseimage new file mode 100755 index 000000000..bf6780f6c --- /dev/null +++ b/testing/scripts/build-baseimage @@ -0,0 +1,66 @@ +#!/bin/bash + +if [ `id -u` != 0 ]; +then + echo "! you must be root to run $0" + exit +fi + +DIR=`dirname $0` + +. $DIR/function.sh + +[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found" +. $DIR/../testing.conf + +execute() +{ + cmd=${1} + echo $cmd >>$LOGFILE + $cmd >>$LOGFILE 2>&1 + status=$? + if [ $status != 0 ]; then + echo "! command $cmd failed, exiting (status $status)" + echo "! check why here $LOGFILE" + exit 1 + fi +} + +# additional packages +EXTRAS=build-essential,gperf,libgmp-dev,libldap2-dev,libcurl4-openssl-dev,libxml2-dev,libtspi-dev,libsqlite3-dev,openssh-server,tcpdump,psmisc,openssl,vim,sqlite3,conntrack,gdb +SERVICES="isc-dhcp-server apache2 slapd" +PACKAGES=$EXTRAS,${SERVICES// /,} +CACHEDIR=$BUILDDIR/cache +APTCACHE=$LOOPDIR/var/cache/apt/archives + +mkdir -p $LOOPDIR +mkdir -p $BUILDDIR +mkdir -p $CACHEDIR +rm -f $ROOTFS + +echo "`date`, building $ROOTFS" >>$LOGFILE +echo " * Creating sparse image $ROOTFS ..." +execute "dd if=/dev/null of=$ROOTFS bs=1M seek=$ROOTFSSIZE count=1" +echo " * Creating ext3 filesystem ..." +execute "mkfs.ext3 -F $ROOTFS" +execute "mount -o loop $ROOTFS $LOOPDIR" +mkdir -p $APTCACHE +execute "mount -o bind $CACHEDIR $APTCACHE" + +echo " * Running debootstrap ..." +execute "debootstrap --arch=$ROOTFSARCH --include=$PACKAGES $ROOTFSSUITE $LOOPDIR $ROOTFSMIRROR" + +echo " * Setting root password to '$ROOTFSPW' ..." +echo root:$ROOTFSPW | chroot $LOOPDIR chpasswd + +echo " * Disabling services ..." +for service in $SERVICES +do + echo -n " - $service ... " + execute "chroot $LOOPDIR /etc/init.d/$service stop" + execute "chroot $LOOPDIR update-rc.d -f $service remove" + echo "done" +done + +execute "umount -l $APTCACHE" +execute "umount -l $LOOPDIR" diff --git a/testing/scripts/build-hostconfig b/testing/scripts/build-hostconfig index 0ebbc5264..cbe43dbb8 100755 --- a/testing/scripts/build-hostconfig +++ b/testing/scripts/build-hostconfig @@ -41,9 +41,19 @@ then fi mkdir $HOSTCONFIGDIR -cp -rfp ${UMLTESTDIR}/testing/hosts $BUILDDIR -cecho " * Copied default host config directory to '$HOSTCONFIGDIR'" +cecho-n " * Copying default host config for.." + +for host in $STRONGSWANHOSTS +do + cecho-n "$host.." + HOSTDIR=${HOSTCONFIGDIR}/$host + mkdir $HOSTDIR + cp -rfp $UMLTESTDIR/testing/hosts/default/* $HOSTDIR + cp -rfp $UMLTESTDIR/testing/hosts/$host/* $HOSTDIR +done + +cgecho "done" ######################################## # assign IP for each host to hostname diff --git a/testing/scripts/build-sshkeys b/testing/scripts/build-sshkeys deleted file mode 100755 index 799078557..000000000 --- a/testing/scripts/build-sshkeys +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -# build the hosts configuration directory with the actual IP addresses -# -# Copyright (C) 2004 Eric Marchionni, Patrik Rayo -# Zuercher Hochschule Winterthur -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. See . -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. - -DIR=`dirname $0` - -source $DIR/function.sh - -[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found" -[ -d $DIR/../hosts ] || die "!! Directory 'hosts' not found" - -source $DIR/../testing.conf - -if [ ! -d $BUILDDIR ] -then - cecho " * Creating directory '$BUILDDIR'" - mkdir $BUILDDIR -fi - -LOGFILE=${BUILDDIR}/testing.log - -if [ ! -f $LOGFILE ] -then - cecho-n " * Logfile '$LOGFILE' does not exist..creating.." - touch $LOGFILE - cgecho "done" -fi - -if [ ! -d ~/.ssh ] -then - cecho-n " * Creating directory '~/.ssh'.." - mkdir ~/.ssh - cgecho "done" -fi - -if [ -f ~/.ssh/known_hosts ] -then - cecho-n " * Backing up ~/.ssh/known_hosts to '~/.ssh/known_hosts.before_uml'.." - cp -fp ~/.ssh/known_hosts ~/.ssh/known_hosts.before_uml - cgecho "done" -else - cecho-n " * Creating '~/.ssh/known_hosts'" - touch ~/.ssh/known_hosts - cgecho "done" -fi - -for host in $HOSTNAMEIPV4 -do - HOSTNAME=`echo $host | awk -F, '{ print $1 }'` - IP=`echo $host | awk -F, '{ print $2 }'` - if [ `grep "$IP " ~/.ssh/known_hosts | wc -l` != "0" ] - then - cecho "!! Warning: An entry exists for the following IP address: $IP" - else - cecho-n " * Adding uml host $HOSTNAME ($IP) to '~/.ssh/known_hosts'.." - echo "$HOSTNAME,$IP `cat $DIR/../hosts/ssh_host_rsa_key.pub`" >> ~/.ssh/known_hosts - cgecho "done" - fi -done - -##################################### -# preparing ssh for PK authentication -# - -cecho-n " * Checking for ssh rsa key '~/.ssh/id_rsa.pub'.." -if [ -f ~/.ssh/id_rsa.pub ] -then - cecho "already exists" -else - cecho "not found" - cecho-n " * Generating ssh rsa key pair.." - echo "" | ssh-keygen -N "" -t rsa -f ~/.ssh/id_rsa >> $LOGFILE 2>&1 - cgecho "done" -fi diff --git a/testing/scripts/build-umlhostfs b/testing/scripts/build-umlhostfs index 75feaa4ed..9c309f545 100755 --- a/testing/scripts/build-umlhostfs +++ b/testing/scripts/build-umlhostfs @@ -23,8 +23,9 @@ source $DIR/function.sh source $DIR/../testing.conf cd $BUILDDIR/root-fs +BASE=$BUILDDIR/base.img -[ -f gentoo-fs ] || die "!! Root file system 'gentoo-fs' not found." +[ -f $BASE ] || die "!! Base image $BASE not found." if [ ! -d $BUILDDIR ] then @@ -33,17 +34,6 @@ then cgecho "done" fi -LOGFILE=${BUILDDIR}/testing.log - -if [ ! -f $LOGFILE ] -then - cecho-n " * Logfile '$LOGFILE' does not exist..creating.." - touch $LOGFILE - cgecho "done" -fi - -LOOPDIR=loop - if [ ! -d $LOOPDIR ] then mkdir $LOOPDIR @@ -61,17 +51,22 @@ fi for host in $HOSTS do cecho-n "$host.." - cp gentoo-fs gentoo-fs-$host - mount -o loop gentoo-fs-$host $LOOPDIR + cp $BASE $host.img + mount -o loop $host.img $LOOPDIR cp -rf $BUILDDIR/hosts/${host}/etc $LOOPDIR if [ "$host" = "winnetou" ] then - mkdir $LOOPDIR/var/log/apache2/ocsp - cp -rf $UMLTESTDIR/testing/images $LOOPDIR/var/www/localhost/htdocs - chroot $LOOPDIR ln -s /etc/openssl/certs /var/www/localhost/htdocs/certs - chroot $LOOPDIR /etc/openssl/generate-crl >> $LOGFILE 2>&1 + mkdir $LOOPDIR/var/log/apache2/ocsp + cp -rf $UMLTESTDIR/testing/images $LOOPDIR/var/www/ + chroot $LOOPDIR ln -s /etc/openssl/certs /var/www/certs + chroot $LOOPDIR /etc/openssl/generate-crl >> $LOGFILE 2>&1 + chroot $LOOPDIR update-rc.d apache2 defaults >> $LOGFILE 2>&1 + chroot $LOOPDIR update-rc.d slapd defaults >> $LOGFILE 2>&1 + chroot $LOOPDIR rm -rf /var/lib/ldap/* + chroot $LOOPDIR slapadd -l /etc/ldap/ldif.txt -f /etc/ldap/slapd.conf >> $LOGFILE 2>&1 + chroot $LOOPDIR chown -R openldap:openldap /var/lib/ldap >> $LOGFILE 2>&1 fi - chroot $LOOPDIR /etc/init.d/depscan.sh --update >> $LOGFILE 2>&1 + sync umount $LOOPDIR done diff --git a/testing/scripts/build-umlkernel b/testing/scripts/build-umlkernel index b9f0d710d..44e27c2b2 100755 --- a/testing/scripts/build-umlkernel +++ b/testing/scripts/build-umlkernel @@ -67,15 +67,6 @@ fi cecho " * Changing to directory '$BUILDDIR'" cd $BUILDDIR -LOGFILE=${BUILDDIR}/testing.log - -if [ ! -f $LOGFILE ] -then - cecho-n " * Logfile '$LOGFILE' does not exist..creating.." - touch $LOGFILE - cgecho "done" -fi - cecho-n " * Unpacking kernel.." tar xjf $KERNEL >> $LOGFILE 2>&1 cgecho "done" @@ -119,10 +110,10 @@ cp $KERNELCONFIG .config cecho "!!" cecho "!! Making .config for kernel. You might be prompted for new parameters!" cecho "!!" -make oldconfig ARCH=um SUBARCH=i386 2>&1 | tee -a $LOGFILE +make oldconfig ARCH=um 2>&1 | tee -a $LOGFILE cecho-n " * Now compiling uml kernel.." -make linux ARCH=um SUBARCH=i386 >> $LOGFILE 2>&1 +make -j5 linux ARCH=um >> $LOGFILE 2>&1 cgecho "done" cecho-n " * Copying uml kernel to '${BUILDDIR}/linux-uml-${KERNELVERSION}'.." diff --git a/testing/scripts/build-umlrootfs b/testing/scripts/build-umlrootfs index 523a3b536..647c929ea 100755 --- a/testing/scripts/build-umlrootfs +++ b/testing/scripts/build-umlrootfs @@ -34,7 +34,7 @@ else exit fi -cecho-n " * Looking for gentoo root filesystem at '$ROOTFS'.." +cecho-n " * Looking for root image at '$ROOTFS'.." if [ -f "$ROOTFS" ] then cecho "found it" @@ -45,19 +45,6 @@ fi [ -d $BUILDDIR ] || die "!! Directory '$BUILDDIR' does not exist" -HOSTCONFIGDIR=$BUILDDIR/hosts - -[ -d $HOSTCONFIGDIR ] || die "!! Directory '$HOSTCONFIGDIR' does not exist" - -LOGFILE=$BUILDDIR/testing.log - -if [ ! -f $LOGFILE ] -then - cecho-n " * Logfile '$LOGFILE' does not exist..creating.." - touch $LOGFILE - cgecho "done" -fi - ROOTFSDIR=$BUILDDIR/root-fs if [ ! -d $ROOTFSDIR ] @@ -69,22 +56,18 @@ fi cd $ROOTFSDIR -LOOPDIR=$ROOTFSDIR/loop - if [ ! -d $LOOPDIR ] then mkdir $LOOPDIR fi ###################################################### -# creating reiser-based uml root filesystem +# mount root image # - -cecho-n " * Building basic root filesystem (gentoo).." -dd if=/dev/zero of=gentoo-fs count=$ROOTFSSIZE bs=1M >> $LOGFILE 2>&1 -mkreiserfs -q -f gentoo-fs >> $LOGFILE 2>&1 -mount -o loop gentoo-fs $LOOPDIR >> $LOGFILE 2>&1 -tar xjpf $ROOTFS -C $LOOPDIR >> $LOGFILE 2>&1 +BASE=$BUILDDIR/base.img +cecho-n " * Mounting base image $BASE.." +cp $ROOTFS $BASE +mount -o loop $BASE $LOOPDIR >> $LOGFILE 2>&1 cgecho "done" ###################################################### @@ -93,12 +76,6 @@ cgecho "done" cecho " * Removing /etc/resolv.conf" rm -f $LOOPDIR/etc/resolv.conf -###################################################### -# copying default /etc/hosts to the root filesystem -# -cecho " * Copying '$HOSTCONFIGDIR/default/etc/hosts' to the root filesystem" -cp -fp $HOSTCONFIGDIR/default/etc/hosts $LOOPDIR/etc/hosts - ##################################################### # extracting strongSwan into the root filesystem # @@ -291,7 +268,7 @@ if [ "$USE_KERNEL_PFKEY" = "yes" ] then echo -n " --enable-kernel-pfkey" >> $INSTALLSHELL fi - + if [ "$USE_INTEGRITY_TEST" = "yes" ] then echo -n " --enable-integrity-test" >> $INSTALLSHELL @@ -408,7 +385,7 @@ then fi echo "" >> $INSTALLSHELL -echo "make -j" >> $INSTALLSHELL +echo "make -j5" >> $INSTALLSHELL echo "make install" >> $INSTALLSHELL echo "ldconfig" >> $INSTALLSHELL @@ -417,16 +394,50 @@ chroot $LOOPDIR /bin/bash /install.sh >> $LOGFILE 2>&1 rm -f $INSTALLSHELL cgecho "done" -###################################################### -# copying default /etc/ipsec.d/tables.sql to the root filesystem +##################################### +# preparing ssh for PK authentication # -cecho " * Copying '$HOSTCONFIGDIR/default/etc/ipsec.d/tables.sql' to the root filesystem" -cp -fp $HOSTCONFIGDIR/default/etc/ipsec.d/tables.sql $LOOPDIR/etc/ipsec.d/tables.sql +if [ ! -d ~/.ssh ] +then + cecho-n " * Creating directory '~/.ssh'.." + mkdir ~/.ssh + cgecho "done" +fi + +cecho-n " * Checking for ssh rsa key '~/.ssh/id_rsa.pub'.." +if [ -f ~/.ssh/id_rsa.pub ] +then + cecho "already exists" +else + cecho "not found" + cecho-n " * Generating ssh rsa key pair.." + echo "" | ssh-keygen -N "" -t rsa -f ~/.ssh/id_rsa >> $LOGFILE 2>&1 + cgecho "done" +fi + +if [ -f ~/.ssh/known_hosts ] +then + cecho-n " * Backing up ~/.ssh/known_hosts to '~/.ssh/known_hosts.before_uml'.." + cp -fp ~/.ssh/known_hosts ~/.ssh/known_hosts.before_uml + cgecho "done" +fi +rm ~/.ssh/known_hosts +cecho-n " * Creating new '~/.ssh/known_hosts'.." +touch ~/.ssh/known_hosts +cgecho "done" + +for host in $HOSTNAMEIPV4 +do + HOSTNAME=`echo $host | awk -F, '{ print $1 }'` + IP=`echo $host | awk -F, '{ print $2 }'` + cecho-n " * Adding uml host $HOSTNAME ($IP) to '~/.ssh/known_hosts'.." + echo "$HOSTNAME,$IP `cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub`" >> ~/.ssh/known_hosts + cgecho "done" +done ###################################################### # copying the host's ssh public key # - if [ ! -d $LOOPDIR/root/.ssh ] then mkdir $LOOPDIR/root/.ssh @@ -441,21 +452,8 @@ cp $LOOPDIR/etc/ssh/ssh_host_rsa_key $LOOPDIR/root/.ssh/id_rsa for host in $STRONGSWANHOSTS do eval ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F- '{ print $1 }' | awk '{ print $1 }'`" - echo "$host,$ip `cat $HOSTCONFIGDIR/ssh_host_rsa_key.pub`" >> $LOOPDIR/root/.ssh/known_hosts - echo "`cat $HOSTCONFIGDIR/ssh_host_rsa_key.pub` root@$host" >> $LOOPDIR/root/.ssh/authorized_keys + echo "$host,$ip `cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub`" >> $LOOPDIR/root/.ssh/known_hosts + echo "`cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub` root@$host" >> $LOOPDIR/root/.ssh/authorized_keys done -###################################################### -# defining an empty modules.dep -# - -if [ $UMLPATCH ] -then - mkdir $LOOPDIR/lib/modules/`basename $UMLPATCH .bz2 | sed s/uml-patch-//`um - touch $LOOPDIR/lib/modules/`basename $UMLPATCH .bz2 | sed s/uml-patch-//`um/modules.dep -else - mkdir $LOOPDIR/lib/modules/$KERNELVERSION - touch $LOOPDIR/lib/modules/$KERNELVERSION/modules.dep -fi - umount $LOOPDIR diff --git a/testing/scripts/function.sh b/testing/scripts/function.sh index e7ecbcf83..04723f105 100755 --- a/testing/scripts/function.sh +++ b/testing/scripts/function.sh @@ -55,13 +55,6 @@ function searchandreplace { [ -d "$DESTDIR" ] || die "$DESTDIR is not a directory!" - ######################### - # create a temporary file - # - - TMPFILE="/tmp/sr.$$" - - ########################################### # search and replace in each found file the # given string @@ -69,17 +62,9 @@ function searchandreplace { for eachfoundfile in `find $DESTDIR -type f` do - sed -e "s/$SEARCHSTRING/$REPLACESTRING/g" "$eachfoundfile" > "$TMPFILE" - cp -f "$TMPFILE" "$eachfoundfile" + sed -i -e "s/$SEARCHSTRING/$REPLACESTRING/g" "$eachfoundfile" done - - ########################### - # delete the temporary file - # - - rm -f "$TMPFILE" - } ############################################# diff --git a/testing/scripts/gstart-umls b/testing/scripts/gstart-umls deleted file mode 100755 index c6fcd26dc..000000000 --- a/testing/scripts/gstart-umls +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash -# starts the UML instances in an gnome-terminal (requires X11R6) -# -# Copyright (C) 2004 Eric Marchionni, Patrik Rayo -# Zuercher Hochschule Winterthur -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. See . -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. - -DIR=`dirname $0` - -source $DIR/function.sh - -[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found" - -source $DIR/../testing.conf - -if [ "$#" -eq 0 ] -then - HOSTS=$STRONGSWANHOSTS -else - HOSTS=$* -fi - -BOOTING_HOSTS="" -count_max=12 -count=0 - -#position of xterm window on the desktop -x0=8 -y0=52 -dx=12 -dy=24 - -for host in $HOSTS -do - up=0 - - if [ -d ~/.uml/${host} ] - then - pid=`cat ~/.uml/${host}/pid` - up=`ps up $pid | wc -l` - fi - - if [ $up -eq 2 ] - then - cecho " * Great, ${host} is already running!" - else - rm -rf ~/.uml/${host} - BOOTING_HOSTS="$BOOTING_HOSTS ${host}" - let "count_max += 12" - - UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host} - [ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found" - - cecho-n " * Starting ${host}.." - eval gnome-terminal --title=${host} --geometry="+${x0}+${y0}" --show-menubar --execute "$UMLKERNEL \ - umid=${host} \ - ubda=$UMLHOSTFS \ - \$SWITCH_${host} \ - mem=${MEM}M con=pty con0=fd:0,fd:1" & - cgecho "done" - sleep 15 - fi - let "x0+=dx" - let "y0+=dy" -done - -if [ -z "$BOOTING_HOSTS" ] -then - exit 0 -fi - -cecho " * Waiting for the uml instances to finish booting" - -for host in $BOOTING_HOSTS -do - cecho-n " * Checking on $host.." - - while [ $count -lt $count_max ] && [ ! -d ~/.uml/$host ] - do - cecho-n "." - sleep 5 - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - fi - - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - - while [ $count -lt $count_max ] && [ $up -eq 0 ] - do - cecho-n "." - sleep 5 - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - else - cgecho "up" - fi - - if [ "$host" = "alice" ] - then - sleep 5 - eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" - ssh root@$ipv4_alice /etc/init.d/net.eth1 stop - fi -done - -cecho " * All uml instances are up now" diff --git a/testing/scripts/kstart-umls b/testing/scripts/kstart-umls deleted file mode 100755 index 18dc64a9d..000000000 --- a/testing/scripts/kstart-umls +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash -# starts the UML instances in a konsole (requires KDE) -# -# Copyright (C) 2004 Eric Marchionni, Patrik Rayo -# Zuercher Hochschule Winterthur -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. See . -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. - -DIR=`dirname $0` - -source $DIR/function.sh - -[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found" - -source $DIR/../testing.conf - -if [ "$#" -eq 0 ] -then - HOSTS=$STRONGSWANHOSTS -else - HOSTS=$* -fi - -BOOTING_HOSTS="" -count_max=12 -count=0 - -#position of konsole window on the desktop -x0=8 -y0=8 -dx=12 -dy=24 - -for host in $HOSTS -do - up=0 - - if [ -d ~/.uml/${host} ] - then - pid=`cat ~/.uml/${host}/pid` - up=`ps up $pid | wc -l` - fi - - if [ $up -eq 2 ] - then - cecho " * Great, ${host} is already running!" - else - rm -rf ~/.uml/${host} - BOOTING_HOSTS="$BOOTING_HOSTS ${host}" - let "count_max += 12" - - UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host} - [ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found" - - cecho-n " * Starting ${host}.." - eval konsole -title ${host} --geometry "+${x0}+${y0}" -e "$UMLKERNEL \ - umid=${host} \ - ubda=$UMLHOSTFS \ - \$SWITCH_${host} \ - mem=${MEM}M con=pty con0=fd:0,fd:1" & - cgecho "done" - sleep 15 - fi - let "x0+=dx" - let "y0+=dy" -done - -if [ -z "$BOOTING_HOSTS" ] -then - exit 0 -fi - -cecho " * Waiting for the uml instances to finish booting" - -for host in $BOOTING_HOSTS -do - cecho-n " * Checking on $host.." - - while [ $count -lt $count_max ] && [ ! -d ~/.uml/$host ] - do - cecho-n "." - sleep 5 - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - fi - - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - - while [ $count -lt $count_max ] && [ $up -eq 0 ] - do - cecho-n "." - sleep 5 - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - else - cgecho "up" - fi - - if [ "$host" = "alice" ] - then - sleep 5 - eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" - ssh root@$ipv4_alice /etc/init.d/net.eth1 stop - fi -done - -cecho " * All uml instances are up now" diff --git a/testing/scripts/load-testconfig b/testing/scripts/load-testconfig index 43100dbe0..d73b31275 100755 --- a/testing/scripts/load-testconfig +++ b/testing/scripts/load-testconfig @@ -58,17 +58,16 @@ for host in $IPSECHOSTS do eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" ssh $SSHCONF $HOSTLOGIN 'rm -f /var/log/auth.log /var/log/daemon.log; \ - kill -SIGHUP `cat /var/run/syslogd.pid`' > /dev/null 2>&1 + kill -SIGHUP `cat /var/run/rsyslogd.pid`' > /dev/null 2>&1 done ########################################################################## -# clear radius.log and daemon.log on FreeRadius servers +# clear radius.log on FreeRadius servers # for host in $RADIUSHOSTS do eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" - ssh $SSHCONF $HOSTLOGIN 'rm -f /var/log/radius/radius.log /var/log/daemon.log; \ - kill -SIGHUP `cat /var/run/syslogd.pid`' > /dev/null 2>&1 + ssh $SSHCONF $HOSTLOGIN 'rm -f /var/log/freeradius/radius.log' > /dev/null 2>&1 done diff --git a/testing/scripts/start-umls b/testing/scripts/start-umls index 878494370..470bdc61b 100755 --- a/testing/scripts/start-umls +++ b/testing/scripts/start-umls @@ -42,7 +42,7 @@ do pid=`cat ~/.uml/${host}/pid` up=`ps up $pid | wc -l` fi - + if [ $up -eq 2 ] then cecho " * Great, ${host} is already running!" @@ -51,16 +51,12 @@ do BOOTING_HOSTS="$BOOTING_HOSTS ${host}" let "count_max += 12" - UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host} + UMLHOSTFS=$BUILDDIR/root-fs/${host}.img [ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found" cecho-n " * Starting ${host}.." - eval screen -dmS ${host} "$UMLKERNEL \ - umid=${host} \ - ubda=$UMLHOSTFS \ - \$SWITCH_${host} \ - mem=${MEM}M con=pty con0=fd:0,fd:1" - cgecho "done" + eval setsid $UMLKERNEL umid=${host} ubda=$UMLHOSTFS \$SWITCH_${host} mem=${MEM}M con=null con1=xterm >>$LOGFILE 2>&1 & + cgecho "done" fi done @@ -106,12 +102,6 @@ do cgecho "up" fi - if [ "$host" = "alice" ] - then - sleep 5 - eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" - ssh root@$ipv4_alice /etc/init.d/net.eth1 stop - fi done cecho " * All uml instances are up now" diff --git a/testing/scripts/xstart-umls b/testing/scripts/xstart-umls deleted file mode 100755 index ed2662b6c..000000000 --- a/testing/scripts/xstart-umls +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash -# starts the UML instances in an xterm (requires X11R6) -# -# Copyright (C) 2004 Eric Marchionni, Patrik Rayo -# Zuercher Hochschule Winterthur -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. See . -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. - -DIR=`dirname $0` - -source $DIR/function.sh - -[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found" - -source $DIR/../testing.conf - -if [ "$#" -eq 0 ] -then - HOSTS=$STRONGSWANHOSTS -else - HOSTS=$* -fi - -BOOTING_HOSTS="" -count_max=12 -count=0 - -#position of xterm window on the desktop -x0=8 -y0=8 -dx=12 -dy=24 - -for host in $HOSTS -do - up=0 - - if [ -d ~/.uml/${host} ] - then - pid=`cat ~/.uml/${host}/pid` - up=`ps up $pid | wc -l` - fi - - if [ $up -eq 2 ] - then - cecho " * Great, ${host} is already running!" - else - rm -rf ~/.uml/${host} - BOOTING_HOSTS="$BOOTING_HOSTS ${host}" - let "count_max += 12" - - UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host} - [ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found" - - cecho-n " * Starting ${host}.." - eval xterm -title ${host} -geometry "+${x0}+${y0}" -rightbar -sb -sl 500 -e "$UMLKERNEL \ - umid=${host} \ - ubda=$UMLHOSTFS \ - \$SWITCH_${host} \ - mem=${MEM}M con=pty con0=fd:0,fd:1" & - cgecho "done" - sleep 15 - fi - let "x0+=dx" - let "y0+=dy" -done - -if [ -z "$BOOTING_HOSTS" ] -then - exit 0 -fi - -cecho " * Waiting for the uml instances to finish booting" - -for host in $BOOTING_HOSTS -do - cecho-n " * Checking on $host.." - - while [ $count -lt $count_max ] && [ ! -d ~/.uml/$host ] - do - cecho-n "." - sleep 5 - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - fi - - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - - while [ $count -lt $count_max ] && [ $up -eq 0 ] - do - cecho-n "." - sleep 5 - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - else - cgecho "up" - fi - - if [ "$host" = "alice" ] - then - sleep 5 - eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" - ssh root@$ipv4_alice /etc/init.d/net.eth1 stop - fi -done - -cecho " * All uml instances are up now" diff --git a/testing/start-testing b/testing/start-testing index 278500e6f..ab8b96006 100755 --- a/testing/start-testing +++ b/testing/start-testing @@ -40,27 +40,8 @@ $DIR/scripts/start-bridges ##################################################### # start the uml instances # -case $UMLSTARTMODE in - konsole) - cecho "Start the uml instances (scripts/kstart-umls)" - $DIR/scripts/kstart-umls $HOSTS - ;; - gnome-terminal) - cecho "Start the uml instances (scripts/gstart-umls)" - $DIR/scripts/gstart-umls $HOSTS - ;; - xterm) - cecho "Start the uml instances (scripts/xstart-umls)" - $DIR/scripts/xstart-umls $HOSTS - ;; - screen) - cecho "Start the uml instances (scripts/start-umls)" - $DIR/scripts/start-umls $HOSTS - ;; - *) - die "The start mode is unknown! Please set $UMLSTARTMODE properly." - ;; -esac +cecho "Start the uml instances (scripts/start-umls)" +$DIR/scripts/start-umls $HOSTS ##################################################### diff --git a/testing/testing.conf b/testing/testing.conf index 5f6b0d65e..5cdf7b06e 100755 --- a/testing/testing.conf +++ b/testing/testing.conf @@ -27,7 +27,6 @@ KERNELVERSION=`basename $KERNEL .tar.bz2 | sed -e 's/linux-//'` # Kernel configuration file KERNELCONFIG=$UMLTESTDIR/.config-3.5 - # Bzipped uml patch for kernel UMLPATCH=$UMLTESTDIR/ha-3.0.patch.bz2 @@ -91,12 +90,6 @@ USE_IFMAP="no" USE_CISCO_QUIRKS="no" USE_UNITY="yes" -# Gentoo linux root filesystem -ROOTFS=$UMLTESTDIR/gentoo-fs-20111212.tar.bz2 - -# Size of the finished root filesystem in MB -ROOTFSSIZE=850 - # Amount of Memory to use per UML [MB]. # If "auto" is stated 1/12 of total host ram will be used. # Examples: MEM=64, MEM="128", MEM="auto" @@ -105,6 +98,20 @@ MEM=96 # Directory where the UML kernels and file system will be built BUILDDIR=$UMLTESTDIR/umlbuild +# Logfile +LOGFILE=$BUILDDIR/testing.log + +# Directory used for loop-mounts +LOOPDIR=$BUILDDIR/loop + +# Base image settings +ROOTFSSIZE=950 +ROOTFSSUITE=wheezy +ROOTFSARCH=amd64 +ROOTFS=$BUILDDIR/debian-$ROOTFSSUITE-$ROOTFSARCH.img +ROOTFSMIRROR=http://cdn.debian.net/debian +ROOTFSPW=root + # Filename of the built UML Kernel UMLKERNEL=$BUILDDIR/linux-uml-$KERNELVERSION @@ -126,28 +133,15 @@ TZUML="Europe/Zurich" # Enable particular steps in the make-testing and # start-testing scripts # +ENABLE_BUILD_BASEIMAGE="yes" ENABLE_BUILD_UMLKERNEL="yes" -ENABLE_BUILD_SSHKEYS="yes" -ENABLE_BUILD_HOSTCONFIG="yes" ENABLE_BUILD_UMLROOTFS="yes" +ENABLE_BUILD_HOSTCONFIG="yes" ENABLE_BUILD_UMLHOSTFS="yes" ENABLE_START_TESTING="yes" ENABLE_DO_TESTS="no" ENABLE_STOP_TESTING="no" -############################################################## -# How to start the UMLs? -# -# Start the UML instance in KDE konsole (requires KDE) -# UMLSTARTMODE="konsole" -# Start the UML instance in a gnome-terminal (requires gnome) -UMLSTARTMODE="gnome-terminal" -# Start the UML instance in an xterm (requires X11R6) -# UMLSTARTMODE="xterm" -# Start the UML instance without a terminal window -# but screen -r can open a window anytime -# UMLSTARTMODE="screen" - ############################################################## # If set to "yes" only the tests stated at $SELECTEDTESTS # will be executed. (use "yes" or "no") From e61ce6ee022bf1517e79e2d29a9b2e93ae3342b0 Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Wed, 21 Nov 2012 18:08:24 +0100 Subject: [PATCH 002/106] Factor out building of strongswan into own Makefile Small Makefiles (recipes) are used to install software from source into the root UML image. --- testing/scripts/build-umlrootfs | 349 +++----------------------- testing/scripts/recipes/strongswan.mk | 87 +++++++ testing/testing.conf | 61 +---- 3 files changed, 116 insertions(+), 381 deletions(-) create mode 100644 testing/scripts/recipes/strongswan.mk diff --git a/testing/scripts/build-umlrootfs b/testing/scripts/build-umlrootfs index 647c929ea..2633f1b28 100755 --- a/testing/scripts/build-umlrootfs +++ b/testing/scripts/build-umlrootfs @@ -22,22 +22,10 @@ source $DIR/function.sh source $DIR/../testing.conf -STRONGSWANVERSION=`basename $STRONGSWAN .tar.bz2` - -cecho-n " * Looking for strongSwan at '$STRONGSWAN'.." -if [ -f "$STRONGSWAN" ] -then - cecho "found it" - cecho " * strongSwan version is '$STRONGSWANVERSION'" -else - cecho "none" - exit -fi - cecho-n " * Looking for root image at '$ROOTFS'.." if [ -f "$ROOTFS" ] then - cecho "found it" + cgecho "found it" else cecho "none" exit @@ -68,20 +56,9 @@ BASE=$BUILDDIR/base.img cecho-n " * Mounting base image $BASE.." cp $ROOTFS $BASE mount -o loop $BASE $LOOPDIR >> $LOGFILE 2>&1 +mount -t proc none $LOOPDIR/proc >> $LOGFILE 2>&1 cgecho "done" -###################################################### -# remove /etc/resolv.conf -# -cecho " * Removing /etc/resolv.conf" -rm -f $LOOPDIR/etc/resolv.conf - -##################################################### -# extracting strongSwan into the root filesystem -# -cecho " * Extracting strongSwan into the root filesystem" -tar xjf $STRONGSWAN -C $LOOPDIR/root >> $LOGFILE 2>&1 - ###################################################### # setting up mountpoint for shared source tree # @@ -93,306 +70,35 @@ if [ "${SHAREDTREE+set}" = "set" ]; then fi ###################################################### -# installing strongSwan and setting the local timezone +# install software from source using 'recipes' # +mkdir -p $ROOTFSCOMPILEDIR +cecho " * Mounting $ROOTFSCOMPILEDIR as /root/compile.." +mkdir -p $LOOPDIR/root/compile +mount -o bind $ROOTFSCOMPILEDIR $LOOPDIR/root/compile >> $LOGFILE 2>&1 -INSTALLSHELL=${LOOPDIR}/install.sh +cecho " * Installing software from source.." +RECPDIR=$UMLTESTDIR/testing/scripts/recipes +RECIPES=`ls $RECPDIR/*.mk | xargs -n1 basename` +for r in $RECIPES +do + cecho-n " - $r.." + cp $RECPDIR/$r ${LOOPDIR}/root/compile + chroot ${LOOPDIR} make -C /root/compile -f $r >>$LOGFILE 2>&1 + if [ $? != 0 ]; then + cecho "failed" + else + cgecho "done" + fi +done -cecho " * Preparing strongSwan installation script" -echo "ln -sf /usr/share/zoneinfo/${TZUML} /etc/localtime" >> $INSTALLSHELL +umount $LOOPDIR/root/compile -echo "cd /root/${STRONGSWANVERSION}" >> $INSTALLSHELL -echo -n "./configure --sysconfdir=/etc" >> $INSTALLSHELL -echo -n " --with-random-device=/dev/urandom" >> $INSTALLSHELL -echo -n " --disable-load-warning" >> $INSTALLSHELL - -if [ "$USE_LIBCURL" = "yes" ] -then - echo -n " --enable-curl" >> $INSTALLSHELL -fi - -if [ "$USE_LDAP" = "yes" ] -then - echo -n " --enable-ldap" >> $INSTALLSHELL -fi - -if [ "$USE_EAP_AKA" = "yes" ] -then - echo -n " --enable-eap-aka" >> $INSTALLSHELL - echo -n " --enable-eap-aka-3gpp2" >> $INSTALLSHELL -fi - -if [ "$USE_EAP_SIM" = "yes" ] -then - echo -n " --enable-eap-sim" >> $INSTALLSHELL - echo -n " --enable-eap-sim-file" >> $INSTALLSHELL -fi - -if [ "$USE_EAP_MD5" = "yes" ] -then - echo -n " --enable-eap-md5" >> $INSTALLSHELL -fi - -if [ "$USE_EAP_MSCHAPV2" = "yes" ] -then - echo -n " --enable-md4" >> $INSTALLSHELL - echo -n " --enable-eap-mschapv2" >> $INSTALLSHELL -fi - -if [ "$USE_EAP_IDENTITY" = "yes" ] -then - echo -n " --enable-eap-identity" >> $INSTALLSHELL -fi - -if [ "$USE_EAP_RADIUS" = "yes" ] -then - echo -n " --enable-eap-radius" >> $INSTALLSHELL -fi - -if [ "$USE_EAP_DYNAMIC" = "yes" ] -then - echo -n " --enable-eap-dynamic" >> $INSTALLSHELL -fi - -if [ "$USE_EAP_TLS" = "yes" ] -then - echo -n " --enable-eap-tls" >> $INSTALLSHELL -fi - -if [ "$USE_EAP_TTLS" = "yes" ] -then - echo -n " --enable-eap-ttls" >> $INSTALLSHELL -fi - -if [ "$USE_EAP_PEAP" = "yes" ] -then - echo -n " --enable-eap-peap" >> $INSTALLSHELL -fi - -if [ "$USE_EAP_TNC" = "yes" ] -then - echo -n " --enable-eap-tnc" >> $INSTALLSHELL -fi - -if [ "$USE_TNC_PDP" = "yes" ] -then - echo -n " --enable-tnc-pdp" >> $INSTALLSHELL -fi - -if [ "$USE_TNC_IMC" = "yes" ] -then - echo -n " --enable-tnc-imc" >> $INSTALLSHELL -fi - -if [ "$USE_TNC_IMV" = "yes" ] -then - echo -n " --enable-tnc-imv" >> $INSTALLSHELL -fi - -if [ "$USE_TNCCS_11" = "yes" ] -then - echo -n " --enable-tnccs-11" >> $INSTALLSHELL -fi - -if [ "$USE_TNCCS_20" = "yes" ] -then - echo -n " --enable-tnccs-20" >> $INSTALLSHELL -fi - -if [ "$USE_TNCCS_DYNAMIC" = "yes" ] -then - echo -n " --enable-tnccs-dynamic" >> $INSTALLSHELL -fi - -if [ "$USE_IMC_TEST" = "yes" ] -then - echo -n " --enable-imc-test" >> $INSTALLSHELL -fi - -if [ "$USE_IMV_TEST" = "yes" ] -then - echo -n " --enable-imv-test" >> $INSTALLSHELL -fi - -if [ "$USE_IMC_SCANNER" = "yes" ] -then - echo -n " --enable-imc-scanner" >> $INSTALLSHELL -fi - -if [ "$USE_IMV_SCANNER" = "yes" ] -then - echo -n " --enable-imv-scanner" >> $INSTALLSHELL -fi - -if [ "$USE_IMC_OS" = "yes" ] -then - echo -n " --enable-imc-os" >> $INSTALLSHELL -fi - -if [ "$USE_IMV_OS" = "yes" ] -then - echo -n " --enable-imv-os" >> $INSTALLSHELL -fi - -if [ "$USE_IMC_ATTESTATION" = "yes" ] -then - echo -n " --enable-imc-attestation" >> $INSTALLSHELL -fi - -if [ "$USE_IMV_ATTESTATION" = "yes" ] -then - echo -n " --enable-imv-attestation" >> $INSTALLSHELL -fi - -if [ "$USE_SQL" = "yes" ] -then - echo -n " --enable-sql --enable-sqlite" >> $INSTALLSHELL - fi - -if [ "$USE_MEDIATION" = "yes" ] -then - echo -n " --enable-mediation" >> $INSTALLSHELL -fi - -if [ "$USE_OPENSSL" = "yes" ] -then - echo -n " --enable-openssl" >> $INSTALLSHELL -fi - -if [ "$USE_BLOWFISH" = "yes" ] -then - echo -n " --enable-blowfish" >> $INSTALLSHELL -fi - -if [ "$USE_KERNEL_PFKEY" = "yes" ] -then - echo -n " --enable-kernel-pfkey" >> $INSTALLSHELL -fi - -if [ "$USE_INTEGRITY_TEST" = "yes" ] -then - echo -n " --enable-integrity-test" >> $INSTALLSHELL -fi - -if [ "$USE_LEAK_DETECTIVE" = "yes" ] -then - echo -n " --enable-leak-detective" >> $INSTALLSHELL -fi - -if [ "$USE_LOAD_TESTER" = "yes" ] -then - echo -n " --enable-load-tester" >> $INSTALLSHELL -fi - -if [ "$USE_TEST_VECTORS" = "yes" ] -then - echo -n " --enable-test-vectors" >> $INSTALLSHELL -fi - -if [ "$USE_GCRYPT" = "yes" ] -then - echo -n " --enable-gcrypt" >> $INSTALLSHELL -fi - -if [ "$USE_SOCKET_DEFAULT" = "yes" ] -then - echo -n " --enable-socket-default" >> $INSTALLSHELL -fi - -if [ "$USE_SOCKET_DYNAMIC" = "yes" ] -then - echo -n " --enable-socket-dynamic" >> $INSTALLSHELL -fi - -if [ "$USE_DHCP" = "yes" ] -then - echo -n " --enable-dhcp" >> $INSTALLSHELL -fi - -if [ "$USE_FARP" = "yes" ] -then - echo -n " --enable-farp" >> $INSTALLSHELL -fi - -if [ "$USE_ADDRBLOCK" = "yes" ] -then - echo -n " --enable-addrblock" >> $INSTALLSHELL -fi - -if [ "$USE_CTR" = "yes" ] -then - echo -n " --enable-ctr" >> $INSTALLSHELL -fi - -if [ "$USE_CCM" = "yes" ] -then - echo -n " --enable-ccm" >> $INSTALLSHELL -fi - -if [ "$USE_GCM" = "yes" ] -then - echo -n " --enable-gcm" >> $INSTALLSHELL -fi - -if [ "$USE_CMAC" = "yes" ] -then - echo -n " --enable-cmac" >> $INSTALLSHELL -fi - -if [ "$USE_HA" = "yes" ] -then - echo -n " --enable-ha" >> $INSTALLSHELL -fi - -if [ "$USE_AF_ALG" = "yes" ] -then - echo -n " --enable-af-alg" >> $INSTALLSHELL -fi - -if [ "$USE_WHITELIST" = "yes" ] -then - echo -n " --enable-whitelist" >> $INSTALLSHELL -fi - -if [ "$USE_XAUTH_GENERIC" = "yes" ] -then - echo -n " --enable-xauth-generic" >> $INSTALLSHELL -fi - -if [ "$USE_XAUTH_EAP" = "yes" ] -then - echo -n " --enable-xauth-eap" >> $INSTALLSHELL -fi - -if [ "$USE_PKCS8" = "yes" ] -then - echo -n " --enable-pkcs8" >> $INSTALLSHELL -fi - -if [ "$USE_IFMAP" = "yes" ] -then - echo -n " --enable-tnc-ifmap" >> $INSTALLSHELL -fi - -if [ "$USE_CISCO_QUIRKS" = "yes" ] -then - echo -n " --enable-cisco-quirks" >> $INSTALLSHELL -fi - -if [ "$USE_UNITY" = "yes" ] -then - echo -n " --enable-unity" >> $INSTALLSHELL -fi - -echo "" >> $INSTALLSHELL -echo "make -j5" >> $INSTALLSHELL -echo "make install" >> $INSTALLSHELL -echo "ldconfig" >> $INSTALLSHELL - -cecho-n " * Compiling $STRONGSWANVERSION within the root file system as chroot.." -chroot $LOOPDIR /bin/bash /install.sh >> $LOGFILE 2>&1 -rm -f $INSTALLSHELL -cgecho "done" +###################################################### +# remove /etc/resolv.conf +# +cecho " * Removing /etc/resolv.conf" +rm -f $LOOPDIR/etc/resolv.conf ##################################### # preparing ssh for PK authentication @@ -456,4 +162,5 @@ do echo "`cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub` root@$host" >> $LOOPDIR/root/.ssh/authorized_keys done +umount $LOOPDIR/proc umount $LOOPDIR diff --git a/testing/scripts/recipes/strongswan.mk b/testing/scripts/recipes/strongswan.mk new file mode 100644 index 000000000..4b8263112 --- /dev/null +++ b/testing/scripts/recipes/strongswan.mk @@ -0,0 +1,87 @@ +#!/usr/bin/make + +PV = 5.0.1 +PKG = strongswan-$(PV) +TAR = $(PKG).tar.bz2 +SRC = http://download.strongswan.org/$(TAR) + +NUM_CPUS := $(shell getconf _NPROCESSORS_ONLN) + +CONFIG_OPTS = \ + --sysconfdir=/etc \ + --with-random-device=/dev/urandom \ + --disable-load-warning \ + --enable-curl \ + --enable-ldap \ + --enable-eap-aka \ + --enable-eap-aka-3gpp2 \ + --enable-eap-sim \ + --enable-eap-sim-file \ + --enable-eap-md5 \ + --enable-md4 \ + --enable-eap-mschapv2 \ + --enable-eap-identity \ + --enable-eap-radius \ + --enable-eap-dynamic \ + --enable-eap-tls \ + --enable-eap-ttls \ + --enable-eap-peap \ + --enable-eap-tnc \ + --enable-tnc-pdp \ + --enable-tnc-imc \ + --enable-tnc-imv \ + --enable-tnccs-11 \ + --enable-tnccs-20 \ + --enable-tnccs-dynamic \ + --enable-imc-test \ + --enable-imv-test \ + --enable-imc-scanner \ + --enable-imv-scanner \ + --enable-imc-os \ + --enable-imv-os \ + --enable-imc-attestation \ + --enable-imv-attestation \ + --enable-sql \ + --enable-sqlite \ + --enable-mediation \ + --enable-openssl \ + --enable-blowfish \ + --enable-kernel-pfkey \ + --enable-integrity-test \ + --enable-leak-detective \ + --enable-load-tester \ + --enable-test-vectors \ + --enable-gcrypt \ + --enable-socket-default \ + --enable-socket-dynamic \ + --enable-dhcp \ + --enable-farp \ + --enable-addrblock \ + --enable-ctr \ + --enable-ccm \ + --enable-gcm \ + --enable-cmac \ + --enable-ha \ + --enable-af-alg \ + --enable-whitelist \ + --enable-xauth-generic \ + --enable-xauth-eap \ + --enable-pkcs8 \ + --enable-unity + +all: install + +$(TAR): + wget $(SRC) + +$(PKG): $(TAR) + tar xfj $(TAR) + +configure: $(PKG) + cd $(PKG) && ./configure $(CONFIG_OPTS) + +build: configure + cd $(PKG) && make -j $(NUM_CPUS) + +install: build + cd $(PKG) && make install diff --git a/testing/testing.conf b/testing/testing.conf index 5cdf7b06e..7a4998bd6 100755 --- a/testing/testing.conf +++ b/testing/testing.conf @@ -30,66 +30,6 @@ KERNELCONFIG=$UMLTESTDIR/.config-3.5 # Bzipped uml patch for kernel UMLPATCH=$UMLTESTDIR/ha-3.0.patch.bz2 -# Bzipped source of strongSwan -STRONGSWAN=$UMLTESTDIR/strongswan-5.0.1.tar.bz2 - -# strongSwan compile options (use "yes" or "no") -USE_LIBCURL="yes" -USE_LDAP="yes" -USE_EAP_AKA="yes" -USE_EAP_SIM="yes" -USE_EAP_MD5="yes" -USE_EAP_MSCHAPV2="yes" -USE_EAP_IDENTITY="yes" -USE_EAP_RADIUS="yes" -USE_EAP_DYNAMIC="yes" -USE_EAP_TLS="yes" -USE_EAP_TTLS="yes" -USE_EAP_PEAP="yes" -USE_EAP_TNC="yes" -USE_TNC_PDP="yes" -USE_TNC_IMC="yes" -USE_TNC_IMV="yes" -USE_TNCCS_11="yes" -USE_TNCCS_20="yes" -USE_TNCCS_DYNAMIC="yes" -USE_IMC_TEST="yes" -USE_IMV_TEST="yes" -USE_IMC_SCANNER="yes" -USE_IMV_SCANNER="yes" -USE_IMC_OS="yes" -USE_IMV_OS="yes" -USE_IMC_ATTESTATION="yes" -USE_IMV_ATTESTATION="yes" -USE_SQL="yes" -USE_MEDIATION="yes" -USE_OPENSSL="yes" -USE_BLOWFISH="yes" -USE_KERNEL_PFKEY="yes" -USE_INTEGRITY_TEST="yes" -USE_LEAK_DETECTIVE="yes" -USE_LOAD_TESTER="yes" -USE_TEST_VECTORS="yes" -USE_GCRYPT="yes" -USE_SOCKET_DEFAULT="yes" -USE_SOCKET_DYNAMIC="yes" -USE_DHCP="yes" -USE_FARP="yes" -USE_ADDRBLOCK="yes" -USE_CTR="yes" -USE_CCM="yes" -USE_GCM="yes" -USE_CMAC="yes" -USE_HA="yes" -USE_AF_ALG="yes" -USE_WHITELIST="yes" -USE_XAUTH_GENERIC="yes" -USE_XAUTH_EAP="yes" -USE_PKCS8="yes" -USE_IFMAP="no" -USE_CISCO_QUIRKS="no" -USE_UNITY="yes" - # Amount of Memory to use per UML [MB]. # If "auto" is stated 1/12 of total host ram will be used. # Examples: MEM=64, MEM="128", MEM="auto" @@ -111,6 +51,7 @@ ROOTFSARCH=amd64 ROOTFS=$BUILDDIR/debian-$ROOTFSSUITE-$ROOTFSARCH.img ROOTFSMIRROR=http://cdn.debian.net/debian ROOTFSPW=root +ROOTFSCOMPILEDIR=$BUILDDIR/compile # Filename of the built UML Kernel UMLKERNEL=$BUILDDIR/linux-uml-$KERNELVERSION From adbb5cbd43f5790316de7a71031307b66a7eafe8 Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Wed, 21 Nov 2012 18:39:08 +0100 Subject: [PATCH 003/106] Add freeradius recipe --- testing/scripts/recipes/freeradius.mk | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 testing/scripts/recipes/freeradius.mk diff --git a/testing/scripts/recipes/freeradius.mk b/testing/scripts/recipes/freeradius.mk new file mode 100644 index 000000000..89e25c090 --- /dev/null +++ b/testing/scripts/recipes/freeradius.mk @@ -0,0 +1,32 @@ +#!/usr/bin/make + +PV = 2.2.0 +PKG = freeradius-server-$(PV) +TAR = $(PKG).tar.bz2 +SRC = ftp://ftp.freeradius.org/pub/freeradius/$(TAR) + +NUM_CPUS := $(shell getconf _NPROCESSORS_ONLN) + +CONFIG_OPTS = \ + --with-raddbdir=/etc/freeradius \ + --sysconfdir=/etc \ + --with-logdir=/var/log/freeradius \ + --enable-developer \ + --with-experimental-modules + +all: install + +$(TAR): + wget $(SRC) + +$(PKG): $(TAR) + tar xfj $(TAR) + +configure: $(PKG) + cd $(PKG) && ./configure $(CONFIG_OPTS) + +build: configure + cd $(PKG) && make -j $(NUM_CPUS) + +install: build + cd $(PKG) && make install From 108040800d276f544995224e031bc64c9cb138d6 Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Wed, 21 Nov 2012 18:42:57 +0100 Subject: [PATCH 004/106] Add recipe for iptables --- testing/scripts/recipes/iptables.mk | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 testing/scripts/recipes/iptables.mk diff --git a/testing/scripts/recipes/iptables.mk b/testing/scripts/recipes/iptables.mk new file mode 100644 index 000000000..80765445d --- /dev/null +++ b/testing/scripts/recipes/iptables.mk @@ -0,0 +1,27 @@ +#!/usr/bin/make + +PV = 1.4.16.3 +PKG = iptables-$(PV) +TAR = $(PKG).tar.bz2 +SRC = http://www.netfilter.org/projects/iptables/files/$(TAR) + +NUM_CPUS := $(shell getconf _NPROCESSORS_ONLN) + +CONFIG_OPTS = + +all: install + +$(TAR): + wget $(SRC) + +$(PKG): $(TAR) + tar xfj $(TAR) + +configure: $(PKG) + cd $(PKG) && ./configure $(CONFIG_OPTS) + +build: configure + cd $(PKG) && make -j $(NUM_CPUS) + +install: build + cd $(PKG) && make install From 766466b8d114e6e594955198fa848536b8fd88ae Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Mon, 19 Nov 2012 17:17:38 +0100 Subject: [PATCH 005/106] Adapt host configuration Adapt the configuration of the test hosts to the new Debian-based system. --- testing/hosts/alice/etc/conf.d/hostname | 1 - testing/hosts/alice/etc/conf.d/net | 12 - .../hosts/alice/etc/freeradius/clients.conf | 4 + testing/hosts/alice/etc/freeradius/dictionary | 32 + .../hosts/alice/etc/freeradius/radiusd.conf | 120 ++ testing/hosts/alice/etc/hostname | 1 + testing/hosts/alice/etc/init.d/iptables | 74 -- testing/hosts/alice/etc/init.d/net.eth0 | 1124 ----------------- testing/hosts/alice/etc/init.d/net.eth1 | 1124 ----------------- testing/hosts/alice/etc/init.d/radiusd | 64 - testing/hosts/alice/etc/ipsec.conf | 2 +- testing/hosts/alice/etc/network/interfaces | 20 + .../alice/etc/runlevels/default/net.eth0 | 1124 ----------------- testing/hosts/bob/etc/conf.d/hostname | 1 - testing/hosts/bob/etc/conf.d/net | 10 - testing/hosts/bob/etc/hostname | 1 + testing/hosts/bob/etc/init.d/iptables | 74 -- testing/hosts/bob/etc/init.d/net.eth0 | 1124 ----------------- testing/hosts/bob/etc/ipsec.conf | 0 testing/hosts/bob/etc/network/interfaces | 12 + .../hosts/bob/etc/runlevels/default/net.eth0 | 1124 ----------------- testing/hosts/carol/etc/conf.d/hostname | 1 - testing/hosts/carol/etc/conf.d/net | 10 - testing/hosts/carol/etc/hostname | 1 + testing/hosts/carol/etc/init.d/iptables | 77 -- testing/hosts/carol/etc/init.d/net.eth0 | 1124 ----------------- testing/hosts/carol/etc/ipsec.conf | 4 +- testing/hosts/carol/etc/network/interfaces | 12 + .../carol/etc/runlevels/default/net.eth0 | 1124 ----------------- testing/hosts/dave/etc/conf.d/hostname | 1 - testing/hosts/dave/etc/conf.d/net | 10 - testing/hosts/dave/etc/hostname | 1 + testing/hosts/dave/etc/init.d/iptables | 77 -- testing/hosts/dave/etc/init.d/net.eth0 | 1124 ----------------- testing/hosts/dave/etc/ipsec.conf | 4 +- testing/hosts/dave/etc/network/interfaces | 12 + .../hosts/dave/etc/runlevels/default/net.eth0 | 1124 ----------------- testing/hosts/default/etc/default/slapd | 45 + testing/hosts/default/etc/iptables.flush | 21 + testing/hosts/default/etc/iptables.rules | 24 + testing/hosts/default/etc/rsyslog.conf | 125 ++ .../hosts/default/etc/security/limits.conf | 58 + testing/hosts/default/etc/sysctl.conf | 60 + testing/hosts/moon/etc/conf.d/hostname | 1 - testing/hosts/moon/etc/conf.d/net | 12 - testing/hosts/moon/etc/hostname | 1 + testing/hosts/moon/etc/init.d/iptables | 80 -- testing/hosts/moon/etc/init.d/net.eth0 | 1124 ----------------- testing/hosts/moon/etc/init.d/net.eth1 | 1124 ----------------- testing/hosts/moon/etc/ipsec.conf | 8 +- testing/hosts/moon/etc/network/interfaces | 21 + .../hosts/moon/etc/runlevels/default/net.eth0 | 1124 ----------------- .../hosts/moon/etc/runlevels/default/net.eth1 | 1124 ----------------- testing/hosts/ssh_host_rsa_key.pub | 1 - testing/hosts/sun/etc/conf.d/hostname | 1 - testing/hosts/sun/etc/conf.d/net | 14 - testing/hosts/sun/etc/hostname | 1 + testing/hosts/sun/etc/init.d/iptables | 80 -- testing/hosts/sun/etc/init.d/net.eth0 | 1124 ----------------- testing/hosts/sun/etc/init.d/net.eth1 | 1124 ----------------- testing/hosts/sun/etc/ipsec.conf | 6 +- testing/hosts/sun/etc/network/interfaces | 21 + .../hosts/sun/etc/runlevels/default/net.eth0 | 1124 ----------------- .../hosts/sun/etc/runlevels/default/net.eth1 | 1124 ----------------- testing/hosts/venus/etc/conf.d/hostname | 1 - testing/hosts/venus/etc/conf.d/net | 10 - testing/hosts/venus/etc/hostname | 1 + testing/hosts/venus/etc/init.d/iptables | 74 -- testing/hosts/venus/etc/init.d/net.eth0 | 1124 ----------------- testing/hosts/venus/etc/ipsec.conf | 2 +- testing/hosts/venus/etc/network/interfaces | 12 + .../venus/etc/runlevels/default/net.eth0 | 1124 ----------------- .../etc/apache2/conf.d/testresults-as-text | 1 + .../winnetou/etc/apache2/conf/ssl/ca.crt | 22 - .../winnetou/etc/apache2/conf/ssl/server.crt | 24 - .../winnetou/etc/apache2/conf/ssl/server.key | 27 - .../etc/apache2/modules.d/00_mod_mime.conf | 61 - .../001-ocsp_vhost} | 2 + testing/hosts/winnetou/etc/conf.d/hostname | 1 - testing/hosts/winnetou/etc/conf.d/net | 10 - testing/hosts/winnetou/etc/conf.d/slapd | 8 - testing/hosts/winnetou/etc/init.d/apache2 | 121 -- testing/hosts/winnetou/etc/init.d/net.eth0 | 1124 ----------------- testing/hosts/winnetou/etc/init.d/slapd | 25 - .../winnetou/etc/{openldap => ldap}/ldif.txt | 3 +- testing/hosts/winnetou/etc/ldap/slapd.conf | 23 + testing/hosts/winnetou/etc/network/interfaces | 12 + .../hosts/winnetou/etc/openldap/slapd.conf | 68 - .../hosts/winnetou/etc/openssl/generate-crl | 18 +- .../hosts/winnetou/etc/openssl/ocsp/ocsp.cgi | 8 +- .../etc/openssl/research/ocsp/ocsp.cgi | 8 +- .../winnetou/etc/openssl/sales/ocsp/ocsp.cgi | 8 +- .../winnetou/etc/runlevels/default/apache2 | 121 -- .../winnetou/etc/runlevels/default/net.eth0 | 1124 ----------------- 94 files changed, 680 insertions(+), 24813 deletions(-) delete mode 100644 testing/hosts/alice/etc/conf.d/hostname delete mode 100644 testing/hosts/alice/etc/conf.d/net create mode 100644 testing/hosts/alice/etc/freeradius/clients.conf create mode 100644 testing/hosts/alice/etc/freeradius/dictionary create mode 100644 testing/hosts/alice/etc/freeradius/radiusd.conf create mode 100644 testing/hosts/alice/etc/hostname delete mode 100755 testing/hosts/alice/etc/init.d/iptables delete mode 100755 testing/hosts/alice/etc/init.d/net.eth0 delete mode 100755 testing/hosts/alice/etc/init.d/net.eth1 delete mode 100755 testing/hosts/alice/etc/init.d/radiusd mode change 100755 => 100644 testing/hosts/alice/etc/ipsec.conf create mode 100644 testing/hosts/alice/etc/network/interfaces delete mode 100755 testing/hosts/alice/etc/runlevels/default/net.eth0 delete mode 100644 testing/hosts/bob/etc/conf.d/hostname delete mode 100644 testing/hosts/bob/etc/conf.d/net create mode 100644 testing/hosts/bob/etc/hostname delete mode 100755 testing/hosts/bob/etc/init.d/iptables delete mode 100755 testing/hosts/bob/etc/init.d/net.eth0 mode change 100755 => 100644 testing/hosts/bob/etc/ipsec.conf create mode 100644 testing/hosts/bob/etc/network/interfaces delete mode 100755 testing/hosts/bob/etc/runlevels/default/net.eth0 delete mode 100644 testing/hosts/carol/etc/conf.d/hostname delete mode 100644 testing/hosts/carol/etc/conf.d/net create mode 100644 testing/hosts/carol/etc/hostname delete mode 100755 testing/hosts/carol/etc/init.d/iptables delete mode 100755 testing/hosts/carol/etc/init.d/net.eth0 mode change 100755 => 100644 testing/hosts/carol/etc/ipsec.conf create mode 100644 testing/hosts/carol/etc/network/interfaces delete mode 100755 testing/hosts/carol/etc/runlevels/default/net.eth0 delete mode 100644 testing/hosts/dave/etc/conf.d/hostname delete mode 100644 testing/hosts/dave/etc/conf.d/net create mode 100644 testing/hosts/dave/etc/hostname delete mode 100755 testing/hosts/dave/etc/init.d/iptables delete mode 100755 testing/hosts/dave/etc/init.d/net.eth0 mode change 100755 => 100644 testing/hosts/dave/etc/ipsec.conf create mode 100644 testing/hosts/dave/etc/network/interfaces delete mode 100755 testing/hosts/dave/etc/runlevels/default/net.eth0 create mode 100644 testing/hosts/default/etc/default/slapd create mode 100644 testing/hosts/default/etc/iptables.flush create mode 100644 testing/hosts/default/etc/iptables.rules create mode 100644 testing/hosts/default/etc/rsyslog.conf create mode 100644 testing/hosts/default/etc/security/limits.conf create mode 100644 testing/hosts/default/etc/sysctl.conf delete mode 100644 testing/hosts/moon/etc/conf.d/hostname delete mode 100644 testing/hosts/moon/etc/conf.d/net create mode 100644 testing/hosts/moon/etc/hostname delete mode 100755 testing/hosts/moon/etc/init.d/iptables delete mode 100755 testing/hosts/moon/etc/init.d/net.eth0 delete mode 100755 testing/hosts/moon/etc/init.d/net.eth1 mode change 100755 => 100644 testing/hosts/moon/etc/ipsec.conf create mode 100644 testing/hosts/moon/etc/network/interfaces delete mode 100755 testing/hosts/moon/etc/runlevels/default/net.eth0 delete mode 100755 testing/hosts/moon/etc/runlevels/default/net.eth1 delete mode 100644 testing/hosts/ssh_host_rsa_key.pub delete mode 100644 testing/hosts/sun/etc/conf.d/hostname delete mode 100644 testing/hosts/sun/etc/conf.d/net create mode 100644 testing/hosts/sun/etc/hostname delete mode 100755 testing/hosts/sun/etc/init.d/iptables delete mode 100755 testing/hosts/sun/etc/init.d/net.eth0 delete mode 100755 testing/hosts/sun/etc/init.d/net.eth1 mode change 100755 => 100644 testing/hosts/sun/etc/ipsec.conf create mode 100644 testing/hosts/sun/etc/network/interfaces delete mode 100755 testing/hosts/sun/etc/runlevels/default/net.eth0 delete mode 100755 testing/hosts/sun/etc/runlevels/default/net.eth1 delete mode 100644 testing/hosts/venus/etc/conf.d/hostname delete mode 100644 testing/hosts/venus/etc/conf.d/net create mode 100644 testing/hosts/venus/etc/hostname delete mode 100755 testing/hosts/venus/etc/init.d/iptables delete mode 100755 testing/hosts/venus/etc/init.d/net.eth0 mode change 100755 => 100644 testing/hosts/venus/etc/ipsec.conf create mode 100644 testing/hosts/venus/etc/network/interfaces delete mode 100755 testing/hosts/venus/etc/runlevels/default/net.eth0 create mode 100644 testing/hosts/winnetou/etc/apache2/conf.d/testresults-as-text delete mode 100644 testing/hosts/winnetou/etc/apache2/conf/ssl/ca.crt delete mode 100644 testing/hosts/winnetou/etc/apache2/conf/ssl/server.crt delete mode 100644 testing/hosts/winnetou/etc/apache2/conf/ssl/server.key delete mode 100644 testing/hosts/winnetou/etc/apache2/modules.d/00_mod_mime.conf rename testing/hosts/winnetou/etc/apache2/{vhosts.d/01_ocsp_vhost.conf => sites-enabled/001-ocsp_vhost} (98%) delete mode 100644 testing/hosts/winnetou/etc/conf.d/hostname delete mode 100644 testing/hosts/winnetou/etc/conf.d/net delete mode 100644 testing/hosts/winnetou/etc/conf.d/slapd delete mode 100755 testing/hosts/winnetou/etc/init.d/apache2 delete mode 100755 testing/hosts/winnetou/etc/init.d/net.eth0 delete mode 100755 testing/hosts/winnetou/etc/init.d/slapd rename testing/hosts/winnetou/etc/{openldap => ldap}/ldif.txt (99%) create mode 100644 testing/hosts/winnetou/etc/ldap/slapd.conf create mode 100644 testing/hosts/winnetou/etc/network/interfaces delete mode 100644 testing/hosts/winnetou/etc/openldap/slapd.conf delete mode 100755 testing/hosts/winnetou/etc/runlevels/default/apache2 delete mode 100755 testing/hosts/winnetou/etc/runlevels/default/net.eth0 diff --git a/testing/hosts/alice/etc/conf.d/hostname b/testing/hosts/alice/etc/conf.d/hostname deleted file mode 100644 index 2012e0451..000000000 --- a/testing/hosts/alice/etc/conf.d/hostname +++ /dev/null @@ -1 +0,0 @@ -HOSTNAME=alice diff --git a/testing/hosts/alice/etc/conf.d/net b/testing/hosts/alice/etc/conf.d/net deleted file mode 100644 index 41e8887c4..000000000 --- a/testing/hosts/alice/etc/conf.d/net +++ /dev/null @@ -1,12 +0,0 @@ -# /etc/conf.d/net: - -# This is basically the ifconfig argument without the ifconfig $iface -# -config_eth0=( "PH_IP_ALICE broadcast 10.1.255.255 netmask 255.255.0.0" - "PH_IP6_ALICE/16" ) -config_eth1=( "PH_IP_ALICE1 broadcast 192.168.0.255 netmask 255.255.255.0" - "PH_IP6_ALICE1/16" ) - -# For setting the default gateway -# -routes_eth0=( "default via PH_IP_MOON1" ) diff --git a/testing/hosts/alice/etc/freeradius/clients.conf b/testing/hosts/alice/etc/freeradius/clients.conf new file mode 100644 index 000000000..5fb47a2ad --- /dev/null +++ b/testing/hosts/alice/etc/freeradius/clients.conf @@ -0,0 +1,4 @@ +client 10.1.0.1 { + secret = gv6URkSs + shortname = moon +} diff --git a/testing/hosts/alice/etc/freeradius/dictionary b/testing/hosts/alice/etc/freeradius/dictionary new file mode 100644 index 000000000..59a874b3e --- /dev/null +++ b/testing/hosts/alice/etc/freeradius/dictionary @@ -0,0 +1,32 @@ +# +# This is the master dictionary file, which references the +# pre-defined dictionary files included with the server. +# +# Any new/changed attributes MUST be placed in this file, as +# the pre-defined dictionaries SHOULD NOT be edited. +# +# $Id$ +# + +# +# The filename given here should be an absolute path. +# +$INCLUDE /usr/local/share/freeradius/dictionary + +# +# Place additional attributes or $INCLUDEs here. They will +# over-ride the definitions in the pre-defined dictionaries. +# +# See the 'man' page for 'dictionary' for information on +# the format of the dictionary files. + +# +# If you want to add entries to the dictionary file, +# which are NOT going to be placed in a RADIUS packet, +# add them here. The numbers you pick should be between +# 3000 and 4000. +# + +#ATTRIBUTE My-Local-String 3000 string +#ATTRIBUTE My-Local-IPAddr 3001 ipaddr +#ATTRIBUTE My-Local-Integer 3002 integer diff --git a/testing/hosts/alice/etc/freeradius/radiusd.conf b/testing/hosts/alice/etc/freeradius/radiusd.conf new file mode 100644 index 000000000..e4f721738 --- /dev/null +++ b/testing/hosts/alice/etc/freeradius/radiusd.conf @@ -0,0 +1,120 @@ +# radiusd.conf -- FreeRADIUS server configuration file. + +prefix = /usr +exec_prefix = ${prefix} +sysconfdir = /etc +localstatedir = /var +sbindir = ${exec_prefix}/sbin +logdir = ${localstatedir}/log/freeradius +raddbdir = ${sysconfdir}/freeradius +radacctdir = ${logdir}/radacct + +# name of the running server. See also the "-n" command-line option. +name = freeradius + +# Location of config and logfiles. +confdir = ${raddbdir} +run_dir = ${localstatedir}/run + +# Should likely be ${localstatedir}/lib/radiusd +db_dir = ${raddbdir} + +# libdir: Where to find the rlm_* modules. +libdir = ${exec_prefix}/lib + +# pidfile: Where to place the PID of the RADIUS server. +pidfile = ${run_dir}/${name}.pid + +# max_request_time: The maximum time (in seconds) to handle a request. +max_request_time = 30 + +# cleanup_delay: The time to wait (in seconds) before cleaning up +cleanup_delay = 5 + +# max_requests: The maximum number of requests which the server keeps +max_requests = 1024 + +# listen: Make the server listen on a particular IP address, and send +listen { + type = auth + ipaddr = 10.1.0.10 + port = 0 +} + +# This second "listen" section is for listening on the accounting +# port, too. +# +listen { + type = acct + ipaddr = 10.1.0.10 + port = 0 +} + +# hostname_lookups: Log the names of clients or just their IP addresses +hostname_lookups = no + +# Core dumps are a bad thing. This should only be set to 'yes' +allow_core_dumps = no + +# Regular expressions +regular_expressions = yes +extended_expressions = yes + +# Logging section. The various "log_*" configuration items +log { + destination = files + file = ${logdir}/radius.log + syslog_facility = daemon + stripped_names = no + auth = yes + auth_badpass = yes + auth_goodpass = yes +} + +# The program to execute to do concurrency checks. +checkrad = ${sbindir}/checkrad + +# Security considerations +security { + max_attributes = 200 + reject_delay = 1 + status_server = yes +} + +# PROXY CONFIGURATION +proxy_requests = yes +$INCLUDE proxy.conf + +# CLIENTS CONFIGURATION +$INCLUDE clients.conf + +# THREAD POOL CONFIGURATION +thread pool { + start_servers = 5 + max_servers = 32 + min_spare_servers = 3 + max_spare_servers = 10 + max_requests_per_server = 0 +} + +# MODULE CONFIGURATION +modules { + $INCLUDE ${confdir}/modules/ + $INCLUDE eap.conf + $INCLUDE sql.conf + $INCLUDE sql/mysql/counter.conf +} + +# Instantiation +instantiate { + exec + expr + expiration + logintime +} + +# Policies +$INCLUDE policy.conf + +# Include all enabled virtual hosts +$INCLUDE sites-enabled/ diff --git a/testing/hosts/alice/etc/hostname b/testing/hosts/alice/etc/hostname new file mode 100644 index 000000000..c9fc40bfb --- /dev/null +++ b/testing/hosts/alice/etc/hostname @@ -0,0 +1 @@ +alice diff --git a/testing/hosts/alice/etc/init.d/iptables b/testing/hosts/alice/etc/init.d/iptables deleted file mode 100755 index 1097ac5a4..000000000 --- a/testing/hosts/alice/etc/init.d/iptables +++ /dev/null @@ -1,74 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -opts="start stop reload" - -depend() { - before net - need logger -} - -start() { - ebegin "Starting firewall" - - # default policy is DROP - /sbin/iptables -P INPUT DROP - /sbin/iptables -P OUTPUT DROP - /sbin/iptables -P FORWARD DROP - - # allow IKE - iptables -A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT - iptables -A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT - - # allow NAT-T - iptables -A INPUT -i eth0 -p udp --sport 4500 --dport 4500 -j ACCEPT - iptables -A OUTPUT -o eth0 -p udp --dport 4500 --sport 4500 -j ACCEPT - - - # allow crl fetch from winnetou - iptables -A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT - iptables -A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT - - # allow ssh - iptables -A INPUT -p tcp --dport 22 -j ACCEPT - iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT - - eend $? -} - -stop() { - ebegin "Stopping firewall" - for a in `cat /proc/net/ip_tables_names`; do - /sbin/iptables -F -t $a - /sbin/iptables -X -t $a - - if [ $a == nat ]; then - /sbin/iptables -t nat -P PREROUTING ACCEPT - /sbin/iptables -t nat -P POSTROUTING ACCEPT - /sbin/iptables -t nat -P OUTPUT ACCEPT - elif [ $a == mangle ]; then - /sbin/iptables -t mangle -P PREROUTING ACCEPT - /sbin/iptables -t mangle -P INPUT ACCEPT - /sbin/iptables -t mangle -P FORWARD ACCEPT - /sbin/iptables -t mangle -P OUTPUT ACCEPT - /sbin/iptables -t mangle -P POSTROUTING ACCEPT - elif [ $a == filter ]; then - /sbin/iptables -t filter -P INPUT ACCEPT - /sbin/iptables -t filter -P FORWARD ACCEPT - /sbin/iptables -t filter -P OUTPUT ACCEPT - fi - done - eend $? -} - -reload() { - ebegin "Flushing firewall" - for a in `cat /proc/net/ip_tables_names`; do - /sbin/iptables -F -t $a - /sbin/iptables -X -t $a - done; - eend $? - start -} - diff --git a/testing/hosts/alice/etc/init.d/net.eth0 b/testing/hosts/alice/etc/init.d/net.eth0 deleted file mode 100755 index 92b3851cf..000000000 --- a/testing/hosts/alice/etc/init.d/net.eth0 +++ /dev/null @@ -1,1124 +0,0 @@ -#!/sbin/runscript -# Copyright (c) 2004-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -# Contributed by Roy Marples (uberlord@gentoo.org) -# Many thanks to Aron Griffis (agriffis@gentoo.org) -# for help, ideas and patches - -#NB: Config is in /etc/conf.d/net - -# For pcmcia users. note that pcmcia must be added to the same -# runlevel as the net.* script that needs it. -depend() { - need localmount - after bootmisc hostname - use isapnp isdn pcmcia usb wlan - - # Load any custom depend functions for the given interface - # For example, br0 may need eth0 and eth1 - local iface="${SVCNAME#*.}" - [[ $(type -t "depend_${iface}") == "function" ]] && depend_${iface} - - if [[ ${iface} != "lo" && ${iface} != "lo0" ]] ; then - after net.lo net.lo0 - - # Support new style RC_NEED and RC_USE in one net file - local x="RC_NEED_${iface}" - [[ -n ${!x} ]] && need ${!x} - x="RC_USE_${iface}" - [[ -n ${!x} ]] && use ${!x} - fi - - return 0 -} - -# Define where our modules are -MODULES_DIR="${svclib}/net" - -# Make some wrappers to fudge after/before/need/use depend flags. -# These are callbacks so MODULE will be set. -after() { - eval "${MODULE}_after() { echo \"$*\"; }" -} -before() { - eval "${MODULE}_before() { echo \"$*\"; }" -} -need() { - eval "${MODULE}_need() { echo \"$*\"; }" -} -installed() { - # We deliberately misspell this as _installed will probably be used - # at some point - eval "${MODULE}_instlled() { echo \"$*\"; }" -} -provide() { - eval "${MODULE}_provide() { echo \"$*\"; }" -} -functions() { - eval "${MODULE}_functions() { echo \"$*\"; }" -} -variables() { - eval "${MODULE}_variables() { echo \"$*\"; }" -} - -is_loopback() { - [[ $1 == "lo" || $1 == "lo0" ]] -} - -# char* interface_device(char *iface) -# -# Gets the base device of the interface -# Can handle eth0:1 and eth0.1 -# Which returns eth0 in this case -interface_device() { - local dev="${1%%.*}" - [[ ${dev} == "$1" ]] && dev="${1%%:*}" - echo "${dev}" -} - -# char* interface_type(char* iface) -# -# Returns the base type of the interface -# eth, ippp, etc -interface_type() { - echo "${1%%[0-9]*}" -} - -# int calculate_metric(char *interface, int base) -# -# Calculates the best metric for the interface -# We use this when we add routes so we can prefer interfaces over each other -calculate_metric() { - local iface="$1" metric="$2" - - # Have we already got a metric? - local m=$(awk '$1=="'${iface}'" && $2=="00000000" { print $7 }' \ - /proc/net/route) - if [[ -n ${m} ]] ; then - echo "${m}" - return 0 - fi - - local i= dest= gw= flags= ref= u= m= mtu= metrics= - while read i dest gw flags ref u m mtu ; do - # Ignore lo - is_loopback "${i}" && continue - # We work out metrics from default routes only - [[ ${dest} != "00000000" || ${gw} == "00000000" ]] && continue - metrics="${metrics}\n${m}" - done < /proc/net/route - - # Now, sort our metrics - metrics=$(echo -e "${metrics}" | sort -n) - - # Now, find the lowest we can use - local gotbase=false - for m in ${metrics} ; do - [[ ${m} -lt ${metric} ]] && continue - [[ ${m} == ${metric} ]] && ((metric++)) - [[ ${m} -gt ${metric} ]] && break - done - - echo "${metric}" -} - -# int netmask2cidr(char *netmask) -# -# Returns the CIDR of a given netmask -netmask2cidr() { - local binary= i= bin= - - for i in ${1//./ }; do - bin="" - while [[ ${i} != "0" ]] ; do - bin=$[${i}%2]${bin} - (( i=i>>1 )) - done - binary="${binary}${bin}" - done - binary="${binary%%0*}" - echo "${#binary}" -} - - -# bool is_function(char* name) -# -# Returns 0 if the given name is a shell function, otherwise 1 -is_function() { - [[ -z $1 ]] && return 1 - [[ $(type -t "$1") == "function" ]] -} - -# void function_wrap(char* source, char* target) -# -# wraps function calls - for example function_wrap(this, that) -# maps function names this_* to that_* -function_wrap() { - local i= - - is_function "${2}_depend" && return - - for i in $(typeset -f | grep -o '^'"${1}"'_[^ ]*'); do - eval "${2}${i#${1}}() { ${i} \"\$@\"; }" - done -} - -# char[] * expand_parameters(char *cmd) -# -# Returns an array after expanding parameters. For example -# "192.168.{1..3}.{1..3}/24 brd +" -# will return -# "192.168.1.1/24 brd +" -# "192.168.1.2/24 brd +" -# "192.168.1.3/24 brd +" -# "192.168.2.1/24 brd +" -# "192.168.2.2/24 brd +" -# "192.168.2.3/24 brd +" -# "192.168.3.1/24 brd +" -# "192.168.3.2/24 brd +" -# "192.168.3.3/24 brd +" -expand_parameters() { - local x=$(eval echo ${@// /_}) - local -a a=( ${x} ) - - a=( "${a[@]/#/\"}" ) - a=( "${a[@]/%/\"}" ) - echo "${a[*]//_/ }" -} - -# void configure_variables(char *interface, char *option1, [char *option2]) -# -# Maps configuration options from _