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 922508 - [RFE] confusing aulast records for bad logins
Summary: [RFE] confusing aulast records for bad logins
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: audit
Version: 6.3
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Steve Grubb
QA Contact: Ondrej Moriš
URL:
Whiteboard:
Depends On:
Blocks: 947775 975796 1019376 1070830
TreeView+ depends on / blocked
 
Reported: 2013-03-17 14:49 UTC by Ondrej Moriš
Modified: 2014-10-14 07:14 UTC (History)
3 users (show)

Fixed In Version: audit-2.3.7-1.el6
Doc Type: Enhancement
Doc Text:
Clone Of:
: 975796 1019376 (view as bug list)
Environment:
Last Closed: 2014-10-14 07:14:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Aulast State Diagram (62.60 KB, image/png)
2014-08-04 13:21 UTC, Steve Grubb
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1515 0 normal SHIPPED_LIVE audit bug fix and enhancement update 2014-10-14 01:22:21 UTC

Description Ondrej Moriš 2013-03-17 14:49:17 UTC
Description of problem:

Aulast supports --bad option to report bad logins. Basically, one can distinguish between two types of unsuccessful logins:

a) username error
b) credentials error

Whenever b) happens (e.g. user typed wrong password), 'aulast --bad --proof' returns the following (single) record:

testuser ssh          127.0.0.1        Sun Mar 17 09:54   still logged in
    audit event proof serial numbers: 85084, 4197619, 140736879979400
    Session data can be found with this search:
    ausearch --start 03/17/2013 09:54:26 --end 03/17/2013 09:54:26


First minor issue is that "still logged in" might seem confusing. Second bigger issue is that the last two audit events clearly do not exist.

On the other hand, whenever a) happens, 'aulast --bad --proof' returns two records instead of a single one:

