[Auditbeat] Add user metricset#8835
Conversation
ruflin
left a comment
There was a problem hiding this comment.
My suggestion would be to add a separate metricset for host_user which sends an event for each user.
@andrewkroh FYI
|
Thanks, @andrewkroh and @ruflin. I've (hopefully) addressed all comments for now. This is now its own metricset, sending each user as its own document, and detecting added/removed/changed users. I'm still working on adding persistence across Auditbeat restarts, and we have some outstanding naming discussions (I put So I'm keeping the PR in |
|
I think this is ready for another review. The It can detect new users, deleted users, changes to users (e.g. groups), and - as a special distinct category - password changes. Periodically, it sends all user information as state (frequency controlled by the config values The cache is persisted to disk in a Possible future enhancements:
|
webmat
left a comment
There was a problem hiding this comment.
LGTM overall.
I notice the metricset still needs to be changed to system_audit, but other than that, looking good. I've left a few comments here and there.
Other major thing is about using user.id to save the uid (see comment about this for the full discussion)
andrewkroh
left a comment
There was a problem hiding this comment.
Overall this LGTM. I left a few minor comments on the latest updates.
b1f67a1 to
0681300
Compare
|
After a conversation with @andrewkroh I changed the password change detection to use a SHA-512 hash of the full encrypted password (rather than the last 10 characters) - but excluding the salt. This should make sure that we detect any possible password change. I merged @andrewkroh let me know if this still looks good so I can merge. |
Collects (via C functions) user information from /etc/passwd, /etc/shadow, and /etc/group on Linux. Detects new users, deleted users, changes to users (e.g. groups), and - as a special distinct category - password changes. Sends periodic state information about all users (frequency can be controlled). Otherwise, periodically checks the ctime of the above files, reads them if the ctime has changed, detects changes compared to its internal cache, and reports any changes. The cache is persisted to disk in a `beat.db` file (already used by the `file_integrity` module) after every `Fetch` and on `Close`. It contains a copy of all current user information incl. a SHA-512 hash of the password hash from /etc/shadow (to detect password changes between Auditbeat restarts - this hash is not sent to any output).
Adds a list of users with all their information to the
hostmetricset. Works on Linux and macOS by usinggetpwent(3).