Skip to content

Commit 2233943

Browse files
committed
Support setting the new variable PASSWDSKIP in /etc/daily.local to prevent
security(8) from complaining about specific accounts that have no password, typically used for services like anoncvs and gotd. In addition to improving support for gotd, this also improves security for everyone because the exception will now only exist on machines where the admin explicitly enables it. Based on an idea from stsp@; OK stsp@. (Actually, sthen@ also mentioned a similar idea in 2009, and afresh1@ indicated potential support for the general direction in 2024.)
1 parent 6cbbb38 commit 2233943

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

Diff for: etc/daily

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# $OpenBSD: daily,v 1.100 2024/07/04 05:06:58 bket Exp $
2+
# $OpenBSD: daily,v 1.101 2025/03/31 17:35:28 schwarze Exp $
33
# From: @(#)daily 8.2 (Berkeley) 1/25/94
44
#
55
# For local additions, create the file /etc/daily.local.
@@ -173,7 +173,7 @@ MAINOUT=/var/log/security.out
173173
install -o 0 -g 0 -m 600 -b /dev/null $MAINOUT
174174

175175
start_part "Running security(8):"
176-
export SUIDSKIP
176+
export PASSWDSKIP SUIDSKIP
177177
/usr/libexec/security
178178
end_part
179179
rm -f $PARTOUT

Diff for: libexec/security/security

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/perl -T
22

3-
# $OpenBSD: security,v 1.47 2025/03/09 20:10:17 phessler Exp $
3+
# $OpenBSD: security,v 1.48 2025/03/31 17:35:28 schwarze Exp $
44
#
55
# Copyright (c) 2011, 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
66
# Copyright (c) 2011 Andrew Fresh <andrew@afresh1.com>
@@ -75,7 +75,9 @@ sub check_passwd {
7575
my $filename = '/etc/master.passwd';
7676
$check_title = "Checking the $filename file:";
7777
nag !(open my $fh, '<', $filename), "open: $filename: $!" and return;
78-
my (%logins, %uids);
78+
my (%logins, %uids, %skip);
79+
%skip = map { $_ => 1 } split ' ', $ENV{PASSWDSKIP}
80+
if $ENV{PASSWDSKIP};
7981
while (my $line = <$fh>) {
8082
chomp $line;
8183
nag $line !~ /\S/,
@@ -96,8 +98,7 @@ sub check_passwd {
9698
}
9799
nag length $name > 31,
98100
"Login $name has more than 31 characters.";
99-
nag $pwd eq '' && !($name eq 'anoncvs' &&
100-
$shell =~ /\/anoncvssh$/),
101+
nag $pwd eq '' && !$skip{"$name:$shell"},
101102
"Login $name has no password.";
102103
if ($pwd ne '' &&
103104
$pwd ne 'skey' &&

Diff for: share/man/man8/security.8

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.\" $OpenBSD: security.8,v 1.27 2024/12/24 17:08:50 krw Exp $
1+
.\" $OpenBSD: security.8,v 1.28 2025/03/31 17:35:28 schwarze Exp $
22
.\"
33
.\" David Leonard, 2001. Public Domain.
44
.\"
5-
.Dd $Mdocdate: December 24 2024 $
5+
.Dd $Mdocdate: March 31 2025 $
66
.Dt SECURITY 8
77
.Os
88
.Sh NAME
@@ -113,7 +113,18 @@ script is to point out some obvious holes to the system administrator.
113113
The following variables can be set in
114114
.Pa /etc/daily.local :
115115
.Pp
116-
.Bl -tag -width "SUIDSKIP" -compact
116+
.Bl -tag -width "PASSWDSKIP" -compact
117+
.It Ev PASSWDSKIP
118+
A whitespace-separated list of
119+
.Ar name : Ns Ar shell
120+
pairs allowed to have empty passwords.
121+
For example, a machine running both CVS and gotd for anonymous access
122+
might set:
123+
.Bd -literal -offset indent
124+
PASSWDSKIP="anoncvs:/usr/local/bin/anoncvssh
125+
anonymous:/usr/local/bin/gotsh"
126+
.Ed
127+
.Pp
117128
.It Ev SUIDSKIP
118129
A whitespace-separated list of absolute paths to be skipped
119130
in setuid/setgid file checks and in device special file checks.

0 commit comments

Comments
 (0)