Bug 2213958 - Rules "Set Existing Passwords Maximum/Minimum Age" apply to non-local users as well
Summary: Rules "Set Existing Passwords Maximum/Minimum Age" apply to non-local users a...
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: scap-security-guide
Version: 9.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jan Černý
QA Contact: Milan Lysonek
URL:
Whiteboard:
Depends On:
Blocks: 2228467 2228468
TreeView+ depends on / blocked
 
Reported: 2023-06-10 10:56 UTC by Renaud Métrich
Modified: 2023-08-16 09:12 UTC (History)
8 users (show)

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.
Clone Of:
: 2228467 2228468 (view as bug list)
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-159440 0 None None None 2023-06-10 10:56:27 UTC

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


Note You need to log in before you can comment on or make changes to this bug.