<s>
securelevel	B-Operating_System
is	O
a	O
security	O
mechanism	O
in	O
*	O
BSD	B-Operating_System
kernels	B-Operating_System
,	O
which	O
can	O
optionally	O
restrict	O
certain	O
capabilities	O
.	O
</s>
<s>
Securelevel	B-Operating_System
is	O
controlled	O
by	O
the	O
sysctl	B-Application
variable	O
kern.securelevel	O
.	O
</s>
<s>
Any	O
superuser	B-Application
process	O
can	O
raise	O
securelevel	B-Operating_System
,	O
but	O
only	O
the	O
init	B-Operating_System
process	O
can	O
lower	O
it	O
.	O
</s>
<s>
When	O
used	O
with	O
FreeBSD	B-Language
jails	I-Language
,	O
each	O
jail	O
maintains	O
its	O
own	O
securelevel	B-Operating_System
in	O
addition	O
to	O
the	O
global	O
securelevel	B-Operating_System
.	O
</s>
<s>
When	O
evaluated	O
,	O
the	O
higher	O
of	O
the	O
two	O
securelevels	B-Operating_System
will	O
be	O
used	O
.	O
</s>
<s>
This	O
allows	O
the	O
host	O
environment	O
to	O
run	O
at	O
a	O
lower	O
securelevel	B-Operating_System
than	O
jails	O
,	O
so	O
that	O
it	O
can	O
manipulate	O
file	O
flags	O
that	O
the	O
jails	O
may	O
not	O
be	O
able	O
to	O
manipulate	O
.	O
</s>
<s>
When	O
compiled	O
with	O
the	O
option	O
REGRESSION	O
,	O
a	O
new	O
sysctl	B-Application
is	O
added	O
to	O
the	O
FreeBSD	O
kernel	B-Operating_System
that	O
allows	O
the	O
securelevel	B-Operating_System
to	O
be	O
lowered	O
for	O
the	O
purposes	O
of	O
automated	O
regression	O
testing	O
.	O
</s>
<s>
On	O
OpenBSD	O
the	O
securelevels	B-Operating_System
are	O
defined	O
as	O
follows	O
:	O
</s>
<s>
-1	O
(	O
Permanently	O
insecure	O
mode	O
)	O
is	O
functionally	O
identical	O
to	O
securelevel	B-Operating_System
0	O
except	O
the	O
Kernel	B-Operating_System
will	O
never	O
attempt	O
to	O
increase	O
the	O
level	O
as	O
it	O
would	O
in	O
level	O
0	O
.	O
</s>
<s>
This	O
effectively	O
disables	O
the	O
securelevel	B-Operating_System
protections	O
.	O
</s>
<s>
This	O
mode	O
is	O
typically	O
used	O
while	O
the	O
system	O
is	O
booting	O
,	O
and	O
once	O
the	O
boot	O
is	O
completed	O
and	O
the	O
system	O
enters	O
multi-user	B-Operating_System
mode	O
,	O
it	O
is	O
elevated	O
to	O
level	O
1	O
.	O
</s>
<s>
1	O
(	O
Secure	O
mode	O
)	O
is	O
the	O
default	O
mode	O
when	O
the	O
system	O
is	O
booted	O
into	O
multi-user	B-Operating_System
mode	O
.	O
</s>
<s>
In	O
this	O
mode	O
the	O
securelevel	B-Operating_System
cannot	O
be	O
lowered	O
,	O
the	O
raw	O
memory	O
devices	O
cannot	O
be	O
written	O
to	O
,	O
the	O
raw	O
devices	O
of	O
mounted	O
file	O
systems	O
cannot	O
be	O
written	O
to	O
,	O
important	O
kernel	B-Operating_System
variables	O
(	O
such	O
as	O
fs.posix.setuid	O
,	O
hw.allowpowerdown	O
,	O
net.inet.ip.sourceroute	O
,	O
machdep.kbdreset	O
,	O
ddb.console	O
,	O
ddb.panic	O
and	O
machdep.allowaperture	O
)	O
are	O
locked	O
down	O
and	O
only	O
GPIO	B-Architecture
pins	O
that	O
were	O
present	O
during	O
boot	O
may	O
be	O
accessed	O
.	O
</s>
<s>
2	O
(	O
Highly	O
secure	O
mode	O
)	O
has	O
the	O
same	O
effects	O
as	O
securelevel	B-Operating_System
1	O
,	O
with	O
the	O
additions	O
of	O
raw	O
disk	O
devices	O
cannot	O
be	O
written	O
to	O
even	O
if	O
unmounted	O
,	O
certain	O
time	O
related	O
functions	O
are	O
locked	O
down	O
so	O
the	O
time	O
cannot	O
be	O
set	O
in	O
the	O
past	O
(	O
to	O
help	O
ensure	O
the	O
times	O
of	O
actions	O
recorded	O
in	O
the	O
logs	O
are	O
accurate	O
)	O
and	O
pf	B-Protocol
rules	O
may	O
not	O
be	O
altered	O
.	O
</s>
<s>
This	O
mode	O
is	O
designed	O
to	O
provide	O
some	O
semblance	O
of	O
defense	O
in	O
the	O
event	O
that	O
the	O
root	B-Application
user	I-Application
account	O
is	O
compromised	O
.	O
</s>
