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: VERIFIED --- QA Contact: Milan Lysonek <mlysonek>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.2CC: ggasparb, 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, eg. CIS or DISA STIG, contain rules checking password age and password expiration of user account passwords. Specifically, we are talking about these rules: accounts_password_set_max_life_existing, accounts_password_set_min_life_existing, accounts_password_set_warn_age_existing, accounts_set_post_pw_existing. Previously, these rules checked not only configuration of local users but they also evaluated configuration of remote users provided by network sources such as NSS. This behavior was caused by using the `getpwent()` system call in the OpenSCAP scanner. This behavior wasn't desired, behavior the remediation scripts weren't able to change the configuration of the remote users. Therefore, the internal implementation of the aforementioned rules has been changed to depend only on data present in the "/etc/shadow" file. That means no other sources of user metadata are read by the rules. As a result, the rules now consider only local users configuration.
Story Points: ---
Clone Of:
: 2228467 2228468 (view as bug list) Environment:
Last Closed: 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