1 import ./make-test-python.nix ({ pkgs, ...} : {
3 meta = with pkgs.lib.maintainers; {
7 nodes.machine = { ... }: {
8 imports = [ ./common/user-account.nix ];
13 bash-jailed = "${pkgs.bash}/bin/bash";
15 executable = "${pkgs.bash}/bin/bash";
16 extraArgs = [ "--private=~/firejail-home" ];
21 systemd.services.setupFirejailTest = {
22 wantedBy = [ "multi-user.target" ];
23 before = [ "multi-user.target" ];
31 RemainAfterExit = true;
38 mkdir .password-store && echo s3cret > .password-store/secret
39 mkdir my-secrets && echo s3cret > my-secrets/secret
43 mkdir -p .config/firejail
44 echo 'blacklist ''${HOME}/my-secrets' > .config/firejail/globals.local
51 machine.wait_for_unit("multi-user.target")
53 # Test path acl with wrapper
54 machine.succeed("sudo -u alice bash-jailed -c 'cat ~/public' | grep -q publ1c")
56 "sudo -u alice bash-jailed -c 'cat ~/.password-store/secret' | grep -q s3cret"
58 machine.fail("sudo -u alice bash-jailed -c 'cat ~/my-secrets/secret' | grep -q s3cret")
61 machine.succeed("sudo -u alice mkdir /home/alice/firejail-home")
62 machine.succeed("sudo -u alice bash-jailed2 -c 'echo test > /home/alice/foo'")
63 machine.fail("sudo -u alice cat /home/alice/foo")
64 machine.succeed("sudo -u alice cat /home/alice/firejail-home/foo | grep test")
66 # Test path acl with firejail executable
67 machine.succeed("sudo -u alice firejail -- bash -c 'cat ~/public' | grep -q publ1c")
69 "sudo -u alice firejail -- bash -c 'cat ~/.password-store/secret' | grep -q s3cret"
72 "sudo -u alice firejail -- bash -c 'cat ~/my-secrets/secret' | grep -q s3cret"
77 "sudo -u alice bash -c 'firejail --noprofile -- cat ~/.password-store/secret' | grep -q s3cret"
82 "sudo -u alice firejail --private-tmp id --output=/tmp/vuln1 && cat /tmp/vuln1"
87 "sudo -u alice firejail --private-tmp --output=/tmp/foo 'bash -c $(id>/tmp/vuln2;echo id)' && cat /tmp/vuln2"