12.11. Setting up Audit to monitor software updates
You can use the pre-configured rule 44-installers.rules
to configure Audit to monitor the following utilities that install software:
-
dnf
[2] -
yum
-
pip
-
npm
-
cpan
-
gem
-
luarocks
To monitor the rpm
utility, install the rpm-plugin-audit
package. Audit will then generate SOFTWARE_UPDATE
events when it installs or updates a package. You can list these events by entering ausearch -m SOFTWARE_UPDATE
on the command line.
Pre-configured rule files cannot be used on systems with the ppc64le
and aarch64
architectures.
Conditions préalables
-
auditd
is configured in accordance with the settings provided in Configuring auditd for a secure environment .
Procédure
Copy the pre-configured rule file
44-installers.rules
from the/usr/share/audit/sample-rules/
directory to the/etc/audit/rules.d/
directory:# cp /usr/share/audit/sample-rules/44-installers.rules /etc/audit/rules.d/
Load the audit rules:
# augenrules --load
Vérification
List the loaded rules:
# auditctl -l -p x-w /usr/bin/dnf-3 -k software-installer -p x-w /usr/bin/yum -k software-installer -p x-w /usr/bin/pip -k software-installer -p x-w /usr/bin/npm -k software-installer -p x-w /usr/bin/cpan -k software-installer -p x-w /usr/bin/gem -k software-installer -p x-w /usr/bin/luarocks -k software-installer
Perform an installation, for example:
# dnf reinstall -y vim-enhanced
Search the Audit log for recent installation events, for example:
# ausearch -ts recent -k software-installer –––– time->Thu Dec 16 10:33:46 2021 type=PROCTITLE msg=audit(1639668826.074:298): proctitle=2F7573722F6C6962657865632F706C6174666F726D2D707974686F6E002F7573722F62696E2F646E66007265696E7374616C6C002D790076696D2D656E68616E636564 type=PATH msg=audit(1639668826.074:298): item=2 name="/lib64/ld-linux-x86-64.so.2" inode=10092 dev=fd:01 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:ld_so_t:s0 nametype=NORMAL cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0 type=PATH msg=audit(1639668826.074:298): item=1 name="/usr/libexec/platform-python" inode=4618433 dev=fd:01 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:bin_t:s0 nametype=NORMAL cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0 type=PATH msg=audit(1639668826.074:298): item=0 name="/usr/bin/dnf" inode=6886099 dev=fd:01 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:rpm_exec_t:s0 nametype=NORMAL cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0 type=CWD msg=audit(1639668826.074:298): cwd="/root" type=EXECVE msg=audit(1639668826.074:298): argc=5 a0="/usr/libexec/platform-python" a1="/usr/bin/dnf" a2="reinstall" a3="-y" a4="vim-enhanced" type=SYSCALL msg=audit(1639668826.074:298): arch=c000003e syscall=59 success=yes exit=0 a0=55c437f22b20 a1=55c437f2c9d0 a2=55c437f2aeb0 a3=8 items=3 ppid=5256 pid=5375 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=3 comm="dnf" exe="/usr/libexec/platform-python3.6" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="software-installer"
dnf
is a symlink in RHEL, the path in the dnf
Audit rule must include the target of the symlink. To receive correct Audit events, modify the 44-installers.rules
file by changing the path=/usr/bin/dnf
path to /usr/bin/dnf-3
.