xref: /netbsd-src/share/man/man5/security.conf.5 (revision af2e7883caa7919039fabe48d01b559d16a288f1)
1*af2e7883Splunky.\"	$NetBSD: security.conf.5,v 1.44 2024/11/14 19:57:41 plunky Exp $
25fb9b573Smrg.\"
35fb9b573Smrg.\" Copyright (c) 1996 Matthew R. Green
45fb9b573Smrg.\" All rights reserved.
55fb9b573Smrg.\"
65fb9b573Smrg.\" Redistribution and use in source and binary forms, with or without
75fb9b573Smrg.\" modification, are permitted provided that the following conditions
85fb9b573Smrg.\" are met:
95fb9b573Smrg.\" 1. Redistributions of source code must retain the above copyright
105fb9b573Smrg.\"    notice, this list of conditions and the following disclaimer.
115fb9b573Smrg.\" 2. Redistributions in binary form must reproduce the above copyright
125fb9b573Smrg.\"    notice, this list of conditions and the following disclaimer in the
135fb9b573Smrg.\"    documentation and/or other materials provided with the distribution.
145fb9b573Smrg.\"
155fb9b573Smrg.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
165fb9b573Smrg.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
175fb9b573Smrg.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
185fb9b573Smrg.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
195fb9b573Smrg.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
205fb9b573Smrg.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
215fb9b573Smrg.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
225fb9b573Smrg.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
235fb9b573Smrg.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
245fb9b573Smrg.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
255fb9b573Smrg.\" SUCH DAMAGE.
265fb9b573Smrg.\"
27d5fdd803Swiz.Dd December 2, 2020
285fb9b573Smrg.Dt SECURITY.CONF 5
297a1aea16Sgarbled.Os
305fb9b573Smrg.Sh NAME
315fb9b573Smrg.Nm security.conf
325fb9b573Smrg.Nd daily security check configuration file
335fb9b573Smrg.Sh DESCRIPTION
345fb9b573SmrgThe
355fb9b573Smrg.Nm
365fb9b573Smrgfile specifies which of the standard
375fb9b573Smrg.Pa /etc/security
3898ae7790Sgrantservices are performed.
3998ae7790SgrantThe
405fb9b573Smrg.Pa /etc/security
415fb9b573Smrgscript is run, by default, every night from
425fb9b573Smrg.Pa /etc/daily ,
435fb9b573Smrgon a
445fb9b573Smrg.Nx
455fb9b573Smrgsystem, if configured do to so from
465fb9b573Smrg.Pa /etc/daily.conf .
475fb9b573Smrg.Pp
485fb9b573SmrgThe variables described below can be set to "NO" to disable the test:
491797e170Sjmmv.Bl -tag -width check_pkg_vulnerabilities
50cba96d16Sriastradh.It Sy check_entropy
51cba96d16SriastradhThis checks whether the system has enough entropy
52cba96d16Sriastradh.Pq see Xr entropy 7 .
535fb9b573Smrg.It Sy check_passwd
545fb9b573SmrgThis checks the
555fb9b573Smrg.Pa /etc/master.passwd
5698ae7790Sgrantfile for inconsistencies.
575fb9b573Smrg.It Sy check_group
585fb9b573SmrgThis checks the
595fb9b573Smrg.Pa /etc/group
602be4d47bSperryfile for inconsistencies.
615fb9b573Smrg.It Sy check_rootdotfiles
625fb9b573SmrgThis checks the root users startup files for sane settings of $PATH
6398ae7790Sgrantand umask.
6498ae7790SgrantThis test is not fail safe and any warning generated from
655fb9b573Smrgthis should be checked for correctness.
665fb9b573Smrg.It Sy check_ftpusers
675fb9b573SmrgThis checks that the correct users are in the
685fb9b573Smrg.Pa /etc/ftpusers
695fb9b573Smrgfile.
705fb9b573Smrg.It Sy check_aliases
715fb9b573SmrgThis checks for security problems in the
7213c8f7a2Sitojun.Pa /etc/mail/aliases
735fb9b573Smrgfile.
7413c8f7a2SitojunFor backward compatibility,
7513c8f7a2Sitojun.Pa /etc/aliases
7613c8f7a2Sitojunwill be checked as well if exists.
775fb9b573Smrg.It Sy check_rhosts
785fb9b573SmrgThis checks for system and user rhosts files with "+" in them.
795fb9b573Smrg.It Sy check_homes
80d76f0743SlukemThis checks that home directories are owned by the correct user,
81d76f0743Slukemand have appropriate permissions.
825fb9b573Smrg.It Sy check_varmail
835fb9b573SmrgThis checks that the correct user owns mail in
845fb9b573Smrg.Pa /var/mail ,
855fb9b573Smrgand that the mail box has the right permissions.
865fb9b573Smrg.It Sy check_nfs
875fb9b573SmrgThis checks that the
885fb9b573Smrg.Pa /etc/exports
895fb9b573Smrgfile does not export filesystems to the world.
905fb9b573Smrg.It Sy check_devices
915fb9b573SmrgThis checks for changes to devices and setuid files.
925fb9b573Smrg.It Sy check_mtree
935fb9b573SmrgThis runs
945fb9b573Smrg.Xr mtree 8
955fb9b573Smrgto ensure that the system is installed correctly.
96d76f0743SlukemThe following configuration files are checked:
97d76f0743Slukem.Bl -tag -width 4n
98d76f0743Slukem.It Pa /etc/mtree/special
99d76f0743SlukemDefault files to check.
100d76f0743Slukem.It Pa /etc/mtree/special.local
10125ac1dd2SsborrillLocal site additions and overrides.
102d76f0743Slukem.It Pa /etc/mtree/DIR.secure
103d76f0743SlukemSpecification for the directory
104d76f0743Slukem.Pa DIR .
105d76f0743Slukem.El
1068d2c1463Slukem.It Sy check_disklabels
1078d2c1463SlukemBackup text copies of the disklabels of available disk drives into
108d76f0743Slukem.Pa /var/backups/work/disklabel.XXX ,
1098d2c1463Slukemand display any differences in those and the previous copies
1108d2c1463Slukemas per
1118d2c1463Slukem.Sy check_changelist
1128d2c1463Slukembelow.
113d76f0743SlukemIf
114d76f0743Slukem.Xr fdisk 8
115d76f0743Slukemis available on the current platform, the output of
116d76f0743Slukem.Pa /sbin/fdisk
117d76f0743Slukemfor each available disk drive is stored in
118d76f0743Slukem.Pa /var/backups/work/fdisk.XXX ,
119d76f0743Slukemand any differences displayed as per the disklabels.
120e018ea93Satatat.It Sy check_pkgs
121e018ea93SatatatThis stores a list of all installed pkgs into
122d76f0743Slukem.Pa /var/backups/work/pkgs
123e018ea93Satatatand checks it for any changes.
1245fb9b573Smrg.It Sy check_changelist
125d76f0743SlukemThis determines a list of files from the contents of
126d76f0743Slukem.Pa /etc/changelist ,
127d76f0743Slukemand the output of
128d76f0743Slukem.Ic mtree -D
129d76f0743Slukemfor
130d76f0743Slukem.Pa /etc/mtree/special
131d76f0743Slukemand
132d76f0743Slukem.Pa /etc/mtree/special.local .
133d76f0743SlukemFor each file in the list it compares the files with their backups in
134fea7c962Srat.Pa /var/backups/file.current
1355fb9b573Smrgand
1368d2c1463Slukem.Pa /var/backups/file.backup ,
1378d2c1463Slukemand displays any differences found.
138d76f0743SlukemThe following
139d76f0743Slukem.Xr mtree 8
140d76f0743Slukem.Sy tags
141d76f0743Slukemmodify how files are determined from
142d76f0743Slukem.Pa /etc/mtree/special
143d76f0743Slukemand
144d76f0743Slukem.Pa /etc/mtree/special.local :
145d76f0743Slukem.Bl -tag -width exclude -offset indent
146d76f0743Slukem.It exclude
147d76f0743SlukemThe entry is ignored; no backups are made and the differences are not
148d76f0743Slukemdisplayed.
149d76f0743SlukemThis includes dynamic or binary files such as
150d76f0743Slukem.Pa /var/run/utmp .
151d76f0743Slukem.It nodiff
152d76f0743SlukemThe entry is backed up but the differences are not displayed because
153d76f0743Slukemthe contents of the file are sensitive.
154d76f0743SlukemThis includes files such as
155d76f0743Slukem.Pa /etc/master.passwd .
156d76f0743Slukem.El
1571797e170Sjmmv.It Sy check_pkg_vulnerabilities
1581797e170SjmmvChecks the currently installed packages against a database of known
1591797e170Sjmmvvulnerabilities and reports those that are vulnerable.
1601797e170SjmmvCheck the
1611797e170Sjmmv.Sy fetch_pkg_vulnerabilities
1621797e170Sjmmvsetting in
1631797e170Sjmmv.Xr daily.conf 5
1641797e170Sjmmvto keep the database up to date.
1651797e170Sjmmv.It Sy check_pkg_signatures
1661797e170SjmmvChecks the digital signature of all files installed by packages against
1671797e170Sjmmvthe expected values stored in the packages database.
1685fb9b573Smrg.El
1695fb9b573Smrg.Pp
170dade5b29SabsThe variables described below can be set to modify the tests:
171dade5b29Sabs.Bl -tag -width check_network
172f51cb566Sjhawk.It Sy check_homes_permit_usergroups
173f51cb566SjhawkDuring the
174f51cb566Sjhawk.Sy check_homes
175f51cb566Sjhawkphase, allow the checked files to be group-writable if the group name is
176f51cb566Sjhawkthe same as the username.
177acaf72ecSspz.It Sy check_homes_permit_other_owner
178acaf72ecSspzDuring the
179acaf72ecSspz.Sy check_homes
180acaf72ecSspzphase, allow the home directory and files of the listed users to be owned
181acaf72ecSspzby a different user.
18289366510Serh.It Sy check_devices_ignore_fstypes
18389366510SerhLists filesystem types to ignore during the
18489366510Serh.Sy check_devices
185dd9f3398Swizphase.
186dd9f3398SwizPrefixing the type with a
187dd9f3398Swiz.Sq \&!
188dd9f3398Swizinverts the match.
189dd9f3398SwizFor example,
19089366510Serh.Ql procfs !local
19189366510Serhwill ignore
19289366510Serh.Ql procfs
19389366510Serhtype filesystems and filesystems that are not
19489366510Serh.Ql local .
1956d23caf2Slukem.It Sy check_devices_ignore_paths
1966d23caf2SlukemLists pathnames to ignore during the
1976d23caf2Slukem.Sy check_devices
1986d23caf2Slukemphase.
1996d23caf2SlukemPrefixing the path with a
2006d23caf2Slukem.Sq \&!
2016d23caf2Slukeminverts the match.
2026d23caf2SlukemFor example,
203a58ea03aSwiz.Ql /tftp
2046d23caf2Slukemwill ignore paths under
2056d23caf2Slukem.Pa /tftp
206a58ea03aSwizwhile
207a58ea03aSwiz.Ql !/home
208a58ea03aSwizwill ignore paths that are not under
2096d23caf2Slukem.Pa /home .
210a296dc30Sjhawk.It Sy check_mtree_follow_symlinks
211a296dc30SjhawkDuring the
212a296dc30Sjhawk.Sy check_mtree
213a296dc30Sjhawkphase, instruct mtree to follow symbolic links.
21425ac1dd2SsborrillPlease note, this may cause the
21525ac1dd2Ssborrill.Sy check_mtree
21625ac1dd2Ssborrillphase to report errors for entries for these symbolic links (i.e. of
21725ac1dd2Ssborrilltype=link in the mtree specification) as they will always appear to be plain
21825ac1dd2Ssborrillfiles for the purposes of the check.
21925ac1dd2Ssborrill.Pa /etc/mtree/special.local
22025ac1dd2Ssborrillmay be used to override the checks for the affected links.
221e6eebcadSjhawk.It Sy check_passwd_nowarn_shells
222e6eebcadSjhawkIf
223e6eebcadSjhawk.Sy check_passwd
224e6eebcadSjhawkis enabled, most warnings will be suppressed for entries whose shells
2252be4d47bSperryare listed in this space-separated list.
226fcbdb4caSwizThis is of particular value when those shells are not in
227e6eebcadSjhawk.Pa /etc/shells .
228e6eebcadSjhawk.It Sy check_passwd_nowarn_users
229e6eebcadSjhawkIf
230e6eebcadSjhawk.Sy check_passwd
231e6eebcadSjhawkis enabled, suppress warnings for these users.
232aca1a7dfSspz.It Sy check_passwd_permit_dups
233aca1a7dfSspzIf
234aca1a7dfSspz.Sy check_passwd
235aca1a7dfSspzis enabled, do not warn about duplicate uids for the listed login names.
2368e401e6cSjdolecek.It Sy check_passwd_permit_nonalpha
2378e401e6cSjdolecekIf
2388e401e6cSjdolecek.Sy check_passwd
239f5e9b507Swizis enabled, do not warn about login names which use non-alphanumeric
2408e401e6cSjdolecekcharacters.
241e6eebcadSjhawk.It Sy check_passwd_permit_star
242e6eebcadSjhawkIf
243e6eebcadSjhawk.Sy check_passwd
244e6eebcadSjhawkis enabled, do not warn about password fields set to
245e6eebcadSjhawk.Dq * .
246e6eebcadSjhawkNote that the use of password fields such as
247e6eebcadSjhawk.Dq *ssh
248e6eebcadSjhawkis encouraged, instead.
2494ceebb11Sjdolecek.It Sy max_grouplen
2504ceebb11SjdolecekIf
2514ceebb11Sjdolecek.Sy check_group
2524ceebb11Sjdolecekis enabled, this determines the maximum permitted length of group names.
253dade5b29Sabs.It Sy max_loginlen
254dade5b29SabsIf
255dade5b29Sabs.Sy check_passwd
256dade5b29Sabsis enabled, this determines the maximum permitted length of login names.
2576258e0bfSabs.It Sy backup_dir
2586258e0bfSabsChange the backup directory from
259*af2e7883Splunky.Pa /var/backups .
2601d79603cSjhawk.It Sy diff_options
2611d79603cSjhawkSpecify the options passed to
2621d79603cSjhawk.Xr diff 1
263fcbdb4caSwizwhen it is invoked to show changes made to system files.
264fcbdb4caSwizDefaults to
2651d79603cSjhawk.Dq -u ,
2661d79603cSjhawkfor unified-format context-diffs.
267d76f0743Slukem.It Sy pkgdb_dir
2687447e9b8Sjmmv.Em DEPRECATED .
2697447e9b8SjmmvPlease set
270f7d285b4Swiz.Dv PKGDB_DIR
2717447e9b8Sjmmvin
2727447e9b8Sjmmv.Xr pkg_install.conf 5
2737447e9b8Sjmmvinstead.
2747447e9b8Sjmmv.Pp
2757447e9b8SjmmvIf defined, points to the location of the packages database.
2767447e9b8SjmmvDefaults to
277d5fdd803Swiz.Pa /usr/pkg/pkgdb .
278e018ea93Satatat.It Sy backup_uses_rcs
279e018ea93SatatatUse
280e018ea93Satatat.Xr rcs 1
281e018ea93Satatatfor maintaining backup copies of files noted in
282e018ea93Satatat.Sy check_devices ,
283e018ea93Satatat.Sy check_disklabels ,
284e018ea93Satatat.Sy check_pkgs ,
285e018ea93Satatatand
286e018ea93Satatat.Sy check_changelist
287e018ea93Satatatinstead of just keeping a current copy and a backup copy.
288c91905c4Sriastradh.It Sy random_file
289c91905c4SriastradhName of the entropy seed file used at boot.
290c91905c4SriastradhDefault is
291c91905c4Sriastradh.Pa /var/db/entropy-file
292c91905c4Sriastradhas used by
293c91905c4Sriastradh.Pa /etc/rc.d/random_seed .
294c91905c4SriastradhSet
295c91905c4Sriastradh.Sy random_file
296c91905c4Sriastradhto empty to disable saving a seed every time
297c91905c4Sriastradh.Pa /etc/security
298c91905c4Sriastradhruns.
299dade5b29Sabs.El
3005fb9b573Smrg.Sh FILES
301f51cb566Sjhawk.Bl -tag -width /etc/defaults/security.conf -compact
302f51cb566Sjhawk.It Pa /etc/defaults/security.conf
303f51cb566Sjhawkdefaults for /etc/security.conf
304fb3a33ffSad.It Pa /etc/security
305fb3a33ffSaddaily security check script
306fb3a33ffSad.It Pa /etc/security.conf
307fb3a33ffSaddaily security check configuration
308fb3a33ffSad.It Pa /etc/security.local
309fb3a33ffSadlocal site additions to
3105fb9b573Smrg.Pa /etc/security
311fb3a33ffSad.El
3125fb9b573Smrg.Sh SEE ALSO
3135fb9b573Smrg.Xr daily.conf 5
3145fb9b573Smrg.Sh HISTORY
3155fb9b573SmrgThe
3165fb9b573Smrg.Nm
3175fb9b573Smrgfile appeared in
3185fb9b573Smrg.Nx 1.3 .
3198d2c1463SlukemThe
3208d2c1463Slukem.Sy check_disklabels
3218d2c1463Slukemfunctionality was added in
3228d2c1463Slukem.Nx 1.4 .
323e018ea93SatatatThe
324e018ea93Satatat.Sy backup_uses_rcs
325e018ea93Satatatand
326e018ea93Satatat.Sy check_pkgs
327e018ea93Satatatfeatures were added in
328e018ea93Satatat.Nx 1.6 .
3291d79603cSjhawk.Sy diff_options
3301d79603cSjhawkappeared in
3313a22d63dSwiz.Nx 2.0 ;
3321d79603cSjhawkprior to that, traditional-format (context free) diffs were generated.
333