Skip to content

Commit

Permalink
more profile fixes/testing
Browse files Browse the repository at this point in the history
  • Loading branch information
netblue30 committed Jan 19, 2023
1 parent 6d7335c commit 1718982
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ $(TEST_TARGETS):
$(MAKE) -C test $(subst test-,,$@)


# extract some data about the testing setup: kernel, network connectivity, pwd
lab-setup:; uname -r; pwd; whoami; cat /etc/resolv.conf; cat /etc/hosts; ping -c 3 yahoo.com; dig yahoo.com; host yahoo.com; nslookup yahoo.com;
# extract some data about the testing setup: kernel, network connectivity, user
lab-setup:; uname -r; pwd; whoami; cat /etc/resolv.conf; cat /etc/hosts; dig dns.quad9.net; ping -c 3 dns.quad9.net


test: lab-setup test-profiles test-fcopy test-fnetfilter test-fs test-utils test-sysutils test-environment test-apps test-apps-x11 test-apps-x11-xorg test-filters
Expand Down
2 changes: 1 addition & 1 deletion etc/profile-a-l/dig.profile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ tracelog
disable-mnt
private-bin bash,dig,sh
private-dev
private-etc resolv.conf,login.defs,passwd
private-etc login.defs,passwd,resolv.conf
# Add the next line to your dig.local on non Debian/Ubuntu OS (see issue #3038).
#private-lib
private-tmp
Expand Down
2 changes: 1 addition & 1 deletion etc/profile-a-l/host.profile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tracelog
disable-mnt
private
private-bin bash,host,sh
private-etc resolv.conf,login.defs,passwd
private-etc login.defs,passwd,resolv.conf
private-dev
private-tmp

Expand Down
2 changes: 1 addition & 1 deletion etc/profile-m-z/nslookup.profile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tracelog

disable-mnt
private-bin bash,nslookup,sh
private-etc resolv.conf,login.defs,passwd
private-etc login.defs,passwd,resolv.conf
private-dev
private-tmp

Expand Down
3 changes: 1 addition & 2 deletions etc/profile-m-z/ping.profile
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ private
#private-bin ping - has mammoth problems with execvp: "No such file or directory"
private-cache
private-dev
# /etc/hosts is required in private-etc; however, just adding it to the list doesn't solve the problem!
private-etc alternatives,ca-certificates,crypto-policies,hosts,pki,resolv.conf,ssl,passwd,login.defs
private-etc alternatives,ca-certificates,crypto-policies,hosts,login.defs,passwd,pki,resolv.conf,ssl
private-lib
private-tmp

Expand Down
18 changes: 18 additions & 0 deletions test/sysutils/dig.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2022 Firejail Authors
# License GPL v2

set timeout 10
spawn $env(SHELL)
match_max 100000

send -- "firejail dig +timeout=1 +retry=0 dns.quad9.net\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"no servers could be reached" {puts "no network connectivity!\n";exit}
"NXDOMAIN" {puts "not found\n";exit}
"ANSWER SECTION"
}
after 100
puts "\nall done\n"
18 changes: 18 additions & 0 deletions test/sysutils/host.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2022 Firejail Authors
# License GPL v2

set timeout 10
spawn $env(SHELL)
match_max 100000

send -- "firejail host -W 1 -R 0 dns.quad9.net\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"no servers could be reached" {puts "no network connectivity!\n";exit}
"NXDOMAIN" {puts "not found\n";exit}
"has address"
}
after 100
puts "\nall done\n"
20 changes: 20 additions & 0 deletions test/sysutils/man.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2022 Firejail Authors
# License GPL v2

set timeout 10
spawn $env(SHELL)
match_max 100000

send -- "firejail man ls\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"NAME"
}
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"SYNOPSIS"
}
after 100
puts "\nall done\n"
18 changes: 18 additions & 0 deletions test/sysutils/nslookup.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2022 Firejail Authors
# License GPL v2

set timeout 10
spawn $env(SHELL)
match_max 100000

send -- "firejail nslookup -timeout=1 -retry=0 dns.quad9.net\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"no servers could be reached" {puts "no network connectivity!\n";exit}
"NXDOMAIN" {puts "not found\n";exit}
"Address"
}
after 100
puts "\nall done\n"
34 changes: 34 additions & 0 deletions test/sysutils/sysutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,37 @@ then
else
echo "TESTING SKIP: ping not found"
fi

if command -v dig
then
echo "TESTING: dig"
./dig.exp
else
echo "TESTING SKIP: dig not found"
fi

if command -v host
then
echo "TESTING: host"
./host.exp
else
echo "TESTING SKIP: host not found"
fi

if command -v nslookup
then
echo "TESTING: nslookup"
./host.exp
else
echo "TESTING SKIP: nslookup not found"
fi

if command -v man
then
echo "TESTING: man"
./man.exp
else
echo "TESTING SKIP: man not found"
fi


0 comments on commit 1718982

Please sign in to comment.