#
# Check the kernel parameters of an Irix 4.x machine
#
&pcheck("Kernel");


$nfs_portmon      = 0;
$nosuidshells     = 0;
$restricted_chown = 0;


if (open(KERNEL, $kernel)) {
        while (<KERNEL>) {
                next unless (/^int\s+(nfs_portmon|restricted_chown|nosuidshells)/
);
                s/\s*//g;

                ($left,$right) = split(/=/);
                ($value) = split(//,$right);

                if (/nfs_portmon/) { $nfs_portmon = $value; }
                if (/nosuidshells/) { $nosuidshells = $value; }
                if (/restricted_chown/) { $restricted_chown = $value; }
        }
}

if (! $nfs_portmon) {
        &report("DANGER: Nfs port checking is not turned on in the kernel.\n",
                "\tTo turn this on, edit the $kernel file\n",
                "\tand change \"int nfs_portmon = 0;\" to be 1.\n",
                "\tNote: Older NFS implementations have problems with this\n",
                "\tso test it carefully.\n");
}
if (! $nosuidshells) {
        &report("DANGER: The kernel is not configured to ignore suid shells. This
\n",
                "\tcould be a security problem, and should be turned off by\n",
                "\tediting $kernel and changing \"int nosuidshells = 0;\"\n",
                "\tto be 1.\n");
}
if (! $restricted_chown) {
        &report("DANGER: The kernel is not configured with restricted chown turne
d\n",
                "\ton.  This means that any user can change their file's\n",
                "\townerships to another users.  To fix this, edit the\n",
                "\t$kernel file and change \"int restricted_chown = 0;\"\n",
                "\tto be 1.\n");
}


if ($nfs_portmon || $nosuidshells || $restricted_chown) {
        &failed;
} else {
        &passed;
}

