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.
Bug 1054936 - pam_limits does not always count the user logins correctly for testing maxlogins
Summary: pam_limits does not always count the user logins correctly for testing maxlogins
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: pam
Version: 6.5
Hardware: All
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Tomas Mraz
QA Contact: Dalibor Pospíšil
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-17 19:03 UTC by Christopher Hailey
Modified: 2014-10-14 08:10 UTC (History)
2 users (show)

Fixed In Version: pam-1.1.1-18.el6
Doc Type: Bug Fix
Doc Text:
Cause: The pam_limits module did not verify whether the process that is referenced in the utmp file as being the login process still exists. Consequence: In case the user has maxlogins limit set in the limits.conf file, if the login session process crashed and did not update the utmp file properly the user might be prevented access to the system even if some of his previous login session does not exist due to the crash anymore. Fix: pam_limits now tests whether the login process still exists on the system. Result: The number of existing login sessions is counted more precisely when maxlogin limit is applied by the pam_limits module.
Clone Of:
: 1080023 1134430 1135701 (view as bug list)
Environment:
Last Closed: 2014-10-14 08:10:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch to pam_limits to ensure maxlogins works correctly (1.00 KB, patch)
2014-01-17 19:03 UTC, Christopher Hailey
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1579 0 normal SHIPPED_LIVE pam bug fix update 2014-10-14 01:27:19 UTC

Description Christopher Hailey 2014-01-17 19:03:18 UTC
Created attachment 851755 [details]
Patch to pam_limits to ensure maxlogins works correctly

Description of problem:
pam_limits has the ability to limit the number of logins for a user.  There are times where there is a utmp entry for a user who is not actually logged on (usually the result of a program crashing).   pam_limits will count this entry as a login and if this puts the user over the limit (in our case 1) the user cannot log in.

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

How reproducible:
You can sometimes get this condition by doing a kill -9 on the user's login process, generally more often if it is a X11/xdm login.   You can also create a bugus entry in utmp using utmpdump to restore the utmp file.

Steps to Reproduce:
1. utmpdump into a file
2. log a user off
3. restore the utmp from the file
4. If maxlogins = 1 you can't log on.

Actual results:

User cannot log on

Expected results:

User can log on.

Additional info:

pam_limits reads the utmp file to find the logins for a user but does not verify that the login is still active.  By checking the process PID of the entry you can determine this.  This is the mechanism that "who" uses (you won't see the "ghost" entries in "who".)  I have included a patch to pam_limits that uses the same mechanism as "who" to ensure that utmp records are valid.

Comment 2 Tomas Mraz 2014-01-20 08:22:04 UTC
Please report the issue through regular Red Hat support channels so it can be properly prioritized for inclusion in Red Hat Enterprise Linux update release.

http://www.redhat.com/support

Comment 3 Tomas Mraz 2014-06-19 13:44:02 UTC
There is also another case where the UT_USER might not be NULL terminated in which case the count might not be correct either.

Comment 6 errata-xmlrpc 2014-10-14 08:10:06 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, and where to find the updated
files, follow the link below.

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

http://rhn.redhat.com/errata/RHBA-2014-1579.html


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