1 .\" $NetBSD: secmodel_securelevel.9,v 1.6 2009/07/25 16:20:11 mbalmer Exp $
3 .\" Copyright (c) 2006 Elad Efrat <elad@NetBSD.org>
4 .\" Copyright (c) 2000 Hugh Graham
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. The name of the author may not be used to endorse or promote products
16 .\" derived from this software without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 .Dt SECMODEL_SECURELEVEL 9
33 .Nm secmodel_securelevel
34 .Nd securelevel security model
36 The securelevel mechanism is intended to allow protecting the persistence
37 of code and data on the system, or a subset thereof, from modification, even
38 by the super-user, by providing convenient means of
40 a system to a degree suited to its environment.
42 The super-user can raise the securelevel using
49 provides four levels of securelevel, defined as follows:
51 .It \&-1 Em Permanently insecure mode
54 Don't raise the securelevel on boot
56 .It \ 0 Em Insecure mode
59 The init process (PID 1) may not be traced or accessed by
63 Immutable and append-only file flags may be changed
65 All devices may be read or written subject to their permissions
67 GPIO pins can be set and device drivers can be attached to them
69 .It \ 1 Em Secure mode
72 All effects of securelevel 0
79 Raw disk devices of mounted file systems are read-only
81 Immutable and append-only file flags may not be removed
83 Kernel modules may not be loaded or unloaded
86 .Va net.inet.ip.sourceroute
88 variable may not be changed
94 The RTC offset may not be changed
96 Set-id coredump settings may not be altered
98 Attaching the IP-based kernel debugger,
104 requests that may be used to perform raw disk and/or memory access are denied
111 Access to unmanaged memory is denied
113 Only GPIO pins that have been set at securelevel 0 can be accessed
115 .It \ 2 Em Highly secure mode
118 All effects of securelevel 1
120 Raw disk devices are always read-only whether mounted or not
122 New disks may not be mounted, and existing mounts may only be downgraded
123 from read-write to read-only
125 The system clock may not be set backwards or close to overflow
127 Per-process coredump name may not be changed
129 Packet filtering and NAT rules may not be altered
133 Highly secure mode may seem Draconian, but is intended as a last line of
134 defence should the superuser account be compromised.
136 circumvention of file flags by direct modification of a raw disk device,
137 or erasure of a file system by means of
139 Further, it can limit the potential damage of a compromised
141 by prohibiting the modification of packet filter rules.
143 the system clock from being set backwards aids in post-mortem analysis
144 and helps ensure the integrity of logs.
145 Precision timekeeping is not
146 affected because the clock may still be slowed.
148 Normally, the system runs in securelevel 0 while single-user and in
149 securelevel 1 while multi-user.
150 If a higher securelevel is desired while running multi-user,
151 it can be set using the
153 keyword in the startup script
158 Lower securelevels require the kernel to be compiled with
159 .Sy options INSECURE ,
160 causing it to always default to securelevel \-1.
162 In order for this protection to be effective, the administrator
163 must ensure that no program that is run while the security level
164 is 0 or lower, nor any data or configuration file used by any such
165 program, can be modified while the security level is greater than
167 This may be achieved through the careful use of the
169 file flag to define and protect a Trusted Computing Base (TCB)
170 consisting of all such programs and data, or by ensuring that all
171 such programs and data are on filesystems that are mounted read-only
172 and running at security level 2 or higher.
173 .Em Particular care must be taken to ensure, if relying upon
174 .Em security level 1 and the use of file flags, that the integrity of the
175 .Em TCB cannot be compromised through the use of modifications to the
176 .Em disklabel or access to overlapping disk partitions, including the
179 Do not overlook the fact that shell scripts (or anything else fed to an
180 interpreter, through any mechanism) and the kernel itself are "programs
181 that run while the security level is 0" and must be considered part of
186 variables are exported:
187 .Bl -tag -width compact
188 .It security.models.securelevel.securelevel
189 The system security level.
190 This level may be raised by processes with appropriate privilege.
191 It may only be lowered by process 1 (init).
198 .An Elad Efrat Aq elad@NetBSD.org
202 behave as though they have security level \-1.
204 The security level 2 restrictions relating to TCB integrity protection
205 should be enforced at security level 1.
206 Restrictions dependent upon security level but not relating to TCB
207 integrity protection should be selected by
209 settings available only at security level 0 or lower.