#!/usr/bin/expect -f # This file is part of Firejail project # Copyright (C) 2014-2020 Firejail Authors # License GPL v2 set timeout 10 spawn $env(SHELL) match_max 100000 send -- "firejail --private-bin=bash,ls,sh\r" expect { timeout {puts "TESTING ERROR 1\n";exit} "Child process initialized" } sleep 1 send -- "ls /bin\r" expect { timeout {puts "TESTING ERROR 2\n";exit} "bash" } expect { timeout {puts "TESTING ERROR 3\n";exit} "ls" } expect { timeout {puts "TESTING ERROR 4\n";exit} "sh" } send -- "ls /bin\r" expect { timeout {puts "TESTING ERROR 5\n";exit} "ping" {puts "TESTING ERROR 6\n";exit} "sh" } send -- "exit\r" sleep 1 send -- "firejail --profile=private-bin.profile\r" expect { timeout {puts "TESTING ERROR 7\n";exit} "Child process initialized" } sleep 1 send -- "ls /bin\r" expect { timeout {puts "TESTING ERROR 8\n";exit} "bash" } expect { timeout {puts "TESTING ERROR 9\n";exit} "ls" } expect { timeout {puts "TESTING ERROR 10\n";exit} "sh" } send -- "ls /bin\r" expect { timeout {puts "TESTING ERROR 11\n";exit} "ping" {puts "TESTING ERROR 12\n";exit} "sh" } send -- "exit\r" after 100 send -- "firejail --private-bin=/etc/shadow\r" expect { timeout {puts "TESTING ERROR 13\n";exit} "Warning: invalid private-bin path /etc/shadow" } after 300 send -- "firejail --private-bin=\"bla;bla\"\r" expect { timeout {puts "TESTING ERROR 14\n";exit} "is an invalid filename" } after 300 send -- "firejail --private-etc=../bin/ls\r" expect { timeout {puts "TESTING ERROR 15\n";exit} "is an invalid filename" } after 300 puts "\nall done\n"