SECMODEL_SECURELEVEL(9) | Kernel Developer's Manual | SECMODEL_SECURELEVEL(9) |
The super-user can raise the securelevel using sysctl(8), but only init(8) can lower it.
Four security levels are provided.
Highly secure mode may seem Draconian, but is intended as a last line of defence should the super-user account be compromised. Its effects preclude circumvention of file flags by direct modification of a raw disk device, or erasure of a file system by means of newfs(8). Further, it can limit the potential damage of a compromised “firewall” by prohibiting the modification of packet filter rules. Preventing the system clock from being set backwards aids in post-mortem analysis and helps ensure the integrity of logs. Precision timekeeping is not affected because the clock may still be slowed.
Normally, the system runs in securelevel 0 while single-user and in securelevel 1 while multi-user. If a higher securelevel is desired while running multi-user, it can be set using the securelevel keyword in the startup script /etc/rc.conf, see rc.conf(5) for details. Lower securelevels require the kernel to be compiled with options INSECURE, causing it to always default to securelevel -1.
In order for this protection to be effective, the administrator must ensure that no program that is run while the security level is 0 or lower, nor any data or configuration file used by any such program, can be modified while the security level is greater than 0. This may be achieved through the careful use of the “immutable” file flag to define and protect a Trusted Computing Base (TCB) consisting of all such programs and data, or by ensuring that all such programs and data are on filesystems that are mounted read-only and running at security level 2 or higher. Particular care must be taken to ensure, if relying upon security level 1 and the use of file flags, that the integrity of the TCB cannot be compromised through the use of modifications to the disklabel or access to overlapping disk partitions, including the raw partition.
Do not overlook the fact that shell scripts (or anything else fed to an interpreter, through any mechanism) and the kernel itself are "programs that run while the security level is 0" and must be considered part of the TCB.
The following sysctl(3) variables are exported:
The parameters to secmodel_eval(9) are:
The security level 2 restrictions relating to TCB integrity protection should be enforced at security level 1. Restrictions dependent upon security level but not relating to TCB integrity protection should be selected by sysctl(8) settings available only at security level 0 or lower.
January 16, 2012 | NetBSD 6.1 |