aboutsummaryrefslogtreecommitdiffhomepage
path: root/test.nix
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-18 17:36:58 +0900
committerOphestra <cat@gensokyo.uk>2025-02-18 17:39:53 +0900
commit2c9c7fee5b42d8f32be9ff55ad92345ae62c0af7 (patch)
tree90209f024a847576033e5fdda340fa6d3b662d74 /test.nix
parentd0400f3c81ce6d1976d9e4e527b1d342f4bc270d (diff)
linux: wrap fsu lookup error
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'test.nix')
-rw-r--r--test.nix21
1 files changed, 19 insertions, 2 deletions
diff --git a/test.nix b/test.nix
index 6fdb249b..c85d3c6c 100644
--- a/test.nix
+++ b/test.nix
@@ -18,7 +18,12 @@ nixosTest {
skipTypeCheck = true;
nodes.machine =
- { lib, pkgs, ... }:
+ {
+ lib,
+ pkgs,
+ config,
+ ...
+ }:
{
users.users = {
alice = {
@@ -32,6 +37,9 @@ nixosTest {
description = "Untrusted user";
password = "foobar";
uid = 1001;
+
+ # For deny unmapped uid test:
+ packages = [ config.environment.fortify.package ];
};
};
@@ -284,7 +292,16 @@ nixosTest {
machine.wait_for_file("/tmp/sway-ipc.sock")
# Deny unmapped uid:
- print(machine.fail("sudo -u untrusted -i ${self.packages.${system}.fortify}/bin/fortify -v run"))
+ denyOutput = machine.fail("sudo -u untrusted -i fortify run &>/dev/stdout")
+ print(denyOutput)
+ denyOutputVerbose = machine.fail("sudo -u untrusted -i fortify -v run &>/dev/stdout")
+ print(denyOutputVerbose)
+
+ # Verify PrintBaseError behaviour:
+ if denyOutput != "fsu: uid 1001 is not in the fsurc file\n":
+ raise Exception(f"unexpected deny output:\n{denyOutput}")
+ if denyOutputVerbose != "fsu: uid 1001 is not in the fsurc file\nfortify: *cannot obtain uid from fsu: permission denied\n":
+ raise Exception(f"unexpected deny verbose output:\n{denyOutputVerbose}")
# Start fortify permissive defaults outside Wayland session:
print(machine.succeed("sudo -u alice -i fortify -v run -a 0 touch /tmp/success-bare"))