| 1 |
## The purpose of these rules is to meet the pci-dss v3.1 auditing requirements |
| 2 |
## These rules depends on having 10-base-config.rules, 43-module-load.rules, |
| 3 |
## and 99-finalize.rules 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 |
|
| 16 |
## 10.1 Implement audit trails to link all access to individual user. |
| 17 |
## This requirement is implicitly met |
| 18 |
|
| 19 |
## 10.2.1 Implement audit trails to detect user accesses to cardholder data |
| 20 |
## This would require a watch on the database that excludes the daemon's |
| 21 |
## access. This rule is commented out due to needing a path name |
| 22 |
#-a always,exit -F arch=b32 -F path=path-to-db -F auid>=1000 -F auid!=unset -F uid!=daemon-acct -F perm=r -F key=10.2.1-cardholder-access |
| 23 |
#-a always,exit -F arch=b64 -F path=path-to-db -F auid>=1000 -F auid!=unset -F uid!=daemon-acct -F perm=r -F key=10.2.1-cardholder-access |
| 24 |
|
| 25 |
## 10.2.2 Log administrative action. To meet this, you need to enable tty |
| 26 |
## logging. The pam config below should be placed into su and sudo pam stacks. |
| 27 |
## session required pam_tty_audit.so disable=* enable=root |
| 28 |
|
| 29 |
## Special case for systemd-run. It is not audit aware, specifically watch it |
| 30 |
-a always,exit -F arch=b32 -F path=/usr/bin/systemd-run -F perm=x -F auid!=unset -F key=maybe-escalation |
| 31 |
-a always,exit -F arch=b64 -F path=/usr/bin/systemd-run -F perm=x -F auid!=unset -F key=maybe-escalation |
| 32 |
## Special case for pkexec. It is not audit aware, specifically watch it |
| 33 |
-a always,exit -F arch=b32 -F path=/usr/bin/pkexec -F perm=x -F key=maybe-escalation |
| 34 |
-a always,exit -F arch=b64 -F path=/usr/bin/pkexec -F perm=x -F key=maybe-escalation |
| 35 |
|
| 36 |
## Watch for configuration changes to privilege escalation. |
| 37 |
-a always,exit -F arch=b32 -F path=/etc/sudoers -F perm=wa -F key=10.2.2-priv-config-changes |
| 38 |
-a always,exit -F arch=b64 -F path=/etc/sudoers -F perm=wa -F key=10.2.2-priv-config-changes |
| 39 |
-a always,exit -F arch=b32 -F dir=/etc/sudoers.d/ -F perm=wa -F key=10.2.2-priv-config-changes |
| 40 |
-a always,exit -F arch=b64 -F dir=/etc/sudoers.d/ -F perm=wa -F key=10.2.2-priv-config-changes |
| 41 |
|
| 42 |
## 10.2.3 Access to all audit trails. |
| 43 |
-a always,exit -F arch=b32 -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=10.2.3-access-audit-trail |
| 44 |
-a always,exit -F arch=b64 -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=10.2.3-access-audit-trail |
| 45 |
-a always,exit -F arch=b32 -F path=/usr/sbin/ausearch -F perm=x -F key=10.2.3-access-audit-trail |
| 46 |
-a always,exit -F arch=b64 -F path=/usr/sbin/ausearch -F perm=x -F key=10.2.3-access-audit-trail |
| 47 |
-a always,exit -F arch=b32 -F path=/usr/sbin/aureport -F perm=x -F key=10.2.3-access-audit-trail |
| 48 |
-a always,exit -F arch=b64 -F path=/usr/sbin/aureport -F perm=x -F key=10.2.3-access-audit-trail |
| 49 |
-a always,exit -F arch=b32 -F path=/usr/sbin/aulast -F perm=x -F key=10.2.3-access-audit-trail |
| 50 |
-a always,exit -F arch=b64 -F path=/usr/sbin/aulast -F perm=x -F key=10.2.3-access-audit-trail |
| 51 |
-a always,exit -F arch=b32 -F path=/usr/sbin/aulastlog -F perm=x -F key=10.2.3-access-audit-trail |
| 52 |
-a always,exit -F arch=b64 -F path=/usr/sbin/aulastlog -F perm=x -F key=10.2.3-access-audit-trail |
| 53 |
|
| 54 |
## 10.2.4 Invalid logical access attempts. This is naturally met by pam. You |
| 55 |
## can find these events with: ausearch --start today -m user_login -sv no -i |
| 56 |
|
| 57 |
## 10.2.5.a Use of I&A mechanisms is logged. Pam naturally handles this. |
| 58 |
## you can find the events with: |
| 59 |
## ausearch --start today -m user_auth,user_chauthtok -i |
| 60 |
|
| 61 |
## 10.2.5.b All elevation of privileges is logged |
| 62 |
-a always,exit -F arch=b64 -S setuid -F a0=0 -F exe=/usr/bin/su -F key=10.2.5.b-elevated-privs-session |
| 63 |
-a always,exit -F arch=b32 -S setuid -F a0=0 -F exe=/usr/bin/su -F key=10.2.5.b-elevated-privs-session |
| 64 |
-a always,exit -F arch=b64 -S setresuid -F a0=0 -F exe=/usr/bin/sudo -F key=10.2.5.b-elevated-privs-session |
| 65 |
-a always,exit -F arch=b32 -S setresuid -F a0=0 -F exe=/usr/bin/sudo -F key=10.2.5.b-elevated-privs-session |
| 66 |
-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -F key=10.2.5.b-elevated-privs-setuid |
| 67 |
-a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -F key=10.2.5.b-elevated-privs-setuid |
| 68 |
|
| 69 |
## 10.2.5.c All changes, additions, or deletions to any account are logged |
| 70 |
## This is implicitly covered by shadow-utils. We will place some rules |
| 71 |
## in case someone tries to hand edit the trusted databases |
| 72 |
-a always,exit -F arch=b32 -F path=/etc/group -F perm=wa -F key=10.2.5.c-accounts |
| 73 |
-a always,exit -F arch=b64 -F path=/etc/group -F perm=wa -F key=10.2.5.c-accounts |
| 74 |
-a always,exit -F arch=b32 -F path=/etc/passwd -F perm=wa -F key=10.2.5.c-accounts |
| 75 |
-a always,exit -F arch=b64 -F path=/etc/passwd -F perm=wa -F key=10.2.5.c-accounts |
| 76 |
-a always,exit -F arch=b32 -F path=/etc/gshadow -F perm=wa -F key=10.2.5.c-accounts |
| 77 |
-a always,exit -F arch=b64 -F path=/etc/gshadow -F perm=wa -F key=10.2.5.c-accounts |
| 78 |
-a always,exit -F arch=b32 -F path=/etc/shadow -F perm=wa -F key=10.2.5.c-accounts |
| 79 |
-a always,exit -F arch=b64 -F path=/etc/shadow -F perm=wa -F key=10.2.5.c-accounts |
| 80 |
-a always,exit -F arch=b32 -F path=/etc/security/opasswd -F perm=wa -F key=10.2.5.c-accounts |
| 81 |
-a always,exit -F arch=b64 -F path=/etc/security/opasswd -F perm=wa -F key=10.2.5.c-accounts |
| 82 |
|
| 83 |
|
| 84 |
## 10.2.6 Verify the following are logged: |
| 85 |
## Initialization of audit logs |
| 86 |
## Stopping or pausing of audit logs. |
| 87 |
## These are handled implicitly by auditd |
| 88 |
|
| 89 |
## 10.2.7 Creation and deletion of system-level objects |
| 90 |
## This requirement would include the database table holding user information. |
| 91 |
## but we will also define this to mean Kernel modules, security controls, |
| 92 |
## and system software. Changes to system software is implicitly met by |
| 93 |
## librpm so that using either rpm or dnf to install something results in an |
| 94 |
## audit event. We will place rules to meet the other items. |
| 95 |
## For kernel modules, include 43-module-load.rules |
| 96 |
-a always,exit -F arch=b32 -S mount,umount,umount2,mknod,mknodat -F auid>=1000 -F auid!=unset -F key=10.2.7-system-objects |
| 97 |
-a always,exit -F arch=b64 -S mount,umount2,mknod,mknodat -F auid>=1000 -F auid!=unset -F key=10.2.7-system-objects |
| 98 |
-a always,exit -F arch=b32 -S landlock_create_ruleset -F auid>=1000 -F auid!=unset -F key=10.2.7-system-objects |
| 99 |
-a always,exit -F arch=b64 -S landlock_create_ruleset -F auid>=1000 -F auid!=unset -F key=10.2.7-system-objects |
| 100 |
|
| 101 |
## 10.3 Record at least the following audit trail entries |
| 102 |
## 10.3.1 through 10.3.6 are implicitly met by the audit system. |
| 103 |
|
| 104 |
## 10.4.2b Time data is protected. |
| 105 |
## We will place rules to check time synchronization |
| 106 |
-a always,exit -F arch=b32 -S adjtimex,settimeofday,stime -F key=10.4.2b-time-change |
| 107 |
-a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=10.4.2b-time-change |
| 108 |
-a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=10.4.2b-time-change |
| 109 |
-a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=10.4.2b-time-change |
| 110 |
# Introduced in 2.6.39, commented out because it can make false positives |
| 111 |
#-a always,exit -F arch=b32 -S clock_adjtime -F key=10.4.2b-time-change |
| 112 |
#-a always,exit -F arch=b64 -S clock_adjtime -F key=10.4.2b-time-change |
| 113 |
-a always,exit -F arch=b32 -F path=/etc/localtime -F perm=wa -F key=10.4.2b-time-change |
| 114 |
-a always,exit -F arch=b64 -F path=/etc/localtime -F perm=wa -F key=10.4.2b-time-change |
| 115 |
|
| 116 |
## 10.5 Secure audit trails so they cannot be altered |
| 117 |
## The audit system protects audit logs by virtue of being the root user. |
| 118 |
## That means that no normal user can tamper with the audit trail. If for |
| 119 |
## some reason you suspect that admins may be malicious or that their acct |
| 120 |
## could be compromised, then enable the remote logging plugin and get the |
| 121 |
## logs off the system to assure that there is an unaltered copy. |
| 122 |
|
| 123 |
## 10.5.1 Limit viewing of audit trails to those with a job-related need. |
| 124 |
## The audit daemon by default limits viewing of the audit trail to root. |
| 125 |
## If someone that is not an admin has a job related need to see logs, then |
| 126 |
## create a unique group for people with this need and set the log_group |
| 127 |
## configuration item in auditd.conf |
| 128 |
|
| 129 |
## 10.5.2 Protect audit trail files from unauthorized modifications. |
| 130 |
## See discussion in 10.5 above |
| 131 |
|
| 132 |
## 10.5.3 Promptly back up audit trail files to a centralized log server |
| 133 |
## See discussion in 10.5 above |
| 134 |
|
| 135 |
## 10.5.4 Write logs for external-facing technologies onto a secure, |
| 136 |
## centralized, internal log serve |
| 137 |
## See discussion in 10.5 above |
| 138 |
|
| 139 |
## 10.5.5 Use file-integrity monitoring or change-detection software on logs |
| 140 |
-a always,exit -F arch=b32 -F dir=/var/log/audit/ -F perm=wa -F key=10.5.5-modification-audit |
| 141 |
-a always,exit -F arch=b64 -F dir=/var/log/audit/ -F perm=wa -F key=10.5.5-modification-audit |
| 142 |
|
| 143 |
## Feel free to add watches on other critical logs |
| 144 |
# -a always,exit -F arch=b32 -F path=path-to-log -F perm=wa -F key=10.5.5-modification-log |
| 145 |
# -a always,exit -F arch=b64 -F path=path-to-log -F perm=wa -F key=10.5.5-modification-log |
| 146 |
|