testing: Install a package via apt-get to get a second SWIMA software event
authorTobias Brunner <tobias@strongswan.org>
Fri, 5 Oct 2018 16:14:31 +0000 (18:14 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 21 Nov 2018 13:33:29 +0000 (14:33 +0100)
This installs tmux and its two dependencies libevent-2.0-5 and libutempter0.
For the tnc/tnccs-20-ev-pt-tls test scenario older, apparently replaced
versions of these packages are entered to the collector.db database, so that
dummy SWID tags for these packages can be requested via SWIMA.

testing/hosts/default/usr/local/bin/init_collector
testing/scripts/build-baseimage
testing/tests/tnc/tnccs-20-ev-pt-tls/hosts/carol/etc/pts/collector.sql [new file with mode: 0644]
testing/tests/tnc/tnccs-20-ev-pt-tls/posttest.dat

index c522de8..df14628 100755 (executable)
@@ -1,4 +1,6 @@
 #! /bin/sh
 
 cat /usr/local/share/strongswan/templates/database/sw-collector/sw_collector_tables.sql | sqlite3 /etc/db.d/collector.db
+sed -i "s:DEBIAN_VERSION:`cat /etc/debian_version`:" /etc/pts/collector.sql
+cat /etc/pts/collector.sql | sqlite3 /etc/db.d/collector.db
 LEAK_DETECTIVE_DISABLE=1 /usr/local/sbin/sw-collector
index 9fa073e..7c30758 100755 (executable)
@@ -16,7 +16,7 @@ INC=automake,autoconf,libtool,bison,flex,gperf,pkg-config,gettext,less,locales
 INC=$INC,build-essential,libgmp-dev,libldap2-dev,libcurl4-openssl-dev,ethtool
 INC=$INC,libxml2-dev,libtspi-dev,libsqlite3-dev,openssh-server,tcpdump,psmisc
 INC=$INC,openssl,vim,sqlite3,conntrack,gdb,cmake,libltdl-dev,liblog4cxx10-dev
-INC=$INC,libboost-thread-dev,libboost-system-dev,git-core,iperf,htop,screen
+INC=$INC,libboost-thread-dev,libboost-system-dev,git-core,iperf,htop
 INC=$INC,gnat,gprbuild,acpid,acpi-support-base,libldns-dev,libunbound-dev
 INC=$INC,dnsutils,libsoup2.4-dev,ca-certificates,unzip,libsystemd-dev
 INC=$INC,python,python-setuptools,python-dev,python-pip,apt-transport-https
@@ -36,6 +36,8 @@ stretch)
 esac
 SERVICES="apache2 dbus isc-dhcp-server slapd bind9 freeradius"
 INC=$INC,${SERVICES// /,}
+# packages to install via APT, for SWIMA tests
+APT="tmux"
 # additional services to disable
 SERVICES="$SERVICES systemd-timesyncd.service"
 
@@ -117,6 +119,8 @@ log_status $?
 
 log_action "Update package sources"
 execute_chroot "apt-get update"
+log_action "Install packages via APT"
+execute_chroot "apt-get -y install $APT"
 log_action "Install packages from custom repo"
 execute_chroot "apt-get -y upgrade"
 
diff --git a/testing/tests/tnc/tnccs-20-ev-pt-tls/hosts/carol/etc/pts/collector.sql b/testing/tests/tnc/tnccs-20-ev-pt-tls/hosts/carol/etc/pts/collector.sql
new file mode 100644 (file)
index 0000000..548c101
--- /dev/null
@@ -0,0 +1,39 @@
+/* SW Identifiers */
+
+INSERT INTO sw_identifiers (
+  name, package, version, source, installed
+) VALUES (
+       'strongswan.org__Debian_DEBIAN_VERSION-x86_64-libutempter0-1.1.5', 'libutempter0', '1.1.5', 1, 0
+);
+
+INSERT INTO sw_identifiers (
+  name, package, version, source, installed
+) VALUES (
+  'strongswan.org__Debian_DEBIAN_VERSION-x86_64-libevent-2.0-5-2.0.20', 'libevent-2.0-5', '2.0.20', 1, 0
+);
+
+INSERT INTO sw_identifiers (
+  name, package, version, source, installed
+) VALUES (
+  'strongswan.org__Debian_DEBIAN_VERSION-x86_64-tmux-2.2', 'tmux', '2.2', 1, 0
+);
+
+/* SW Events */
+
+INSERT INTO sw_events (
+  eid, sw_id, action
+) VALUES (
+  2, 1, 2
+);
+
+INSERT INTO sw_events (
+  eid, sw_id, action
+) VALUES (
+  2, 2, 2
+);
+
+INSERT INTO sw_events (
+  eid, sw_id, action
+) VALUES (
+  2, 3, 2
+);
index c0049d7..5d0602c 100644 (file)
@@ -1,6 +1,7 @@
 carol::ip route del 10.1.0.0/16 via 192.168.0.1
 dave::ip route del 10.1.0.0/16 via 192.168.0.1
 winnetou::ip route del 10.1.0.0/16 via 192.168.0.1
+carol::rm /etc/pts/collector.sql
 alice::systemctl stop strongswan-swanctl
 alice::systemctl stop apache2
 alice::rm /etc/swanctl/rsa/aaaKey.pem