Information
Record changes to network environment files or system calls. The below parameters monitors the following system calls, and write an audit event on system call exit:
- sethostname - set the systems host name
- setdomainname - set the systems domain name
Monitoring sethostname and setdomainname will identify potential unauthorized changes to host and domain name of a system. The changing of these names could potentially break security parameters that are set based on those names.
Solution
- Add the audit rule(s) for the sethostname and setdomainname 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:
#!/usr/bin/env bash
{
for ARCH in b64 b32; do
CALLS=""; for C in sethostname setdomainname; do ausyscall "$ARCH" "$C" >/dev/null 2>&1 && CALLS="${CALLS:+$CALLS,}$C"; done
[ -n "$CALLS" ] && printf '%s\n' "-a always,exit -F arch=$ARCH -S $CALLS -k system-locale"
done >> /etc/audit/rules.d/50-system_locale.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