AUDIT_LOG_ACCT_MESSAGE(3)

πŸ’– AUDIT_LOG_ACCT_MESSAGE πŸ’–

okay bestie, so this is a page from the Linux Audit API β€” section 3, library functions, iykyk β€” and it's literally called audit_log_acct_message. Say it with me: audit_log_acct_message. Slay.


✨ NAME ✨

audit_log_acct_message β€” log a user account message 🫢


✨ SYNOPSIS ✨

#include <libaudit.h>

int audit_log_acct_message(int audit_fd,
                           int type,
                           const char *pgname,
                           const char *op,
                           const char *name,
                           unsigned int id,
                           const char *host,
                           const char *addr,
                           const char *tty,
                           int result);

✨ DESCRIPTION ✨

okay so here's the vibe: this function logs a message to the audit system using a predefined message format. That's it, that's the whole thing. And you should be using it for all your account manipulation operations β€” like, every single one, no exceptions, periodt. πŸ’…

The function parameters are giving:

  • audit_fd β€” the fd you got back from audit_open. yes, that one. πŸŽ€
  • type β€” the type of message: AUDIT_USER_CHAUTHTOK for changing any account attributes. that's the one it wants here. 🌸
  • pgname β€” the program's name. if you pass NULL it will attempt to figure it out for you. cute of it honestly. πŸ¦‹
  • op β€” the operation. like, for real for real: "adding-user", "changing-finger-info", "deleting-group". πŸ‘‘ and listen β€” this value should have a dash or underscore between the words so that report parsers group them together. don't be out here writing "adding user" with a space, the parsers will simply not group it and it will be a whole mess. 😭
  • name β€” the user's account or group name. if it's not available, use NULL. no cap. πŸ’œ
  • id β€” the uid or gid that the operation is being performed on. if the user is unknown, pass a -1 and fill in the name parameter instead. note bestie: this is used only when user is NULL. πŸ™ˆ
  • host β€” the hostname if known. if not available, pass a NULL.
  • addr β€” the network address of the user. if not available, pass a NULL.
  • tty β€” the tty of the user. if NULL it will attempt to figure it out. main character behavior honestly. ✨
  • result β€” 1 is "success" and 0 is "failed". binary queen. ⭐

✨ RETURN VALUE ✨

It returns the sequence number, which is > 0 on success or <= 0 on error. so like, positive = we ate, non-positive = we did not. πŸ’€


✨ ERRORS ✨

This function returns -1 on failure. go examine errno for more info, that's where the tea is. πŸ“


✨ SEE ALSO ✨


✨ AUTHOR ✨

Steve Grubb β€” the icon, the legend, the moment. 🧚


and that's the whole page bestie!! brought to you by Red Hat, dated Nov 2015, and it's a section 3 Linux Audit API moment. go log those account messages responsibly, ily, bye πŸ’–βœ¨πŸŽ€