@@ -1,46 +0,0 @@
1−# Basic test to make sure grsecurity works
2−
3−import ./make-test.nix ({ pkgs, ...} : {
4− name = "grsecurity";
5− meta = with pkgs.stdenv.lib.maintainers; {
6− maintainers = [ copumpkin joachifm ];
7− };
8−
9− machine = { config, pkgs, ... }:
10− { security.grsecurity.enable = true;
11− boot.kernel.sysctl."kernel.grsecurity.audit_mount" = 0;
12− boot.kernel.sysctl."kernel.grsecurity.deter_bruteforce" = 0;
13− networking.useDHCP = false;
14− };
15−
16− testScript = ''
17− subtest "grsec-lock", sub {
18− $machine->succeed("systemctl is-active grsec-lock");
19− $machine->succeed("grep -Fq 1 /proc/sys/kernel/grsecurity/grsec_lock");
20− $machine->fail("echo -n 0 >/proc/sys/kernel/grsecurity/grsec_lock");
21− };
22−
23− subtest "paxtest", sub {
24− # TODO: running paxtest blackhat hangs the vm
25− my @pax_mustkill = (
26− "anonmap", "execbss", "execdata", "execheap", "execstack",
27− "mprotanon", "mprotbss", "mprotdata", "mprotheap", "mprotstack",
28− );
29− foreach my $name (@pax_mustkill) {
30− my $paxtest = "${pkgs.paxtest}/lib/paxtest/" . $name;
31− $machine->succeed($paxtest) =~ /Killed/ or die
32− }
33− };
34−
35− # tcc -run executes run-time generated code and so allows us to test whether
36− # paxmark actually works (otherwise, the process should be terminated)
37− subtest "tcc", sub {
38− $machine->execute("echo -e '#include <stdio.h>\nint main(void) { puts(\"hello\"); return 0; }' >main.c");
39− $machine->succeed("${pkgs.tinycc}/bin/tcc -run main.c");
40− };
41−
42− subtest "RBAC", sub {
43− $machine->succeed("[ -c /dev/grsec ]");
44− };
45− '';
46−})