From 12317dbbf67c1adcaf0d4fec267896d5951d8418 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Tue, 24 Nov 2015 11:11:04 -0500 Subject: feature test --- test/configure | 3 +- test/features/2.1.exp | 18 ++++++++++++ test/features/2.6.exp | 68 ++++++++++++++++++++++++++++++++++++++++++++++ test/features/features.txt | 2 ++ 4 files changed, 90 insertions(+), 1 deletion(-) create mode 100755 test/features/2.6.exp diff --git a/test/configure b/test/configure index 2827582f3..73c808020 100755 --- a/test/configure +++ b/test/configure @@ -28,7 +28,7 @@ ROOTDIR="/tmp/chroot" # default chroot directory DEFAULT_FILES="/bin/bash /bin/sh " # basic chroot files DEFAULT_FILES+="/etc/passwd /etc/nsswitch.conf /etc/group " DEFAULT_FILES+=`find /lib -name libnss*` # files required by glibc -DEFAULT_FILES+=" /bin/cp /bin/ls /bin/cat /bin/ps /bin/ping /sbin/ifconfig /bin/hostname /bin/grep /usr/bin/dig /usr/bin/openssl /usr/bin/id /usr/bin/getent /usr/bin/whoami /usr/bin/wc /usr/bin/wget /bin/umount" +DEFAULT_FILES+=" /bin/cp /bin/ls /bin/cat /bin/ps /bin/netstat /bin/ping /sbin/ifconfig /bin/hostname /bin/grep /usr/bin/dig /usr/bin/openssl /usr/bin/id /usr/bin/getent /usr/bin/whoami /usr/bin/wc /usr/bin/wget /bin/umount" rm -fr $ROOTDIR mkdir -p $ROOTDIR/{root,bin,lib,lib64,usr,home,etc,dev/shm,tmp,var/run,var/tmp,var/lock,var/log,proc} @@ -40,6 +40,7 @@ mkdir $ROOTDIR/selinux cp /etc/passwd $ROOTDIR/etc/. cp /etc/group $ROOTDIR/etc/. cp /etc/hosts $ROOTDIR/etc/. +cp /etc/hostname $ROOTDIR/etc/. mkdir -p $ROOTDIR/usr/lib/x86_64-linux-gnu cp -a /usr/lib/x86_64-linux-gnu/openssl-1.0.0 $ROOTDIR/usr/lib/x86_64-linux-gnu/. cp -a /usr/lib/ssl $ROOTDIR/usr/lib/. diff --git a/test/features/2.1.exp b/test/features/2.1.exp index 6b2b3f7f5..a2ae321ce 100755 --- a/test/features/2.1.exp +++ b/test/features/2.1.exp @@ -23,6 +23,12 @@ expect { "bingo" } after 100 +send -- "cat /etc/hostname\r" +expect { + timeout {puts "TESTING ERROR 1.0\n";exit} + "bingo" +} +after 100 send -- "getent hosts bingo\r" expect { timeout {puts "TESTING ERROR 1.1\n";exit} @@ -53,6 +59,12 @@ expect { "bingo" } after 100 +send -- "cat /etc/hostname\r" +expect { + timeout {puts "TESTING ERROR 3.0\n";exit} + "bingo" +} +after 100 send -- "getent hosts bingo\r" expect { timeout {puts "TESTING ERROR 3.1\n";exit} @@ -82,6 +94,12 @@ expect { "bingo" } after 100 +send -- "cat /etc/hostname\r" +expect { + timeout {puts "TESTING ERROR 5.0\n";exit} + "bingo" +} +after 100 send -- "getent hosts bingo\r" expect { timeout {puts "TESTING ERROR 5.1\n";exit} diff --git a/test/features/2.6.exp b/test/features/2.6.exp new file mode 100755 index 000000000..dc2381393 --- /dev/null +++ b/test/features/2.6.exp @@ -0,0 +1,68 @@ +#!/usr/bin/expect -f +# +# default gateway +# + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +# +# N +# +send -- "firejail --noprofile --net=eth0 --defaultgw=192.168.1.10\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "Child process initialized" +} +sleep 1 + +send -- "netstat -rn\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "0.0.0.0 192.168.1.10" +} +after 100 +send -- "exit\r" +sleep 1 + +# +# O +# +send -- "firejail --noprofile --overlay --net=eth0 --defaultgw=192.168.1.10\r" +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" +} +sleep 1 + +send -- "netstat -rn\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "0.0.0.0 192.168.1.10" +} +after 100 +send -- "exit\r" +sleep 1 + +# +# C +# +send -- "firejail --noprofile --chroot=/tmp/chroot --net=eth0 --defaultgw=192.168.1.10\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" +} +sleep 1 + +send -- "netstat -rn\r" +expect { + timeout {puts "TESTING ERROR 5\n";exit} + "0.0.0.0 192.168.1.10" +} +after 100 +send -- "exit\r" +sleep 1 + + +puts "\nall done\n" diff --git a/test/features/features.txt b/test/features/features.txt index 9ac7b944e..95e8cc5a0 100644 --- a/test/features/features.txt +++ b/test/features/features.txt @@ -60,6 +60,7 @@ C - chroot filesystem - test --ip: N, O, C 2.5 interface + - N, O, C 2.6 Default gw (--noprofile --net=eth0 --defaultgw=192.168.1.10, run netstat -rn) - N, O, C @@ -68,4 +69,5 @@ C - chroot filesystem 3. Filesystem features (use --noprofile) +3.1 tmpfs \ No newline at end of file -- cgit v1.2.3-54-g00ecf