1.\" Copyright (c) 2011-2015 Devin Teske
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd July 20, 2018
26.Dt CHECK-PASSWORD.4TH 7
27.Os
28.Sh NAME
29.Nm check-password.4th
30.Nd loader password-checking boot module
31.Sh DESCRIPTION
32The file that goes by the name of
33.Nm
34is a set of commands designed to do one or more of the following:
35.Pp
36.Dl o Prevent booting without password
37.Dl o Prevent modification of boot options without password
38.Pp
39The commands of
40.Nm
41by themselves are not enough for most uses.
42Please refer to the
43examples below for the most common situations, and to
44.Xr loader 7
45for additional commands.
46.Pp
47Before using any of the commands provided in
48.Nm ,
49it must be included
50through the command:
51.Pp
52.Dl include check-password.4th
53.Pp
54This line is present in
55.Pa /boot/forth/loader.4th
56file, so it is not needed (and should not be re-issued) in a normal setup.
57.Pp
58The commands provided by it are:
59.Pp
60.Bl -tag -width disable-module_module -compact -offset indent
61.It Ic check-password
62Multi-purpose function that can protect the interactive boot menu,
63prevent boot without password
64.Pq depending on Xr loader.conf 5 settings .
65.Pp
66First checks
67.Va bootlock_password
68and if-set, the user cannot continue until the correct password is entered.
69.Pp
70Last, checks
71.Va password
72and if-set, tries to
73.Ic autoboot
74and only prompts for password on failure or user-interrupt.
75See
76.Xr loader.conf 5
77for additional information.
78.El
79.Pp
80The environment variables that effect its behavior are:
81.Bl -tag -width bootlock_password -offset indent
82.It Va bootlock_password
83Sets the bootlock password (up to 16 characters long) that is required by
84.Ic check-password
85to be entered before the system is allowed to boot.
86.It Va password
87Sets the password (up to 16 characters long) that is required by
88.Ic check-password
89before the user is allowed to visit the boot menu.
90.El
91.Sh FILES
92.Bl -tag -width /boot/forth/check-password.4th -compact
93.It Pa /boot/loader
94The
95.Xr loader 7 .
96.It Pa /boot/forth/check-password.4th
97.Nm
98itself.
99.It Pa /boot/loader.rc
100.Xr loader 7
101bootstrapping script.
102.El
103.Sh EXAMPLES
104Standard i386
105.Pa /boot/loader.rc :
106.Pp
107.Bd -literal -offset indent -compact
108include /boot/forth/loader.4th
109check-password
110.Ed
111.Pp
112Set a password in
113.Xr loader.conf 5
114to prevent modification of boot options:
115.Pp
116.Bd -literal -offset indent -compact
117password="abc123"
118.Ed
119.Pp
120Set a password in
121.Xr loader.conf 5
122to prevent booting without password:
123.Pp
124.Bd -literal -offset indent -compact
125bootlock_password="boot"
126.Ed
127.Sh SEE ALSO
128.Xr loader.conf 5 ,
129.Xr loader 7 ,
130.Xr loader.4th 7
131