This new option allows to disable leak detective to reduce the runtime
during development. Either only for the command line (swanctl, pki etc.)
or optionally also for the daemon(s).
Disabling leak detective only for the CLI tools already brings a
considerable reduction in runtime (from 48m to 38m on my dev host) as
there are many such calls in the post-test stage. Any leaks in those
tools are also a lot less of an issue than leaks in the daemon. So using
this during development should be fine as long as a full test run is done
regularly (in particular before releases). Disabling leak detective
completely further reduces the runtime (to 30m on my dev host). But that
should probably only be used for functional regression tests after
verifying new code didn't introduce new leaks.
This also fixes the service script which is used for charon-tkm since
16fcdb460a ("charon-tkm: Don't use starter/stroke with charon-tkm anymore").
92 lines
3.1 KiB
Bash
Executable File
92 lines
3.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# create specific guest images
|
|
#
|
|
# 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 <http://www.fsf.org/copyleft/gpl.txt>.
|
|
#
|
|
# 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.
|
|
|
|
echo "Creating guest images"
|
|
|
|
DIR=$(dirname `readlink -f $0`)
|
|
. $DIR/../testing.conf
|
|
. $DIR/function.sh
|
|
|
|
HOSTSDIR=$DIR/../hosts
|
|
|
|
[ `id -u` -eq 0 ] || die "You must be root to run $0"
|
|
[ -f $ROOTIMG ] || die "Root image $ROOTIMG not found"
|
|
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"
|
|
running_any $STRONGSWANHOSTS && die "Please stop test environment before running $0"
|
|
|
|
check_commands blockdev qemu-img qemu-nbd
|
|
|
|
load_qemu_nbd
|
|
|
|
mkdir -p $IMGDIR
|
|
mkdir -p $LOOPDIR
|
|
|
|
# just to be sure
|
|
do_on_exit qemu-nbd -d $NBDEV
|
|
do_on_exit umount $LOOPDIR
|
|
do_on_exit umount $LOOPDIR/proc
|
|
|
|
for host in $STRONGSWANHOSTS
|
|
do
|
|
log_action "Creating guest image for $host"
|
|
execute "qemu-img create -b $ROOTIMG -f $IMGEXT -F $IMGEXT $IMGDIR/$host.$IMGEXT" 0
|
|
execute "qemu-nbd -c $NBDEV $IMGDIR/$host.$IMGEXT" 0
|
|
blockdev --rereadpt $NBDEV
|
|
execute "mount $NBDPARTITION $LOOPDIR" 0
|
|
execute "mount -t proc none $LOOPDIR/proc" 0
|
|
execute "mv $LOOPDIR/usr/local/sbin/ipsec $LOOPDIR/usr/local/sbin/ipsec.orig" 0
|
|
execute "cp -rf $HOSTSDIR/default/* $LOOPDIR" 0
|
|
execute "cp -rf $HOSTSDIR/${host}/etc $LOOPDIR" 0
|
|
execute_chroot "ldconfig" 0
|
|
execute "mkdir $LOOPDIR/etc/pts" 0
|
|
|
|
if [ "$host" = "alice" ]
|
|
then
|
|
execute "mkdir $LOOPDIR/var/log/apache2/tnc" 0
|
|
execute_chroot "chgrp www-data /etc/pts" 0
|
|
execute_chroot "chmod g+w /etc/pts" 0
|
|
fi
|
|
if [ "$host" = "winnetou" ]
|
|
then
|
|
execute "mkdir $LOOPDIR/var/log/apache2/ocsp" 0
|
|
execute "cp -rf $DIR/../images $LOOPDIR/var/www/" 0
|
|
execute "cp -rf $DIR/../css $LOOPDIR/var/www/" 0
|
|
execute "mkdir $LOOPDIR/var/www/testresults" 0
|
|
execute_chroot "a2enmod -q cgid" 0
|
|
execute_chroot "a2enmod -q rewrite" 0
|
|
execute_chroot "mkdir /var/www/certs" 0
|
|
execute_chroot "mkdir /var/www/certs/research /var/www/certs/sales" 0
|
|
execute_chroot "/etc/ca/generate-crl" 0
|
|
execute_chroot "rm -rf /var/lib/ldap/*" 0
|
|
execute_chroot "slapadd -l /etc/ldap/ldif.txt -f /etc/ldap/slapd.conf" 0
|
|
execute_chroot "chown -R openldap:openldap /var/lib/ldap" 0
|
|
execute_chroot "dnssec-signzone -K /etc/bind -o strongswan.org. /etc/bind/db.strongswan.org" 0
|
|
execute_chroot "dnssec-signzone -K /etc/bind -o org. /etc/bind/db.org" 0
|
|
execute_chroot "dnssec-signzone -K /etc/bind -o . /etc/bind/db.root" 0
|
|
|
|
SERVICES="apache2 slapd named"
|
|
for service in $SERVICES
|
|
do
|
|
execute_chroot "systemctl enable $service" 0
|
|
done
|
|
fi
|
|
sync
|
|
execute "umount -l $LOOPDIR/proc" 0
|
|
execute "umount -l $LOOPDIR" 0
|
|
execute "qemu-nbd -d $NBDEV" 0
|
|
log_status 0
|
|
done
|