Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
The playbooks in /usr/share/scap-security-guide/ansible/*.yml configure
password remembering by means of the pam_unix.so option "remember". This
does not work and causes errors due to SELinux restrictions.
Version-Release number of selected component (if applicable):
scap-security-guide-0.1.46-1.el8.noarch
How reproducible:
Always
Steps to Reproduce:
1. Log in as root on the system (e.g. via SSH).
3. Create an "infra" user with unlimited sudo permissions:
# useradd -m infra
# printf 'infra\ninfra\n' | passwd infra
# echo 'infra ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/infra
4. Log in via SSH as "infra" ans run "sudo su -" to ensure that we have a backup access as root
5. Configure pam_unix to remember the last 12 passwords in /etc/pam.d/system-auth
password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok remember=12
6. Set a password for "root" and expire it:
# printf 'redhat\nredhat\n' | passwd root
# passwd --expire root
7. Try to log in as root on the console (e.g tty2).
Actual results:
After failing to log in the following messages appear in /var/log/secure:
Nov 27 14:20:24 rhel-8-1 login[11407]: pam_unix(login:account): expired password for user root (root enforced)
Nov 27 14:20:52 rhel-8-1 login[11407]: pam_unix(login:chauthtok): can't open /etc/security/opasswd file to check old passwords
Nov 27 14:20:52 rhel-8-1 login[11407]: pam_unix(login:chauthtok): new password not acceptable
Nov 27 14:20:54 rhel-8-1 login[11407]: Authentication token manipulation error
Expected results:
The password should be changed and recorded.
Additional info:
According to Bug 1039089#c7:
The remember functionality of pam_unix is deprecated in upstream PAM.
I'd prefer not developing it further. The SELinux policy in RHEL-6
should not change the opasswd file to shadow_t. This should have been
done only in Fedora/RHEL-7 where the replacement for remember
functionality - that is the pam_pwhistory module has its own
pwhistory_helper for accessing shadow_t files.
The correct way to configure password remembering is documented in
https://access.redhat.com/solutions/2808101
Comment 1Watson Yuuma Sato
2020-01-07 12:16:23 UTC
Hello Carlos, thank you for filing the bug.
Do I understand correctly that this can cause the user to be locked out of the machine?
(In reply to Watson Yuuma Sato from comment #1)
> Hello Carlos, thank you for filing the bug.
>
> Do I understand correctly that this can cause the user to be locked out of
> the machine?
Yes, it can lead to a situation in which even root is unable to log in.
Comment 4Watson Yuuma Sato
2020-08-11 13:43:48 UTC
The rule describes both uses "pam_unix.so" and "pam_pwhistory.so", and OVAL check accepts either configuration.
But remediation (Ansible and Bash) always configure using "pam_unix.so".
As remember feature in pam_unix is deprecated, the rule should shift to check and remediate with pam_pwhistory.
We also need to check if rhel6 supports pam_pwhistory.so and "remember", if not, the remediation for rhel6 should still configure pam_unix.
I believe there were created new rules which solve this bug:
https://github.com/ComplianceAsCode/content/pull/7027
They just need to be selected with a certain profile.
Carlos, are you using some specific profile so that we can possibly put these rules in the right place?
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-2021:4265
Description of problem: The playbooks in /usr/share/scap-security-guide/ansible/*.yml configure password remembering by means of the pam_unix.so option "remember". This does not work and causes errors due to SELinux restrictions. Version-Release number of selected component (if applicable): scap-security-guide-0.1.46-1.el8.noarch How reproducible: Always Steps to Reproduce: 1. Log in as root on the system (e.g. via SSH). 3. Create an "infra" user with unlimited sudo permissions: # useradd -m infra # printf 'infra\ninfra\n' | passwd infra # echo 'infra ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/infra 4. Log in via SSH as "infra" ans run "sudo su -" to ensure that we have a backup access as root 5. Configure pam_unix to remember the last 12 passwords in /etc/pam.d/system-auth password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type= password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok remember=12 6. Set a password for "root" and expire it: # printf 'redhat\nredhat\n' | passwd root # passwd --expire root 7. Try to log in as root on the console (e.g tty2). Actual results: After failing to log in the following messages appear in /var/log/secure: Nov 27 14:20:24 rhel-8-1 login[11407]: pam_unix(login:account): expired password for user root (root enforced) Nov 27 14:20:52 rhel-8-1 login[11407]: pam_unix(login:chauthtok): can't open /etc/security/opasswd file to check old passwords Nov 27 14:20:52 rhel-8-1 login[11407]: pam_unix(login:chauthtok): new password not acceptable Nov 27 14:20:54 rhel-8-1 login[11407]: Authentication token manipulation error Expected results: The password should be changed and recorded. Additional info: According to Bug 1039089#c7: The remember functionality of pam_unix is deprecated in upstream PAM. I'd prefer not developing it further. The SELinux policy in RHEL-6 should not change the opasswd file to shadow_t. This should have been done only in Fedora/RHEL-7 where the replacement for remember functionality - that is the pam_pwhistory module has its own pwhistory_helper for accessing shadow_t files. The correct way to configure password remembering is documented in https://access.redhat.com/solutions/2808101