-
Notifications
You must be signed in to change notification settings - Fork 0
/
audit.rules
113 lines (86 loc) · 4.02 KB
/
audit.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# First rule - delete all
-D
# Increase the buffers to survive stress events.
-b 320
# Set failure mode to syslog
-f 1
# Audit changes to time
-a always,exit -F arch=b64 -S adjtimex -S settimeofday -S clock_settime -k audit-wazuh-c:time-change
-w /etc/localtime -p wa -k audit-wazuh-a:time-change
# Audit kernel module loading and unloading
-w /sbin/insmod -p x -k audit-wazuh-x:module-change
-w /sbin/rmmod -p x -k audit-wazuh-x:module-change
-w /sbin/modprobe -p x -k audit-wazuh-x:module-change
-a always,exit -F arch=b64 -S init_module -S delete_module -k audit-wazuh-x:module-change
# Audit logins and logouts
-w /var/log/faillog -p wa -k audit-wazuh-a:logins
-w /var/log/lastlog -p wa -k audit-wazuh-a:logins
-w /var/log/tallylog -p wa -k audit-wazuh-a:logins
# Audit access to the audit logs
-w /var/log/audit/ -p wa -k audit-wazuh-a:auditlog
# Monitor /etc directory
-w /etc/ -p wa -k audit-wazuh-a:etc-files
# Monitor passwd and group files
-w /etc/passwd -p wa -k audit-wazuh-a:identity
-w /etc/group -p wa -k audit-wazuh-a:identity
-w /etc/shadow -p wa -k audit-wazuh-a:identity
-w /etc/gshadow -p wa -k audit-wazuh-a:identity
-w /etc/security/opasswd -p wa -k audit-wazuh-a:identity
# Monitor sudoers files
-w /etc/sudoers -p wa -k audit-wazuh-a:sudoers
-w /etc/sudoers.d/ -p wa -k audit-wazuh-a:sudoers
# Monitor PAM files
-w /etc/pam.d/ -p wa -k audit-wazuh-a:pam
# Monitor SSH configuration files
-w /etc/ssh/sshd_config -p wa -k audit-wazuh-a:ssh
# Monitor network configuration files
-w /etc/network/ -p wa -k audit-wazuh-a:network
-w /etc/NetworkManager/ -p wa -k audit-wazuh-a:network
-w /etc/netplan/ -p wa -k audit-wazuh-a:network
# Monitor system binaries
-w /bin/ -p x -k audit-wazuh-x:binaries
-w /sbin/ -p x -k audit-wazuh-x:binaries
-w /usr/bin/ -p x -k audit-wazuh-x:binaries
-w /usr/sbin/ -p x -k audit-wazuh-x:binaries
# Monitor systemd units and configuration
-w /etc/systemd/ -p wa -k audit-wazuh-a:systemd
# Monitor important security files
-w /etc/apparmor/ -p wa -k audit-wazuh-a:apparmor
-w /etc/apparmor.d/ -p wa -k audit-wazuh-a:apparmor
-w /etc/firewalld/ -p wa -k audit-wazuh-a:firewalld
# Monitor for use of administrative commands
-w /usr/bin/sudo -p x -k audit-wazuh-x:privileged-commands
-w /usr/bin/su -p x -k audit-wazuh-x:privileged-commands
-w /usr/bin/passwd -p x -k audit-wazuh-x:privileged-commands
# Monitor changes to the audit configuration
-w /etc/audit/ -p wa -k audit-wazuh-a:auditconfig
-w /etc/libaudit.conf -p wa -k audit-wazuh-a:auditconfig
-w /etc/audisp/ -p wa -k audit-wazuh-a:auditconfig
# Monitor mounts
-a always,exit -F arch=b64 -S mount -F auid>=1000 -F auid!=-1 -k audit-wazuh-x:mounts
# Monitor file deletions
-a always,exit -F arch=b64 -S unlink -S unlinkat -S rename -S renameat -F auid>=1000 -F auid!=-1 -k audit-wazuh-w:delete
# Monitor for use of dangerous commands
-w /bin/nc -p x -k audit-wazuh-x:dangerous
-w /usr/bin/nmap -p x -k audit-wazuh-x:dangerous
-w /usr/bin/wget -p x -k audit-wazuh-x:dangerous
-w /usr/bin/curl -p x -k audit-wazuh-x:dangerous
# Monitor the use of setuid and setgid programs
-a always,exit -F arch=b64 -S execve -F euid=0 -k audit-wazuh-x:privileged
# Monitor changes to /var/log/wtmp and /var/run/utmp
-w /var/log/wtmp -p wa -k audit-wazuh-a:session
-w /var/run/utmp -p wa -k audit-wazuh-a:session
# Monitor changes to cron configurations
-w /etc/crontab -p wa -k audit-wazuh-a:cron
-w /etc/cron.hourly/ -p wa -k audit-wazuh-a:cron
-w /etc/cron.daily/ -p wa -k audit-wazuh-a:cron
-w /etc/cron.weekly/ -p wa -k audit-wazuh-a:cron
-w /etc/cron.monthly/ -p wa -k audit-wazuh-a:cron
-w /etc/cron.d/ -p wa -k audit-wazuh-a:cron
# Monitor changes to key system files
-w /boot/ -p wa -k audit-wazuh-a:boot
# Monitor any attempts to alter file attributes
-a always,exit -F arch=b64 -S chown -S fchown -S fchownat -S lchown -S chmod -S fchmod -S fchmodat -S setxattr -S lsetxattr -S fsetxattr -S removexattr -S lremovexattr -S fremovexattr -S fsetxattr -k audit-wazuh-a:perm_mod
# Monitor privileged commands execution
-a always,exit -F arch=b64 -S execve -k audit-wazuh-x:exec
# End of file