From 17189823335d670388e71e25db8d5bec828806c2 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Thu, 19 Jan 2023 00:17:47 -0500 Subject: more profile fixes/testing --- Makefile | 4 ++-- etc/profile-a-l/dig.profile | 2 +- etc/profile-a-l/host.profile | 2 +- etc/profile-m-z/nslookup.profile | 2 +- etc/profile-m-z/ping.profile | 3 +-- test/sysutils/dig.exp | 18 ++++++++++++++++++ test/sysutils/host.exp | 18 ++++++++++++++++++ test/sysutils/man.exp | 20 ++++++++++++++++++++ test/sysutils/nslookup.exp | 18 ++++++++++++++++++ test/sysutils/sysutils.sh | 34 ++++++++++++++++++++++++++++++++++ 10 files changed, 114 insertions(+), 7 deletions(-) create mode 100755 test/sysutils/dig.exp create mode 100755 test/sysutils/host.exp create mode 100755 test/sysutils/man.exp create mode 100755 test/sysutils/nslookup.exp diff --git a/Makefile b/Makefile index ad20921ba..3dfd6a3b6 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/etc/profile-a-l/dig.profile b/etc/profile-a-l/dig.profile index 90db2caa6..5ae3a81c6 100644 --- a/etc/profile-a-l/dig.profile +++ b/etc/profile-a-l/dig.profile @@ -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 diff --git a/etc/profile-a-l/host.profile b/etc/profile-a-l/host.profile index b1689b67e..a9c9d81b2 100644 --- a/etc/profile-a-l/host.profile +++ b/etc/profile-a-l/host.profile @@ -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 diff --git a/etc/profile-m-z/nslookup.profile b/etc/profile-m-z/nslookup.profile index 8eeccf870..8069daf52 100644 --- a/etc/profile-m-z/nslookup.profile +++ b/etc/profile-m-z/nslookup.profile @@ -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 diff --git a/etc/profile-m-z/ping.profile b/etc/profile-m-z/ping.profile index 1a6178bae..c86cf13da 100644 --- a/etc/profile-m-z/ping.profile +++ b/etc/profile-m-z/ping.profile @@ -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 diff --git a/test/sysutils/dig.exp b/test/sysutils/dig.exp new file mode 100755 index 000000000..bd5ccbb5c --- /dev/null +++ b/test/sysutils/dig.exp @@ -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" diff --git a/test/sysutils/host.exp b/test/sysutils/host.exp new file mode 100755 index 000000000..7fe3ddfa4 --- /dev/null +++ b/test/sysutils/host.exp @@ -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" diff --git a/test/sysutils/man.exp b/test/sysutils/man.exp new file mode 100755 index 000000000..6e0fb5584 --- /dev/null +++ b/test/sysutils/man.exp @@ -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" diff --git a/test/sysutils/nslookup.exp b/test/sysutils/nslookup.exp new file mode 100755 index 000000000..2a99441d9 --- /dev/null +++ b/test/sysutils/nslookup.exp @@ -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" diff --git a/test/sysutils/sysutils.sh b/test/sysutils/sysutils.sh index bfe723047..a46cfb1ad 100755 --- a/test/sysutils/sysutils.sh +++ b/test/sysutils/sysutils.sh @@ -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 + + -- cgit v1.2.3-70-g09d2