1.\"
2.\" SPDX-License-Identifier: BSD-2-Clause
3.\"
4.\" Copyright (c) 2023 Fernando Apesteguia <fernando.apesteguia@gmail.com>
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd September 18, 2023
28.Dt SAVE-ENTROPY 8
29.Os
30.Sh NAME
31.Nm save-entropy
32.Nd Save bits of entropy to feed /dev/random at startup
33.Sh SYNOPSIS
34.Nm save-entropy
35.Sh DESCRIPTION
36The
37.Nm
38command is used to save entropy data from
39.Pa /dev/random
40to files in a specified output location.
41The files saved are used at startup to provide additional entropy for
42.Pa /dev/random .
43The output file will be different in every invocation until the maximum number
44of different files is reached.
45(See
46.Em entropy_save_num
47for details).
48By default this script is invoked via
49.Xr cron 8
50every eleven minutes approximately.
51.Pp
52This command does nothing if executed inside a
53.Xr jail 8 .
54.Pp
55Three variables in
56.Pa /etc/rc.conf
57regulate the behavior of the script:
58.Bl -tag -width Ds
59.It Va entropy_dir
60Specify the directory for saved entropy files.
61Defaults to
62.Pa /var/db/entropy .
63If set to "NO" it disables caching entropy via
64.Xr cron 8 .
65This setting is shared with
66.Pa /etc/rc.d/random .
67.It Va entropy_save_sz
68Size of the entropy cache files.
69Defaults to 4096.
70.It Va entropy_save_num
71Number of entropy cache files to save.
72Defaults to 8.
73.El
74.Sh FILES
75.Bl -tag -width Ds
76.It Pa /etc/rc.conf
77.El
78.Sh EXIT STATUS
79.Ex -std
80Errors will be recorded in the system log.
81.Sh SEE ALSO
82.Xr syslog 3 ,
83.Xr random 4 ,
84.Xr rc.conf 5 ,
85.Xr cron 8
86.Sh HISTORY
87The
88.Nm
89command first appeared in
90.Fx 5.0 .
91.Sh AUTHORS
92The
93.Nm
94command was originally written by
95.An Doug Barton <dougb@FreeBSD.org> .
96This manual page was written by
97.An Fernando Apesteguia <fernape@FreeBSD.org> .
98