How To
Summary
You can use AIX Auditing to monitor user login and logout activities.
Steps
The following example logs user logins, logouts, exits, and su by monitoring USER_Login,USER_Logout,USER_Exit,USER_SU and related events. There is an option to monitor SSH login events. This example does not cover log management, or other audit configuration details. The example assumes the "/audit" file system exists. See the "Support" section in this note for references.
|
SSH Background: |
|
# vi /etc/security/audit/events
* # SSH Audit Hooks #
* SSH_AUDIT_UNKNOWN
SSH_auditknwn = printf "%s" * SSH_AUTH_FAIL_GSSAPI SSH_failgssapi = printf "%s" * SSH_AUTH_FAIL_HOSTBASED SSH_failhstbsd = printf "%s" * SSH_AUTH_FAIL_KBDINT SSH_failkbdint = printf "%s" * SSH_AUTH_FAIL_NONE SSH_failnone = printf "%s" * SSH_AUTH_FAIL_PASSWD SSH_failpasswd = printf "%s" * SSH_AUTH_FAIL_PUBKEY SSH_failpubkey = printf "%s" * SSH_AUTH_SUCCESS SSH_authsuccess = printf "%s" * SSH_CONNECTION_ABANDON SSH_connabndn = printf "%s" * SSH_CONNECTION_CLOSE SSH_connclose = printf "%s" * SSH_INVALID_USER SSH_invldusr = printf "%s" * SSH_LOGIN_EXCEED_MAXTRIES SSH_exceedmtrix = printf "%s" * SSH_LOGIN_ROOT_DENIED SSH_rootdned = printf "%s" * SSH_NOLOGIN SSH_nologin = printf "%s" |
|
# vi /etc/security/audit/config
start:
binmode = off streammode = on ignorenonexistentity = no |
|
classes:
userLogin = USER_Login,USER_Logout,USER_Exit,USER_SU sshClass = SSH_auditknwn,SSH_failgssapi,SSH_failhstbsd,SSH_failkbdint,SSH_failnone,SSH_failpasswd,SSH_failpubkey,SSH_authsuccess,SSH_connabndn,SSH_connclose,SS
H_invldusr,SSH_exceedmtrix,SSH_rootdned,SSH_nologin |
|
users:
root = general,userLogin,sshClass default = userLogin,sshClass
|
|
# vi /etc/security/audit/streamcmds:
/usr/sbin/auditstream | auditpr -htpPrceR -w > /audit/stream.out &
|
6) Stop and restart audit:
|
# audit shutdown
# audit start |
|
# cat /audit/stream.out
time process parent real command event status
------------------------ -------- -------- -------- -------- ------------- ------------ TEST SSH INVALID PASSWORD: Wed Jul 08 14:04:13 2020 11796656 19988734 root sshd USER_Login FAIL_AUTH user: shelltester tty: ssh Wed Jul 08 14:04:18 2020 11796656 19988734 root sshd SSH_failpasswd OK audit event euid 0 user shelltester event 4 (SSH_failpasswd) remote ip (10.99.0.141) TEST SSH VALID PASSWORD:
Wed Jul 08 14:04:23 2020 11796656 19988734 root sshd USER_Login OK user: shelltester tty: ssh Wed Jul 08 14:04:23 2020 11796656 19988734 root sshd SSH_authsuccess OK audit event euid 0 user shelltester event 2 (SSH_authsuccess) remote ip (10.99.0.141) Wed Jul 08 14:04:29 2020 11796656 19988734 root sshd USER_Login OK user: shelltester tty: /dev/pts/1 Wed Jul 08 14:04:29 2020 11796656 19988734 root sshd USER_Login OK user: shelltester tty: ssh TEST SSH INVALID SU PASSWORD:
Wed Jul 08 14:04:33 2020 19071208 19398876 shelltes su USER_SU FAIL root EXIT SSH:
Wed Jul 08 14:04:38 2020 11796656 19988734 root sshd SSH_connabndn OK audit event euid 0 user shelltester event 12 (SSH_connabndn) remote ip (nnn.nnn.nnn.nnn) TEST TELNET INVALID PASSWORD:
Wed Jul 08 14:08:17 2020 11796660 20185154 root tsm USER_Login FAIL_AUTH user: shelltester tty: /dev/pts/1 TEST TELNET INVALID PASSWORD:
Wed Jul 08 14:08:30 2020 11796660 20185154 root tsm USER_Login OK user: shelltester tty: /dev/pts/1 EXIT TELNET:
Wed Jul 08 14:08:33 2020 20185154 4260048 root telnetd USER_Exit OK tty: User shelltester logged out on /dev/pts/1 |
Additional Information
| SUPPORT |
|---|
|
Security configuration involves comprehensive features. Most of these features require advanced review and planning by administrators who are familiar with all of their system requirements. AIX Support does not make specific recommendations to harden your system. Customization is out of the scope of AIX Support, but if you have specific questions about documented usage, our support experts are happy to assist.
You can learn more about the audit functionality on AIX and best practices through the following resources:
If you have specific questions about usage after reviewing the recommended documentation, IBM AIX Support will be happy to assist. If you require consulting services, there are more fee-based services available.
If you require usage assistance, use the following step-by-step instructions to contact IBM to open a case for software with an active and valid support contract.
1. Document (or collect screen captures of) all symptoms, errors, and messages related to your issue. 2. Capture any logs or data relevant to the situation. 3. Contact IBM to open a case: -For electronic support, see the IBM Support Community: 4. Provide a clear, concise description of the issue. - For guidance, see: Working with IBM AIX Support: Describing the problem
5. If the system is accessible, collect a system snap, and upload all of the details and data for your case. - For guidance, see: Working with IBM AIX Support: Collecting snap data |
Related Information
Was this topic helpful?
Document Information
Modified date:
25 May 2023
UID
ibm16194127