(unknown ssh          127.0.0.1        Sun Mar 17 09:54   still logged in
    audit event proof serial numbers: 85089, 4197619, 140736879979400
    Session data can be found with this search:
    ausearch --start 03/17/2013 09:54:27 --end 03/17/2013 09:54:27

(invalid ssh          127.0.0.1        Sun Mar 17 09:54   still logged in
    audit event proof serial numbers: 85097, 4197619, 140736879979400
    Session data can be found with this search:
    ausearch --start 03/17/2013 09:54:38 --end 03/17/2013 09:54:38

Again, there is a confusing "still logged in". Furthermore, there is some message instead of username (which is not known to aulast as far as I can see) and there are reported non-existing audit events as well.

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

audit-2.1.3-3.el6

How reproducible:

100%

Steps to Reproduce:

1. make sure 'testuser' user exists
2. ssh testuser@localhost (use wrong password)
3. ssh non-existing-user@localhost
4. aulast --bad --proof
  
Actual results:

See above.

Expected results:

A single record per unsuccessful login. Correct times (instead of "still logged in") and the list of valid audit events. Moreover, it would be nice to have something else than "(invalid ssh" or "(unknown ssh" in case of username error.

Comment 1 Ondrej Moriš 2013-03-17 16:16:49 UTC
This report also applies to audit-2.2-2.el6. Problem with non-existing audit events is caused by handling --proof option for both successful an unsuccessful login the same way (if (proof) { } branch in report_session function in aulast.c). Setting low/low priority/severity.

Comment 2 Steve Grubb 2013-03-18 14:53:59 UTC
Fixed in upstream commit 765.

Comment 3 RHEL Program Management 2013-10-13 23:48:02 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 5 Steve Grubb 2014-06-04 02:02:31 UTC
audit-2.3.7-1.el6 was built to resolve this issue.

Comment 7 Ondrej Moriš 2014-07-28 12:48:11 UTC
Unfortunately, I still see b) issue from the description:

Suppose I try to log in to the system twice:

1. first with correct username but incorrect password
2. and then with incorrect username 

There should be exactly two bad logins reported by aulast in my
opinion. Instead I see three records:

testuser ssh   ::1      Mon Jul 28 14:45 - 14:45 (00:00)
(unknown ssh   ::1      Mon Jul 28 14:45 - 14:45 (00:00)
(invalid ssh   ::1      Mon Jul 28 14:45 - 14:45 (00:00)

First line is created by step 1. Next two lines are created by 2. If
possible, it would be the best to have just a single line for step 2
containing also username used during log-in attempt.

(audit-2.3.7-3.el6)

Comment 12 Steve Grubb 2014-08-04 13:21:50 UTC
Created attachment 923874 [details]
Aulast State Diagram

Missed one transition. I think this is a final draft.

Comment 13 Steve Grubb 2014-08-04 13:40:24 UTC
So, base on the state diagram, the troubleshooting step would be to do a search on the USER_LOGIN events because that is what determines bad login vs full user session. A bad login should be found with:

ausearch -m USER_LOGIN -sv no

Comment 15 Steve Grubb 2014-08-06 14:34:45 UTC
To aid in getting a log for troubleshooting (weeding out irrelevant events), you can do something like this:

ausearch --start yesterday -m system_boot,system_shutdown,daemon_start,login,user_start,user_end,user_login > audit.log

Then test with "aulast -f audit.log"

Comment 16 Ondrej Moriš 2014-08-06 15:52:32 UTC
Thanks a lot Steve for your insight and for the state diagram. It definitely looks like pam/openssh issue right now. I am moving this bug back to ON_QA and the issue is now tracked in Bug 1127312 for pam.

Comment 17 Steve Grubb 2014-08-06 16:05:15 UTC
Of course you need to add --raw to the ausearch command in comment #15. Then you can hand edit the invalid user entry from the log. That should be cleaner for testing.

Comment 18 Ondrej Moriš 2014-08-12 09:59:33 UTC
It looks like one issue from the description was forgotten or fixed incompletely - reporting non-existing event numbers in for unsuccessful logins:

# aulast --bad --proof
testuser ssh          ::1              Tue Aug 12 05:48 - 05:48  (00:00)
    audit event proof serial numbers: 102, 0, 17591959120944
    Session data can be found with this search:
    ausearch --start 08/12/2014 05:48:39 --end 08/12/2014 05:48:39

Audit events with serials 102 and 0 exist, but 17591959120944 does not.

It is not a serious issue and it is definitely not worth respin I just want to make sure that you, Steve, are aware of it.

Comment 19 Steve Grubb 2014-08-12 14:10:11 UTC
Fixed better in upstream commit 990.

Comment 20 Ondrej Moriš 2014-08-12 14:55:05 UTC
Thanks Steve. 

OK, I consider original issue successfully verified now with audit-2.3.7-5.el6:

NEW
===

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Correct login (Expected 0, got 0)
:: [   PASS   ] :: Checking correct login (Assert: testuserpts/2localhostSunAug1016:56-16:56(00:00)X should equal testuserpts/2localhostSunAug1016:56-16:56(00:00)X)
:: [   PASS   ] :: Checking the number of correct logins (Assert: 11 should equal 11)
:: [   PASS   ] :: Incorrect login (wrong password) (Expected 8, got 8)
:: [   PASS   ] :: Checking incorrect login (Expected 0, got 0)
:: [   PASS   ] :: Checking the number of incorrect logins (Assert: 1 should equal 1)
:: [   PASS   ] :: Checking the number of correct logins (Assert: 11 should equal 11)
:: [   PASS   ] :: Incorrect login (wrong username) (Expected 8, got 8)
:: [   PASS   ] :: Checking incorrect login (Expected 0, got 0)
:: [   FAIL   ] :: Checking the number of incorrect logins (Assert: 3 should equal 2)

See Comments from #7 to #17.

:: [   PASS   ] :: Extracting records to aulast.log (Expected 0, got 0)
:: [   PASS   ] :: File aulast.log should exist 
:: [   PASS   ] :: Checking '--stdin' option (Assert: 11 should equal 11)
:: [   PASS   ] :: Checking '-f <file>' option (Assert: 11 should equal 11)
:: [   PASS   ] :: Checking '-f' with a non-existing file (Expected 1, got 1)
:: [   PASS   ] :: Checking related events (single login) (Assert: 0 should equal 0)
:: [ WARNING  ] :: Event 140734120552200 does not exist!
:: [ WARNING  ] :: Event 4197563 does not exist!
:: [   FAIL   ] :: Checking related events (all logins) (Assert: 1 should equal 0)

See Comment #18 and #19.

:: [   LOG    ] :: Duration: 31s
:: [   LOG    ] :: Assertions: 15 good, 2 bad
:: [   FAIL   ] :: RESULT: Test

Comment 21 errata-xmlrpc 2014-10-14 07:14:14 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-1515.html


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