Bug 2213958

Summary: Rules "Set Existing Passwords Maximum/Minimum Age" apply to non-local users as well
Product: Red Hat Enterprise Linux 9 Reporter: Renaud Métrich <rmetrich>
Component: scap-security-guideAssignee: Jan Černý <jcerny>
Status: CLOSED ERRATA QA Contact: Milan Lysonek <mlysonek>
Severity: medium Docs Contact: Jan Fiala <jafiala>
Priority: medium    
Version: 9.2CC: ggasparb, jafiala, jcerny, jjaburek, mhaicman, mlysonek, myllynen, openscap-maint, vpolasek
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: scap-security-guide-0.1.69-1.el9 Doc Type: Bug Fix
Doc Text:
.Password age rules apply only to local users Some compliance profiles, for example CIS and DISA STIG, contain the following rules checking password age and password expiration of user account passwords: * `accounts_password_set_max_life_existing` * `accounts_password_set_min_life_existing` * `accounts_password_set_warn_age_existing` * `accounts_set_post_pw_existing` These rules correctly check the configuration of local users. Previously, the scanner also incorrectly checked the configuration of remote users provided by network sources such as NSS even though the remediation scripts could not change remote users’ configuration. This was because the OpenSCAP scanner previously used the `getpwent()` system call. This update changes the internal implementation of these rules to depend only on the data from the `/etc/shadow` file. As a result, the rules now apply only to the local users’ configuration.
Story Points: ---
Clone Of:
: 2228467 2228468 (view as bug list) Environment:
Last Closed: 2023-11-07 08:37:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2228467, 2228468    

Description Renaud Métrich 2023-06-10 10:56:04 UTC
Description of problem:

e.g. xccdf_org.ssgproject.content_rule_accounts_password_set_max_life_existing

This is a similar to BZ #2203791 but for password check.

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
 30   <unix:shadow_object id="object_shadow_password_users_max_life_existing" version="1">
 31     <unix:username operation="pattern match">.*</unix:username>
 32     <filter action="include">filter_no_passwords_or_locked_accounts_max_life</filter>
 33   </unix:shadow_object>
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

The implementation relies on "unix:shadow_object" which makes use of getpwent(), which browses all users provides by the NSS "shadow" map:

Source code (src/OVAL/probes/unix/shadow_probe.c):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
180 static int read_shadow(SEXP_t *un_ent, probe_ctx *ctx)
181 {
182         int err = 1;
183         struct spwd *pw;
184 
185         while ((pw = getspent())) {
 :
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Systems using 3rd party CentrifyDC NSS provider have a "shadow: centrifydc" line in /etc/nsswitch.conf, causing the remote users to be affected by these rules.

Version-Release number of selected component (if applicable):

scap-security-guide
openscap-scanner

How reproducible:

Always on Centrify systems

Comment 2 Jan Černý 2023-07-13 13:40:30 UTC
A pull request has been submitted to upstream for a review https://github.com/ComplianceAsCode/content/pull/10838

Comment 3 Jan Černý 2023-07-18 11:46:52 UTC
a fix has been merged upstream in https://github.com/ComplianceAsCode/content/pull/10838

Comment 21 errata-xmlrpc 2023-11-07 08:37:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (scap-security-guide bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6552