Debian Codegraph @

rules/30-stig.rules

raw
1 ## The purpose of these rules is to meet the stig auditing requirements
2 ## These rules depends on having 10-base-config.rules & 99-finalize.rules
3 ## installed.
4
5 ## NOTE:
6 ## 1) if this is being used on a 32 bit machine, comment out the b64 lines
7 ## 2) These rules assume that login under the root account is not allowed.
8 ## 3) It is also assumed that 1000 represents the first usable user account. To
9 ## be sure, look at UID_MIN in /etc/login.defs.
10 ## 4) If these rules generate too much spurious data for your tastes, limit the
11 ## syscall file rules with a directory, like -F dir=/etc
12 ## 5) You can search for the results on the key fields in the rules
13 ##
14 ##
15 ## (GEN002880: CAT II) The IAO will ensure the auditing software can
16 ## record the following for each audit event:
17 ##- Date and time of the event
18 ##- Userid that initiated the event
19 ##- Type of event
20 ##- Success or failure of the event
21 ##- For I&A events, the origin of the request (e.g., terminal ID)
22 ##- For events that introduce an object into a user’s address space, and
23 ## for object deletion events, the name of the object, and in MLS
24 ## systems, the object’s security level.
25 ##
26 ## Things that could affect time
27 -a always,exit -F arch=b32 -S adjtimex,settimeofday,stime -F key=time-change
28 -a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=time-change
29 -a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=time-change
30 -a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=time-change
31 # Introduced in 2.6.39, commented out because it can make false positives
32 #-a always,exit -F arch=b32 -S clock_adjtime -F key=time-change
33 #-a always,exit -F arch=b64 -S clock_adjtime -F key=time-change
34 -a always,exit -F arch=b32 -F path=/etc/localtime -F perm=wa -F key=time-change
35 -a always,exit -F arch=b64 -F path=/etc/localtime -F perm=wa -F key=time-change
36
37 ## Things that affect identity
38 -a always,exit -F arch=b32 -F path=/etc/group -F perm=wa -F key=identity
39 -a always,exit -F arch=b64 -F path=/etc/group -F perm=wa -F key=identity
40 -a always,exit -F arch=b32 -F path=/etc/passwd -F perm=wa -F key=identity
41 -a always,exit -F arch=b64 -F path=/etc/passwd -F perm=wa -F key=identity
42 -a always,exit -F arch=b32 -F path=/etc/gshadow -F perm=wa -F key=identity
43 -a always,exit -F arch=b64 -F path=/etc/gshadow -F perm=wa -F key=identity
44 -a always,exit -F arch=b32 -F path=/etc/shadow -F perm=wa -F key=identity
45 -a always,exit -F arch=b64 -F path=/etc/shadow -F perm=wa -F key=identity
46 -a always,exit -F arch=b32 -F path=/etc/security/opasswd -F perm=wa -F key=identity
47 -a always,exit -F arch=b64 -F path=/etc/security/opasswd -F perm=wa -F key=identity
48
49 ## Things that could affect system locale
50 -a always,exit -F arch=b32 -S sethostname,setdomainname -F key=system-locale
51 -a always,exit -F arch=b64 -S sethostname,setdomainname -F key=system-locale
52 -a always,exit -F arch=b32 -F path=/etc/issue -F perm=wa -F key=system-locale
53 -a always,exit -F arch=b64 -F path=/etc/issue -F perm=wa -F key=system-locale
54 -a always,exit -F arch=b32 -F path=/etc/issue.net -F perm=wa -F key=system-locale
55 -a always,exit -F arch=b64 -F path=/etc/issue.net -F perm=wa -F key=system-locale
56 -a always,exit -F arch=b32 -F path=/etc/hosts -F perm=wa -F key=system-locale
57 -a always,exit -F arch=b64 -F path=/etc/hosts -F perm=wa -F key=system-locale
58 -a always,exit -F arch=b32 -F path=/etc/hostname -F perm=wa -F key=system-locale
59 -a always,exit -F arch=b64 -F path=/etc/hostname -F perm=wa -F key=system-locale
60 -a always,exit -F arch=b32 -F dir=/etc/NetworkManager/ -F perm=wa -F key=system-locale
61 -a always,exit -F arch=b64 -F dir=/etc/NetworkManager/ -F perm=wa -F key=system-locale
62
63 ## Things that could affect MAC policy
64 -a always,exit -F arch=b32 -F dir=/etc/selinux/ -F perm=wa -F key=MAC-policy
65 -a always,exit -F arch=b64 -F dir=/etc/selinux/ -F perm=wa -F key=MAC-policy
66
67
68 ## (GEN002900: CAT III) The IAO will ensure audit files are retained at
69 ## least one year; systems containing SAMI will be retained for five years.
70 ##
71 ## Site action - no action in config files
72
73 ## (GEN002920: CAT III) The IAO will ensure audit files are backed up
74 ## no less than weekly onto a different system than the system being
75 ## audited or backup media.
76 ##
77 ## Can be done with cron script
78
79 ## (GEN002700: CAT I) (Previously – G095) The SA will ensure audit data
80 ## files have permissions of 640, or more restrictive.
81 ##
82 ## Done automatically by auditd
83
84 ## (GEN002720-GEN002840: CAT II) (Previously – G100-G106) The SA will
85 ## configure the auditing system to audit the following events for all
86 ## users and root:
87 ##
88 ## - Logon (unsuccessful and successful) and logout (successful)
89 ##
90 ## Handled by pam, sshd, login, and gdm
91 ## Might also want to watch these files if needing extra information
92 #-a always,exit -F arch=b32 -F path=/var/log/tallylog -F perm=wa -F key=logins
93 #-a always,exit -F arch=b64 -F path=/var/log/tallylog -F perm=wa -F key=logins
94 #-a always,exit -F arch=b32 -F path=/var/run/faillock -F perm=wa -F key=logins
95 #-a always,exit -F arch=b64 -F path=/var/run/faillock -F perm=wa -F key=logins
96 #-a always,exit -F arch=b32 -F path=/var/log/lastlog -F perm=wa -F key=logins
97 #-a always,exit -F arch=b64 -F path=/var/log/lastlog -F perm=wa -F key=logins
98
99
100 ##- Process and session initiation (unsuccessful and successful)
101 ##
102 ## The session initiation is audited by pam without any rules needed.
103 ## Might also want to watch this file if needing extra information
104 #-a always,exit -F arch=b32 -F path=/var/run/utmp -F perm=wa -F key=session
105 #-a always,exit -F arch=b64 -F path=/var/run/utmp -F perm=wa -F key=session
106 #-a always,exit -F arch=b32 -F path=/var/log/btmp -F perm=wa -F key=session
107 #-a always,exit -F arch=b64 -F path=/var/log/btmp -F perm=wa -F key=session
108 #-a always,exit -F arch=b32 -F path=/var/log/wtmp -F perm=wa -F key=session
109 #-a always,exit -F arch=b64 -F path=/var/log/wtmp -F perm=wa -F key=session
110
111 ##- Discretionary access control permission modification (unsuccessful
112 ## and successful use of chown/chmod)
113 -a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,fchmodat2,file_setattr -F auid>=1000 -F auid!=unset -F key=perm_mod
114 -a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,fchmodat2,file_setattr -F auid>=1000 -F auid!=unset -F key=perm_mod
115 -a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat,file_setattr -F auid>=1000 -F auid!=unset -F key=perm_mod
116 -a always,exit -F arch=b64 -S chown,fchown,lchown,fchownat,file_setattr -F auid>=1000 -F auid!=unset -F key=perm_mod
117 -a always,exit -F arch=b32 -S setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr,file_setattr -F auid>=1000 -F auid!=unset -F key=perm_mod
118 -a always,exit -F arch=b64 -S setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr,file_setattr -F auid>=1000 -F auid!=unset -F key=perm_mod
119
120 ##- Unauthorized access attempts to files (unsuccessful)
121 -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access
122 -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access
123 -a always,exit -F arch=b64 -S open,truncate,ftruncate,creat,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access
124 -a always,exit -F arch=b64 -S open,truncate,ftruncate,creat,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access
125
126 ##- Use of print command (unsuccessful and successful)
127
128 ##- Export to media (successful)
129 ## You have to mount media before using it. You must disable all automounting
130 ## so that its done manually in order to get the correct user requesting the
131 ## export
132 -a always,exit -F arch=b32 -S mount,mount_setattr -F auid>=1000 -F auid!=unset -F key=export
133 -a always,exit -F arch=b64 -S mount,mount_setattr -F auid>=1000 -F auid!=unset -F key=export
134
135 ##- System startup and shutdown (unsuccessful and successful)
136
137 ##- Files and programs deleted by the user (successful and unsuccessful)
138 -a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete
139 -a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete
140
141 ##- All system administration actions
142 ##- All security personnel actions
143 ##
144 ## Look for pam_tty_audit and add it to your login entry point's pam configs.
145 ## If that is not found, use sudo which should be patched to record its
146 ## commands to the audit system. Do not allow unrestricted root shells or
147 ## sudo cannot record the action.
148 -a always,exit -F arch=b32 -F path=/etc/sudoers -F perm=wa -F key=actions
149 -a always,exit -F arch=b64 -F path=/etc/sudoers -F perm=wa -F key=actions
150 -a always,exit -F arch=b32 -F dir=/etc/sudoers.d/ -F perm=wa -F key=actions
151 -a always,exit -F arch=b64 -F dir=/etc/sudoers.d/ -F perm=wa -F key=actions
152
153 ## Special case for systemd-run. It is not audit aware, specifically watch it
154 -a always,exit -F arch=b32 -F path=/usr/bin/systemd-run -F perm=x -F auid!=unset -F key=maybe-escalation
155 -a always,exit -F arch=b64 -F path=/usr/bin/systemd-run -F perm=x -F auid!=unset -F key=maybe-escalation
156 ## Special case for pkexec. It is not audit aware, specifically watch it
157 -a always,exit -F arch=b32 -F path=/usr/bin/pkexec -F perm=x -F key=maybe-escalation
158 -a always,exit -F arch=b64 -F path=/usr/bin/pkexec -F perm=x -F key=maybe-escalation
159
160 ## (GEN002860: CAT II) (Previously – G674) The SA and/or IAO will
161 ##ensure old audit logs are closed and new audit logs are started daily.
162 ##
163 ## Site action. Can be assisted by a cron job
164