Implementation of pam_tally2.so counts successful logins as failures

This document (7011883) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 15
SUSE Linux Enterprise Server 12
SUSE Linux Enterprise Server 11

Situation

After adding pam_tally2.so to /etc/pam.d/common-auth file like this:
auth    required    pam_env.so
auth    required    pam_unix.so
auth    required    pam_tally2.so onerr=fail deny=6

After each successful login, the failed login count is incremented.  After the number of successful logins matches the maximum failed login count the account is locked and the account has to be manually reset.

The user logs in successfully.
user1@server:~> ssh geeko@sles15sp3
Password:
Last login: Fri Jul 16 10:56:54 2021 from 192.168.0.170
geeko@sles15sp3:~>

However, on the server pam_tally2 shows a login failure.
sles15sp3:~ # pam_tally2
Login           Failures Latest failure     From
geeko               1    07/16/21 10:57:16  192.168.0.170

When the user correctly logs in after the sixth attempt (matching deny=6 above), they get an error and locked account.
user1@server:~> ssh geeko@sles15sp3
Password:
Account locked due to 7 failed logins

The pam_tally2 command shows too many failed login attempts.
sles15sp3:~ # pam_tally2
Login           Failures Latest failure     From
geeko               7    07/16/21 10:59:50  192.168.0.170


 

Resolution

By adding the following line to the /etc/pam.d/common-account file, this problem may be resolved:
account    required    pam_tally2.so

In addition, if entries that contain pam_tally2.so have been added to other configuration files, they may need to be reordered so that the lines containing pam_tally2.so are the first entry in those configuration files.

 

Additional Information

In this customer example, pam_tally2.so was added to common-auth.  If the pam configuration is being maintained by pam-config, it is preferred to modify the file for the specific access method and not the common file.  For example "login" should be used for limiting the number of failures with a regular login.  This is indicated in the man page and in the SUSE documentation.

The reason for this is because pam_tally2.so is not supported by pam-config.  During an upgrade, or some updates, pam-config is used to verify and correct entries in the common-* files.  This will cause any custom changes to be lost.

The pam-config method is the default configuration for SLES.  Manual configuration requires disabling pam-config as indicated in the documentation here: 3.6 Manually configuring PAM

NOTE:  With pam_tally2.so, incomplete authentications also count as a failure. During an authentication, the user name is entered and the failed login count is immediately increased by 1.  The password is then entered correctly, the failed count is reset to zero. This means that if any authentication is 'abandoned', the failed login count will remain incremented by 1, until the next authentication occurs.

NOTE:  In at least one case, the 'failed login count' problem was not seen when logging in via the console, but was seen when using ssh authentication. This may be the situation in all cases.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7011883
  • Creation Date: 05-Mar-2013
  • Modified Date:30-Aug-2022
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center