Information
sudo provides users with temporary elevated privileges to perform operations, either as the superuser or another user.
Creating an audit log of users with temporary elevated privileges and the operation(s) they performed is essential to reporting. Administrators will want to correlate the events written to the audit trail with the records written to sudo 's logfile to verify if unauthorized commands have been executed.
Solution
- Add the audit rule(s) for the execve and execveat system calls. The procedure adds a rule for each audit ABI (b64/b32) the running kernel supports and skips any unsupported ABI or system call, so augenrules --load does not error. Run:
for ARCH in b64 b32; do
CALLS=""; for C in execve execveat; do ausyscall "$ARCH" "$C" >/dev/null 2>&1 && CALLS="${CALLS:+$CALLS,}$C"; done
[ -n "$CALLS" ] && printf '%s\n' "-a always,exit -F arch=$ARCH -C euid!=uid -F auid!=unset -S $CALLS -k user_emulation"
done >> /etc/audit/rules.d/50-user_emulation.rules
- Merge and load the rules into active configuration:
# augenrules --load
- Check if reboot is required:
# if [[ $(auditctl -s | grep "enabled") =~ "2" ]]; then printf "Reboot required to load rules\n"; fi