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:
After fixing sudo to use PAM_SILENT (see bug 1664147), it does not show last
login info when running a command.
But if there was a bad login attempt just before running the sudo command, pam_lastlog will warn about the failed login attempt, modifying the output of
the command.
$ echo expected | sudo cat
Last failed login: Sat Jan 12 09:35:29 EST 2019 from gateway on ssh:notty
There were 3 failed login attempts since the last successful login.
expected
This breaks use cases when command output is consumed by another
program. An example real use case is running LVM commands using sudo.
LVM output is built to be consumed by programs and programs assume
that sudo is not modifying the output in any way.
Here is example failure that may be caused by this issue:
https://bugzilla.redhat.com/1662449
How to reproduce the issue:
1. Install sudo upstream with fix for bug 1664147.
2. Configure sudo with (default in 7.6?):
$ cat /etc/pam.d/sudo
...
session include system-auth
3. Configure system-auth is using pam_lastlog plugin:
$ cat /etc/pam.d/system-auth
...
session required pam_lastlog.so showfailed
4. Perform bad login attempt:
$ ssh root.122.246
root.122.246's password:
Permission denied, please try again.
root.122.246's password:
Permission denied, please try again.
root.122.246's password:
root.122.246: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
5. Run command with sudo
$ echo expected | sudo cat
Last failed login: Sat Jan 12 09:35:29 EST 2019 from gateway on ssh:notty
There were 3 failed login attempts since the last successful login.
expected
The program running sudo is broken by the unexpected messages about failed
login.
The messages about failed login are also not helping anyone or improving
the security of the system since sudo is run by a program, not by the system
administrator. If a program is broken by the failed login warnings, this can
be used to preform denial of service attack.
Version-Release number of selected component (if applicable):
$ rpm -qa | grep pam
pam-devel-1.1.8-22.el7.x86_64
pam-1.1.8-22.el7.x86_64
How reproducible:
Always
There are two issues here:
1. pam does not respect PAM_SILENT
2. even if pam will respect PAM_SILENT, the warning about failed logins
are consumed by running sudo, and the next real login will not see the
warnings. Ideally sudo will not consume either last login or bad login
messages unless running a shell (e.g sudo -s).
The first issue, respecting PAM_SILENT was fixed upstream in:
https://github.com/linux-pam/linux-pam/pull/91
This is not a real blocker for bug 1664147.
The PAM_SILENT flag is just an indication and not a
hard-stop. If some application must not ever print something to users
it has to ensure it by itself and not blindly output any messages that
it receives from the PAM modules.
If pam_lastlog used stdout/stderr to print out the message, it would be
a bug. As it uses PAM conversation function, the application has all
the power to not output anything if it is not supposed to output
anything.
In my opinion regardless of my acceptance of the upstream PAM patch
this should be fixed on RHEL-7 strictly in sudo.
This issue was not selected to be included either in Red Hat Enterprise Linux 7.7 because it is seen either as low or moderate impact to a small amount of use-cases. The next release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available. We will now close this issue, but if you believe that it qualifies for the Maintenance Support 1 Phase, please re-open; otherwise we recommend moving the request to Red Hat Enterprise Linux 8 if applicable.
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, 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-2020:1780