Add system user and group for webref in NixOS tests. Update database accessibility check to use webref user for improved security testing.

This commit is contained in:
Danilo Reyes
2025-11-01 23:57:06 -06:00
parent 011204188d
commit eddc0390ba

View File

@@ -158,6 +158,13 @@
}];
};
# Create system user for testing
users.users.webref = {
isSystemUser = true;
group = "webref";
};
users.groups.webref = {};
environment.systemPackages = with pkgs; [
python3
nmap
@@ -169,7 +176,7 @@
start_all()
machine.wait_for_unit("postgresql.service")
# Verify database is accessible locally
# Verify database is accessible with webref user
machine.succeed("sudo -u webref psql webref -c 'SELECT 1;'")
machine.succeed("echo ' Security test passed'")