Information
Capture events where the system date and/or time has been modified. The parameters in this section are set to determine if the;
- adjtimex - tune kernel clock
- settimeofday - set time using timeval and timezone structures
- stime - using seconds since 1/1/1970
- clock_settime - allows for the setting of several internal clocks and timers
system calls have been executed. Further, ensure to write an audit record to the configured audit log file upon exit, tagging the records with a unique identifier such as "time-change".
Unexpected changes in system date and/or time could be a sign of malicious activity on the system.
Solution
Note:
- The -w option is deprecated and the rule should be updated in accordance with the Remediation Procedure.
- For best performance, the arch field should be supplied in the rule. The individual permissions will cause the selection of specific system calls that use that kind of access. Not supplying the arch will cause the selection of all system calls which will affect performance as all system calls will be evaluated.
Edit or create a file in the /etc/audit/rules.d/ directory, ending inrules extension, with the relevant rules to monitor events that modify date and time information.
1a. Create a rule for adjtimex settimeofday clock_settime :
Example
# printf "
-a always,exit -F arch=b64 -S adjtimex,settimeofday -k time-change
-a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -k time-change
" >> /etc/audit/rules.d/50-time-change.rules
1b. Create a rule for /etc/localtime :
Example
# printf "
-a always,exit -F arch=b64 -S all -F path=/etc/localtime -F perm=wa -F key=time-change
" >> /etc/audit/rules.d/50-local-time-change.rules <xhtml:ol start="2"> - Merge and load the rules into active configuration:
# augenrules --load <xhtml:ol start="3"> - Check if reboot is required:
# if [[ $(auditctl -s | grep "enabled") =~ "2" ]]; then printf "Reboot required to load rules\n"; fi