AUDIT_LOG_SEMANAGE_MESSAGE(3)

πŸ’– AUDIT_LOG_SEMANAGE_MESSAGE πŸ’–

okay bestie, so this is a page from the Linux Audit API manual, section 3 (that's the library-calls section, iykyk). The function we're hyping up today is audit_log_semanage_message β€” yes it's a whole mouthful, yes it slays, and yes we're gonna walk through every single one of those parameters together. grab a snack πŸ“


✨ NAME ✨

audit_log_semanage_message β€” log a semanage message πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libaudit.h>

int audit_log_semanage_message(int audit_fd,
                               int type,
                               const char *pgname,
                               const char *op,
                               const char *name,
                               unsigned int id,
                               const char *new_seuser,
                               const char *new_role,
                               const char *new_range,
                               const char *old_seuser,
                               const char *old_role,
                               const char *old_range,
                               const char *host,
                               const char *addr,
                               const char *tty,
                               int result);

that's sixteen parameters, bestie. sixteen. she's extra and we respect it. πŸ‘‘


🌸 DESCRIPTION 🌸

So what does she do? This function will log a message to the audit system using a predefined message format. Fr fr, it should be used for all SE Linux user and role manipulation operations β€” that's literally her whole job.

Now let's break down every single parameter, no skips, no skimming, we are thorough in this house:

  • audit_fd β€” the fd returned by audit_open (that's the file descriptor your girl hands you, hold onto it)
  • type β€” the type of message: AUDIT_ROLE_ASSIGN/REMOVE for changing any SE Linux user or role attributes
  • pgname β€” the program's name
  • op β€” the operation. Options are "adding-user", "adding-role", "deleting-user", "deleting-role"
  • name β€” the user's account. If it's not available, use NULL
  • id β€” the uid that the operation is being performed on. This is used only when name is NULL
  • new_seuser β€” the new seuser that the login user is getting
  • new_role β€” the new_role that the login user is getting
  • new_range β€” the new mls range that the login user is getting
  • old_seuser β€” the old seuser that the login usr had
  • old_role β€” the old role that the login user had
  • old_range β€” the old mls range that the login usr had
  • host β€” the hostname if known
  • addr β€” the network address of the user
  • tty β€” the tty of the user
  • result β€” 1 is "success" and 0 is "failed"
not me pointing out that the original spells it "usr" in the old_* descriptions 😭 we keep the facts exactly as they are, bestie, typos and all, because accuracy is the vibe.

πŸ‘‘ RETURN VALUE πŸ‘‘

She returns the sequence number. That's <green>> 0</green> on success, or <= 0 on error. slay when positive, sad girl hours when not.


πŸ’€ ERRORS πŸ’€

This function returns -1 on failure. Bestie, when that happens you examine errno for more info. errno is literally telling you what went wrong, so listen to her. πŸ™ˆ


πŸŽ€ SEE ALSO πŸŽ€

the whole audit girlie squad, go read them too 🫢


⭐ AUTHOR ⭐

Steve Grubb πŸ’œ (iconic, we thank him for his service)


Red Hat Β· Jan 2012 Β· and that's the whole AUDIT_LOG_SEMANAGE_MESSAGE(3) vibe check, bestie β€” go log those semanage messages, you're gonna ate βœ¨πŸ’…πŸŒˆ