xref: /openbsd-src/share/man/man8/security.8 (revision b9f606a97458e9c423b5d67f252053cab05afc9b)
1*b9f606a9Skrw.\" $OpenBSD: security.8,v 1.27 2024/12/24 17:08:50 krw Exp $
232a4fddaSderaadt.\"
332a4fddaSderaadt.\" David Leonard, 2001. Public Domain.
432a4fddaSderaadt.\"
5*b9f606a9Skrw.Dd $Mdocdate: December 24 2024 $
661d8f211Sd.Dt SECURITY 8
761d8f211Sd.Os
861d8f211Sd.Sh NAME
961d8f211Sd.Nm security
1061d8f211Sd.Nd periodic system security check
1161d8f211Sd.Sh DESCRIPTION
1297d4be7bSaaron.Nm
1361d8f211Sdis a command script that examines the system for some signs of security
1461d8f211Sdweaknesses.
1561d8f211SdIt is only a security aid and does not offer complete protection.
1697d4be7bSaaron.Nm
1733d3bba6Sschwarzeis run by
1833d3bba6Sschwarze.Xr daily 8 ,
1933d3bba6Sschwarzewhich mails any output to root on a daily basis.
2061d8f211Sd.Pp
2161d8f211SdThe
2297d4be7bSaaron.Nm
2361d8f211Sdscript carries out the following list of simple checks:
2461d8f211Sd.Bl -bullet
2561d8f211Sd.It
2695443b29SjmcCheck the
2795443b29Sjmc.Xr master.passwd 5
2861d8f211Sdand
2961d8f211Sd.Xr group 5
3061d8f211Sdfiles for
3161d8f211Sdsyntax, empty passwords, partially closed accounts,
3297d4be7bSaaronsuspicious UIDs, suspicious GIDs, and duplicate entries.
3361d8f211Sd.It
3461d8f211SdCheck root's home directory and login environment for
3597d4be7bSaaroninsecure permissions, suspicious paths, and umask commands in the
3697d4be7bSaarondotfiles.
3761d8f211Sd.It
3861d8f211SdCheck for suspicious commands in
3997d4be7bSaaron.Pa /etc/mail/aliases .
4061d8f211Sd.It
41a727ae52SajacoutotCheck for insecurities in
4297d4be7bSaaron.Pa /etc/hosts.lpd .
4361d8f211Sd.It
4461d8f211SdCheck user
4597d4be7bSaaron.Pa .rhosts
4697d4be7bSaaronand
4797d4be7bSaaron.Pa .shosts
4897d4be7bSaaronfiles for open access.
4961d8f211Sd.It
5097d4be7bSaaronCheck user home directory permissions.
5161d8f211Sd.It
5297d4be7bSaaronCheck many user dotfile permissions.
5361d8f211Sd.It
5497d4be7bSaaronCheck user mailbox permissions.
5561d8f211Sd.It
5661d8f211SdCheck NFS
5761d8f211Sd.Xr exports 5
5897d4be7bSaaronfile for global export entries.
5961d8f211Sd.It
6097d4be7bSaaronCheck for changes in setuid/setgid files and devices.
6161d8f211Sd.It
6297d4be7bSaaronCheck disk ownership and permissions.
6361d8f211Sd.It
6497d4be7bSaaronCheck for changes in the device file list.
6561d8f211Sd.It
6682651569SpvalchevCheck for permission changes in special files and system binaries listed in
67a09ec6a9Sjmc.Pa /etc/mtree/special .
68a09ec6a9Sjmc.Nm
69a09ec6a9Sjmcalso provides hooks for administrators to create their own lists.
70a09ec6a9SjmcThese lists should be kept in
71a09ec6a9Sjmc.Pa /etc/mtree/
72a09ec6a9Sjmcand filenames must have the suffix
73a09ec6a9Sjmc.Dq .secure .
74a09ec6a9SjmcThe following example shows how to create such a list,
7537d9c4b2Sschwarzeto protect the programs in
7637d9c4b2Sschwarze.Pa /bin :
77a09ec6a9Sjmc.Bd -literal -offset 4n
7837d9c4b2Sschwarze# mtree -cx -p /bin -K sha256digest,type > /etc/mtree/bin.secure
7937d9c4b2Sschwarze# chown root:wheel /etc/mtree/bin.secure
8037d9c4b2Sschwarze# chmod 600 /etc/mtree/bin.secure
81a09ec6a9Sjmc.Ed
82a09ec6a9Sjmc.Pp
8361d8f211Sd.Sy Note:
84a09ec6a9SjmcThese checks do not provide complete protection against
85180457b5SteduTrojan horse binaries, as
8661d8f211Sdthe miscreant can modify the tree specification to match the replaced binary.
8761d8f211SdFor details on really protecting yourself against modified binaries, see
8861d8f211Sd.Xr mtree 8 .
8961d8f211Sd.It
90f372d47bSjmcCheck for changes in files listed in
9197d4be7bSaaron.Pa /etc/changelist .
92f372d47bSjmcFiles being created or deleted,
93f372d47bSjmcas well as content change in the files themselves,
94f372d47bSjmcare reported.
95db5e617bSjmcSee
96db5e617bSjmc.Xr changelist 5
97db5e617bSjmcfor further details.
984d9a9439Sjmc.It
99*b9f606a9SkrwCheck for changes to the disklabels and partition tables of mounted disks.
1007f0aaceaSjmc.It
1017f0aaceaSjmcReport on the installation or removal of any system
1027f0aaceaSjmc.Xr package 5 .
1035c0106daSsthen.It
1045c0106daSsthenCheck
1055c0106daSsthen.Xr hostname.if 5
1065c0106daSsthenfile permissions.
10761d8f211Sd.El
10861d8f211Sd.Pp
10961d8f211SdThe intent of the
11097d4be7bSaaron.Nm
11161d8f211Sdscript is to point out some obvious holes to the system administrator.
112582bad88Sschwarze.Sh ENVIRONMENT
113582bad88SschwarzeThe following variables can be set in
114582bad88Sschwarze.Pa /etc/daily.local :
115582bad88Sschwarze.Pp
116582bad88Sschwarze.Bl -tag -width "SUIDSKIP" -compact
117582bad88Sschwarze.It Ev SUIDSKIP
118582bad88SschwarzeA whitespace-separated list of absolute paths to be skipped
119582bad88Sschwarzein setuid/setgid file checks and in device special file checks.
1204e8db10eSschwarzeAvoid trailing slashes.
121582bad88Sschwarze.El
12297d4be7bSaaron.Sh FILES
12397d4be7bSaaron.Bl -tag -width /dev/changelist -compact
124db5e617bSjmc.It Pa /etc/changelist
12597d4be7bSaaron.It Pa /etc/daily
12697d4be7bSaaron.It Pa /etc/mtree
12717f5af57Sjmc.It Pa /usr/libexec/security
12897d4be7bSaaron.It Pa /var/backups
12997d4be7bSaaron.El
13097d4be7bSaaron.Sh SEE ALSO
131db5e617bSjmc.Xr changelist 5 ,
132db5e617bSjmc.Xr daily 8 ,
13397d4be7bSaaron.Xr mtree 8
13471a30b1fSschwarze.Sh HISTORY
13571a30b1fSschwarzeA
13671a30b1fSschwarze.Nm
13771a30b1fSschwarzeshell script appeared in
13871a30b1fSschwarze.Bx 4.3 Reno ,
13971a30b1fSschwarzebut most functionality only came with
14071a30b1fSschwarze.Bx 4.4 .
14171a30b1fSschwarze.Sh AUTHORS
14227e95970Sschwarze.An -nosplit
14327e95970SschwarzeThe present manual was written by
14427e95970Sschwarze.An David Leonard
14527e95970Sschwarzefor
14671a30b1fSschwarze.Ox 2.9 .
14727e95970Sschwarze.An Andrew Fresh Aq Mt afresh1@openbsd.org
14827e95970Sschwarzeand
14927e95970Sschwarze.An Ingo Schwarze Aq Mt schwarze@openbsd.org
15027e95970Sschwarzerewrote
15171a30b1fSschwarze.Nm
15271a30b1fSschwarzefrom scratch in
15371a30b1fSschwarze.Xr perl 1
15471a30b1fSschwarzefor
15571a30b1fSschwarze.Ox 5.0 .
15661d8f211Sd.Sh BUGS
15761d8f211SdThe name of this script may provide a false sense of
15861d8f211Sd.Nm security .
15961d8f211Sd.\" Well, I thought it was amusing.
16061d8f211Sd.Pp
16161d8f211SdThere are perhaps an infinite number of ways the system can be compromised
16261d8f211Sdwithout this script noticing.
163