1 .\" $OpenBSD: securelevel.7,v 1.23 2011/06/24 19:47:48 naddy Exp $
3 .\" Copyright (c) 2000 Hugh Graham
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 .\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
16 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18 .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 .\" POSSIBILITY OF SUCH DAMAGE.
26 .Dd $Mdocdate: June 24 2011 $
31 .Nd securelevel and its effects
35 kernel provides four levels of system security:
37 .It \&-1 Em Permanently insecure mode
41 will not attempt to raise the securelevel
45 while the system is insecure
47 otherwise identical to securelevel 0
49 .It \ 0 Em Insecure mode
52 used during bootstrapping and while the system is single-user
54 all devices may be read or written subject to their permissions
56 system file flags may be cleared with
59 .It \ 1 Em Secure mode
62 default mode when system is multi-user
64 securelevel may no longer be lowered except by init
71 raw disk devices of mounted file systems are read-only
73 system immutable and append-only file flags may not be removed
75 kernel modules may not be loaded or unloaded
80 variable may not be changed
85 variable may not be changed
88 .Va net.inet.ip.sourceroute
90 variable may not be changed
95 variable may not be changed
102 variables may not be raised
105 .Va machdep.allowaperture
107 variable may not be raised
110 may only access GPIO pins configured at system startup
112 .It \ 2 Em Highly secure mode
115 all effects of securelevel 1
117 raw disk devices are always read-only whether mounted or not
122 may not set the time backwards or close to overflow
125 filter and NAT rules may not be altered
129 Securelevel provides convenient means of
131 a system to a degree suited to its environment.
132 It is normally set at boot via the
134 script, or the superuser may raise securelevel at any time by modifying the
140 may lower it once the system has entered secure mode.
143 in the config file will default to permanently insecure mode.
145 Highly secure mode may seem Draconian, but is intended as a last line of
146 defence should the superuser account be compromised.
148 circumvention of file flags by direct modification of a raw disk device,
149 or erasure of a file system by means of
151 Further, it can limit the potential damage of a compromised
153 by prohibiting the modification of packet filter rules.
155 the system clock from being set backwards aids in post-mortem analysis
156 and helps ensure the integrity of logs.
157 Precision timekeeping is not
158 affected because the clock may still be slowed.
160 Because securelevel can be modified with the in-kernel debugger
162 a convenient means of locking it off (if present) is provided
163 at securelevels 1 and 2.
164 This is accomplished by setting
172 .Bl -tag -width /etc/rc.securelevel -compact
173 .It Pa /etc/rc.securelevel
174 commands that run before the security level changes
184 manual page first appeared in
187 The list of securelevel's effects may not be comprehensive.