From dda687ed2a748cb262b317e0c7fdf4a9c4ae2d31 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Wed, 23 Dec 2015 16:42:58 -0500 Subject: 0.9.36 testing --- test/features/1.1.exp | 31 +++++---- test/features/1.10.exp | 32 ++++----- test/features/1.2.exp | 78 +++++++++++----------- test/features/1.4.exp | 54 +++++++-------- test/features/1.5.exp | 30 +++++---- test/features/1.6.exp | 30 +++++---- test/features/1.7.exp | 30 +++++---- test/features/1.8.exp | 40 ++++++------ test/features/2.1.exp | 62 +++++++++--------- test/features/2.2.exp | 46 ++++++------- test/features/2.3.exp | 174 +++++++++++++++++++++++++------------------------ test/features/2.4.exp | 116 ++++++++++++++++----------------- test/features/2.5.exp | 54 +++++++-------- test/features/2.6.exp | 31 ++++----- test/features/3.1.exp | 34 +++++----- test/features/3.2.exp | 34 +++++----- test/features/3.3.exp | 31 ++++----- test/features/3.4.exp | 30 +++++---- test/features/test.sh | 51 +++++++++------ 19 files changed, 516 insertions(+), 472 deletions(-) diff --git a/test/features/1.1.exp b/test/features/1.1.exp index dafa4630e..0d02b54c1 100755 --- a/test/features/1.1.exp +++ b/test/features/1.1.exp @@ -7,6 +7,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 set overlay [lindex $argv 0] +set chroot [lindex $argv 1] # # N @@ -52,21 +53,23 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ls -l /boot\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "Permission denied" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -l /boot\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "Permission denied" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/1.10.exp b/test/features/1.10.exp index 96e3c38d1..978b0a594 100755 --- a/test/features/1.10.exp +++ b/test/features/1.10.exp @@ -54,22 +54,24 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ls -l /selinux\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "Permission denied" {puts "denied\n"} - "No such file or directory" {puts "no file\n"} +if { $chroot == "chroot" } { + send -- "firejail --noprofile --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -l /selinux\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "Permission denied" {puts "denied\n"} + "No such file or directory" {puts "no file\n"} + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/1.2.exp b/test/features/1.2.exp index d487537e4..0e62895dd 100755 --- a/test/features/1.2.exp +++ b/test/features/1.2.exp @@ -100,45 +100,47 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "cat /proc/mounts | grep proc\r" -expect { - timeout {puts "TESTING ERROR 5.1\n";exit} - "proc /proc proc" -} -expect { - timeout {puts "TESTING ERROR 5.2\n";exit} - "proc /proc proc" -} -expect { - timeout {puts "TESTING ERROR 5.3\n";exit} - "proc /proc/sys proc" -} -expect { - timeout {puts "TESTING ERROR 5.4\n";exit} - "proc /proc/sysrq-trigger proc" -} -expect { - timeout {puts "TESTING ERROR 5.5\n";exit} - "proc /proc/sys/kernel/hotplug" -} -expect { - timeout {puts "TESTING ERROR 5.6\n";exit} - "proc /proc/irq proc" -} -expect { - timeout {puts "TESTING ERROR 5.7\n";exit} - "proc /proc/bus proc" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "cat /proc/mounts | grep proc\r" + expect { + timeout {puts "TESTING ERROR 5.1\n";exit} + "proc /proc proc" + } + expect { + timeout {puts "TESTING ERROR 5.2\n";exit} + "proc /proc proc" + } + expect { + timeout {puts "TESTING ERROR 5.3\n";exit} + "proc /proc/sys proc" + } + expect { + timeout {puts "TESTING ERROR 5.4\n";exit} + "proc /proc/sysrq-trigger proc" + } + expect { + timeout {puts "TESTING ERROR 5.5\n";exit} + "proc /proc/sys/kernel/hotplug" + } + expect { + timeout {puts "TESTING ERROR 5.6\n";exit} + "proc /proc/irq proc" + } + expect { + timeout {puts "TESTING ERROR 5.7\n";exit} + "proc /proc/bus proc" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/1.4.exp b/test/features/1.4.exp index 113a328c9..6de8b614f 100755 --- a/test/features/1.4.exp +++ b/test/features/1.4.exp @@ -77,33 +77,35 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ls -l /home | wc -l\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "2" -} -after 100 -send -- "cat /etc/passwd | grep 1001 | wc -l\r" -expect { - timeout {puts "TESTING ERROR 5.1\n";exit} - "0" -} -after 100 -send -- "cat /etc/group | grep 1001 | wc -l\r" -expect { - timeout {puts "TESTING ERROR 5.2\n";exit} - "0" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -l /home | wc -l\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "2" + } + after 100 + send -- "cat /etc/passwd | grep 1001 | wc -l\r" + expect { + timeout {puts "TESTING ERROR 5.1\n";exit} + "0" + } + after 100 + send -- "cat /etc/group | grep 1001 | wc -l\r" + expect { + timeout {puts "TESTING ERROR 5.2\n";exit} + "0" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/1.5.exp b/test/features/1.5.exp index 5a2643ede..02f2bd77f 100755 --- a/test/features/1.5.exp +++ b/test/features/1.5.exp @@ -52,21 +52,23 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ps aux | wc -l \r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "5" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ps aux | wc -l \r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "5" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/1.6.exp b/test/features/1.6.exp index 8ed20fa46..4e3b2e74c 100755 --- a/test/features/1.6.exp +++ b/test/features/1.6.exp @@ -52,21 +52,23 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ls -l /var/log/syslog | wc -l\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "0" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -l /var/log/syslog | wc -l\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "0" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/1.7.exp b/test/features/1.7.exp index 35351b7d9..5dcded422 100755 --- a/test/features/1.7.exp +++ b/test/features/1.7.exp @@ -54,21 +54,23 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ls -l /var/tmp/somefile | wc -l\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "0" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -l /var/tmp/somefile | wc -l\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "0" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/1.8.exp b/test/features/1.8.exp index 293864671..29e23c885 100755 --- a/test/features/1.8.exp +++ b/test/features/1.8.exp @@ -65,26 +65,28 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 -send -- "ls /etc/firejail\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "Permission denied" -} -after 100 -send -- "ls ~/.config/firejail\r" -expect { - timeout {puts "TESTING ERROR 5.1\n";exit} - "Permission denied" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + send -- "ls /etc/firejail\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "Permission denied" + } + after 100 + send -- "ls ~/.config/firejail\r" + expect { + timeout {puts "TESTING ERROR 5.1\n";exit} + "Permission denied" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/2.1.exp b/test/features/2.1.exp index 5f188988b..2e9bef8f4 100755 --- a/test/features/2.1.exp +++ b/test/features/2.1.exp @@ -84,37 +84,39 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --hostname=bingo --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "hostname\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "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} - "127.0.0.1" -} -expect { - timeout {puts "TESTING ERROR 5.2\n";exit} - "bingo" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --hostname=bingo --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "hostname\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "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} + "127.0.0.1" + } + expect { + timeout {puts "TESTING ERROR 5.2\n";exit} + "bingo" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/2.2.exp b/test/features/2.2.exp index 186da98fb..d25238107 100755 --- a/test/features/2.2.exp +++ b/test/features/2.2.exp @@ -68,29 +68,31 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --dns=4.2.2.1 --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "dig google.com\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "ANSWER SECTION" -} -expect { - timeout {puts "TESTING ERROR 5.1\n";exit} - "google.com" -} -expect { - timeout {puts "TESTING ERROR 5.3\n";exit} - "SERVER: 4.2.2.1" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --dns=4.2.2.1 --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "dig google.com\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "ANSWER SECTION" + } + expect { + timeout {puts "TESTING ERROR 5.1\n";exit} + "google.com" + } + expect { + timeout {puts "TESTING ERROR 5.3\n";exit} + "SERVER: 4.2.2.1" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/2.3.exp b/test/features/2.3.exp index 9201696c2..097050935 100755 --- a/test/features/2.3.exp +++ b/test/features/2.3.exp @@ -196,93 +196,95 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --net=eth0 --chroot=/tmp/chroot --dns=8.8.8.8 --dns=8.8.4.4\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "dig google.com\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "ANSWER SECTION" -} -expect { - timeout {puts "TESTING ERROR 5.1\n";exit} - "google.com" -} -expect { - timeout {puts "TESTING ERROR 5.3\n";exit} - "SERVER:" -} -after 100 - -send -- "/sbin/ifconfig\r" -expect { - timeout {puts "TESTING ERROR 5.4\n";exit} - "eth0" -} -expect { - timeout {puts "TESTING ERROR 5.5\n";exit} - "Link" -} -expect { - timeout {puts "TESTING ERROR 5.6\n";exit} - "192.168.1" -} -expect { - timeout {puts "TESTING ERROR 5.7\n";exit} - "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" -} -after 100 - -send -- "exit\r" -sleep 3 - -send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --chroot=/tmp/chroot --dns=8.8.8.8 --dns=8.8.4.4\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "dig google.com\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "ANSWER SECTION" -} -expect { - timeout {puts "TESTING ERROR 5.1\n";exit} - "google.com" -} -expect { - timeout {puts "TESTING ERROR 5.3\n";exit} - "SERVER:" -} -after 100 - -send -- "/sbin/ifconfig\r" -expect { - timeout {puts "TESTING ERROR 5.4\n";exit} - "eth0" -} -expect { - timeout {puts "TESTING ERROR 5.5\n";exit} - "Link" -} -expect { - timeout {puts "TESTING ERROR 5.6\n";exit} - "192.168.1.244" -} -expect { - timeout {puts "TESTING ERROR 5.7\n";exit} - "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --net=eth0 --chroot=/tmp/chroot --dns=8.8.8.8 --dns=8.8.4.4\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "dig google.com\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "ANSWER SECTION" + } + expect { + timeout {puts "TESTING ERROR 5.1\n";exit} + "google.com" + } + expect { + timeout {puts "TESTING ERROR 5.3\n";exit} + "SERVER:" + } + after 100 + + send -- "/sbin/ifconfig\r" + expect { + timeout {puts "TESTING ERROR 5.4\n";exit} + "eth0" + } + expect { + timeout {puts "TESTING ERROR 5.5\n";exit} + "Link" + } + expect { + timeout {puts "TESTING ERROR 5.6\n";exit} + "192.168.1" + } + expect { + timeout {puts "TESTING ERROR 5.7\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" + } + after 100 + + send -- "exit\r" + sleep 3 + + send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --chroot=/tmp/chroot --dns=8.8.8.8 --dns=8.8.4.4\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "dig google.com\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "ANSWER SECTION" + } + expect { + timeout {puts "TESTING ERROR 5.1\n";exit} + "google.com" + } + expect { + timeout {puts "TESTING ERROR 5.3\n";exit} + "SERVER:" + } + after 100 + + send -- "/sbin/ifconfig\r" + expect { + timeout {puts "TESTING ERROR 5.4\n";exit} + "eth0" + } + expect { + timeout {puts "TESTING ERROR 5.5\n";exit} + "Link" + } + expect { + timeout {puts "TESTING ERROR 5.6\n";exit} + "192.168.1.244" + } + expect { + timeout {puts "TESTING ERROR 5.7\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" + } + after 100 + + send -- "exit\r" + sleep 1 } -after 100 - -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/2.4.exp b/test/features/2.4.exp index 424d4fead..3291c046c 100755 --- a/test/features/2.4.exp +++ b/test/features/2.4.exp @@ -170,65 +170,65 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --net=br0 --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "/sbin/ifconfig\r" -expect { - timeout {puts "TESTING ERROR 5.4\n";exit} - "eth0" -} -expect { - timeout {puts "TESTING ERROR 5.5\n";exit} - "Link" -} -expect { - timeout {puts "TESTING ERROR 5.6\n";exit} - "10.10.20" -} -expect { - timeout {puts "TESTING ERROR 5.7\n";exit} - "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" -} -after 100 - -send -- "exit\r" -sleep 1 - -send -- "firejail --noprofile --net=br0 --ip=10.10.20.4 --chroot=/tmp/chroot\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "/sbin/ifconfig\r" -expect { - timeout {puts "TESTING ERROR 5.4\n";exit} - "eth0" -} -expect { - timeout {puts "TESTING ERROR 5.5\n";exit} - "Link" -} -expect { - timeout {puts "TESTING ERROR 5.6\n";exit} - "10.10.20.4" -} -expect { - timeout {puts "TESTING ERROR 5.7\n";exit} - "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --net=br0 --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "/sbin/ifconfig\r" + expect { + timeout {puts "TESTING ERROR 5.4\n";exit} + "eth0" + } + expect { + timeout {puts "TESTING ERROR 5.5\n";exit} + "Link" + } + expect { + timeout {puts "TESTING ERROR 5.6\n";exit} + "10.10.20" + } + expect { + timeout {puts "TESTING ERROR 5.7\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" + } + after 100 + + send -- "exit\r" + sleep 1 + + send -- "firejail --noprofile --net=br0 --ip=10.10.20.4 --chroot=/tmp/chroot\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "/sbin/ifconfig\r" + expect { + timeout {puts "TESTING ERROR 5.4\n";exit} + "eth0" + } + expect { + timeout {puts "TESTING ERROR 5.5\n";exit} + "Link" + } + expect { + timeout {puts "TESTING ERROR 5.6\n";exit} + "10.10.20.4" + } + expect { + timeout {puts "TESTING ERROR 5.7\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" + } + after 100 + + send -- "exit\r" + sleep 1 } -after 100 - -send -- "exit\r" -sleep 1 - - puts "\nall done\n" diff --git a/test/features/2.5.exp b/test/features/2.5.exp index e189f145b..44c9b5949 100755 --- a/test/features/2.5.exp +++ b/test/features/2.5.exp @@ -75,33 +75,35 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --chroot=/tmp/chroot --interface=eth0.7\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "/sbin/ifconfig\r" -expect { - timeout {puts "TESTING ERROR 5.4\n";exit} - "eth0.7" -} -expect { - timeout {puts "TESTING ERROR 5.5n";exit} - "Link" -} -expect { - timeout {puts "TESTING ERROR 5.6\n";exit} - "10.10.207.10" -} -expect { - timeout {puts "TESTING ERROR 5.7\n";exit} - "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --chroot=/tmp/chroot --interface=eth0.7\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "/sbin/ifconfig\r" + expect { + timeout {puts "TESTING ERROR 5.4\n";exit} + "eth0.7" + } + expect { + timeout {puts "TESTING ERROR 5.5n";exit} + "Link" + } + expect { + timeout {puts "TESTING ERROR 5.6\n";exit} + "10.10.207.10" + } + expect { + timeout {puts "TESTING ERROR 5.7\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/2.6.exp b/test/features/2.6.exp index 77bd8cab0..92322d7ec 100755 --- a/test/features/2.6.exp +++ b/test/features/2.6.exp @@ -51,21 +51,22 @@ if { $overlay == "overlay" } { # # 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" +if { $chroot == "chroot" } { + 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 } -after 100 -send -- "exit\r" -sleep 1 - puts "\nall done\n" diff --git a/test/features/3.1.exp b/test/features/3.1.exp index 13ec1b6be..3ee04c4de 100755 --- a/test/features/3.1.exp +++ b/test/features/3.1.exp @@ -53,23 +53,25 @@ if { $overlay == "overlay" } { # # C # -send -- "touch /tmp/chroot/home/netblue/.config/firejail-test-file\r" -sleep 1 -send -- "firejail --noprofile --chroot=/tmp/chroot --tmpfs=/home/netblue/.config\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ls ~/.config | wc -l\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "0" +if { $chroot == "chroot" } { + send -- "touch /tmp/chroot/home/netblue/.config/firejail-test-file\r" + sleep 1 + send -- "firejail --noprofile --chroot=/tmp/chroot --tmpfs=/home/netblue/.config\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls ~/.config | wc -l\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "0" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/3.2.exp b/test/features/3.2.exp index 49d8d27c1..bcb4b48b0 100755 --- a/test/features/3.2.exp +++ b/test/features/3.2.exp @@ -53,23 +53,25 @@ if { $overlay == "overlay" } { # # C # -send -- "rm -f /tmp/chroot/home/netblue/.config/firejail-test-file\r" -sleep 1 -send -- "firejail --noprofile --chroot=/tmp/chroot --read-only=/home/netblue/.config\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "touch ~/.config/firejail-test-file\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "Read-only file system" +if { $chroot == "chroot" } { + send -- "rm -f /tmp/chroot/home/netblue/.config/firejail-test-file\r" + sleep 1 + send -- "firejail --noprofile --chroot=/tmp/chroot --read-only=/home/netblue/.config\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "touch ~/.config/firejail-test-file\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "Read-only file system" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/3.3.exp b/test/features/3.3.exp index a53a4ade5..0539a1d40 100755 --- a/test/features/3.3.exp +++ b/test/features/3.3.exp @@ -52,21 +52,22 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --chroot=/tmp/chroot --blacklist=/home/netblue/.config\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "cd ~/.config\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "Permission denied" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --chroot=/tmp/chroot --blacklist=/home/netblue/.config\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "cd ~/.config\r" + expect { + timeout {puts "TESTING ERROR 5\n";exit} + "Permission denied" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 - puts "\nall done\n" diff --git a/test/features/3.4.exp b/test/features/3.4.exp index da6dd3ff0..2a6e4da41 100755 --- a/test/features/3.4.exp +++ b/test/features/3.4.exp @@ -52,21 +52,23 @@ if { $overlay == "overlay" } { # # C # -send -- "firejail --noprofile --chroot=/tmp/chroot --whitelist=/home/netblue/.config\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ls -al ~/. | wc -l\r" -expect { - timeout {puts "TESTING ERROR 1\n";exit} - "6" +if { $chroot == "chroot" } { + send -- "firejail --noprofile --chroot=/tmp/chroot --whitelist=/home/netblue/.config\r" + expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -al ~/. | wc -l\r" + expect { + timeout {puts "TESTING ERROR 1\n";exit} + "6" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 puts "\nall done\n" diff --git a/test/features/test.sh b/test/features/test.sh index b600cec31..c3a4f21ae 100755 --- a/test/features/test.sh +++ b/test/features/test.sh @@ -1,13 +1,17 @@ #!/bin/bash OVERLAY="overlay" +CHROOT="chroot" while [ $# -gt 0 ]; do # Until you run out of parameters . . . case "$1" in --nooverlay) - OVERLAY="" + OVERLAY="none" + ;; + --nochroot) + CHROOT="none" ;; --help) - echo "./test.sh [--nooverlay|--help] | grep TESTING" + echo "./test.sh [--nooverlay|--nochroot|--help] | grep TESTING" exit ;; esac @@ -21,59 +25,66 @@ done # Feature testing # +#################### # Default features +#################### echo "TESTING: 1.1 disable /boot" -./1.1.exp $OVERLAY +./1.1.exp $OVERLAY $CHROOT echo "TESTING: 1.2 new /proc" -./1.2.exp $OVERLAY +./1.2.exp $OVERLAY $CHROOT echo "TESTING: 1.4 mask other users" -./1.4.exp $OVERLAY +./1.4.exp $OVERLAY $CHROOT echo "TESTING: 1.5 PID namespace" -./1.5.exp $OVERLAY +./1.5.exp $OVERLAY $CHROOT echo "TESTING: 1.6 new /var/log" -./1.6.exp $OVERLAY +./1.6.exp $OVERLAY $CHROOT echo "TESTING: 1.7 new /var/tmp" -./1.7.exp $OVERLAY +./1.7.exp $OVERLAY $CHROOT echo "TESTING: 1.8 disable /etc/firejail and ~/.config/firejail" -./1.8.exp $OVERLAY +./1.8.exp $OVERLAY $CHROOT echo "TESTING: 1.10 disable /selinux" -./1.10.exp $OVERLAY +./1.10.exp $OVERLAY $CHROOT +#################### # networking features +#################### echo "TESTING: 2.1 hostname" -./2.1.exp $OVERLAY +./2.1.exp $OVERLAY $CHROOT echo "TESTING: 2.2 DNS" -./2.2.exp $OVERLAY +./2.2.exp $OVERLAY $CHROOT echo "TESTING: 2.3 mac-vlan" -./2.3.exp $OVERLAY +./2.3.exp $OVERLAY $CHROOT echo "TESTING: 2.4 bridge" -./2.4.exp $OVERLAY +./2.4.exp $OVERLAY $CHROOT echo "TESTING: 2.5 interface" -./2.5.exp $OVERLAY +./2.5.exp $OVERLAY $CHROOT echo "TESTING: 2.6 Default gateway" -./2.6.exp $OVERLAY +./2.6.exp $OVERLAY $CHROOT +#################### +# filesystem features +#################### echo "TESTING: 3.1 tmpfs" -./3.1.exp $OVERLAY +./3.1.exp $OVERLAY $CHROOT echo "TESTING: 3.2 read-only" -./3.2.exp $OVERLAY +./3.2.exp $OVERLAY $CHROOT echo "TESTING: 3.3 blacklist" -./3.3.exp $OVERLAY +./3.3.exp $OVERLAY $CHROOT echo "TESTING: 3.4 whitelist" -./3.4.exp $OVERLAY +./3.4.exp $OVERLAY $CHROOT -- cgit v1.2.3-70-g09d2