This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
система_linux_auditing [2012/06/17 18:31] val |
система_linux_auditing [2024/05/22 16:28] (current) val [Настройка правил аудита событий] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Система Linux Auditing ====== | ====== Система Linux Auditing ====== | ||
- | [[http://www.cyberciti.biz/tips/linux-audit-files-to-see-who-made-changes-to-a-file.html]] | + | * [[http://www.cyberciti.biz/tips/linux-audit-files-to-see-who-made-changes-to-a-file.html|Linux audit files to see who made changes to a file]] |
+ | * [[http://www.xakep.ru/post/54897/|Аудит системных событий в Linux]] | ||
+ | |||
+ | Сценарий: отслеживаем события чтения/записи/добавления в файлы passwd и shadow | ||
===== Установка и запуск системы аудита ===== | ===== Установка и запуск системы аудита ===== | ||
<code> | <code> | ||
- | # apt-get install auditd | + | # apt install auditd |
</code> | </code> | ||
===== Настройка правил аудита событий ===== | ===== Настройка правил аудита событий ===== | ||
Line 11: | Line 14: | ||
# auditctl -w /etc/passwd -p rwa -k passwords-files | # auditctl -w /etc/passwd -p rwa -k passwords-files | ||
+ | # auditctl -w /etc/shadow -p rwa -k passwords-files | ||
+ | |||
+ | # auditctl -l | ||
# cat /etc/audit/audit.rules | # cat /etc/audit/audit.rules | ||
+ | ubuntu24/debian12# /etc/audit/rules.d/audit.rules | ||
</code><code> | </code><code> | ||
... | ... | ||
+ | -w /etc/passwd -p rwa -k passwords-files | ||
-w /etc/shadow -p rwa -k passwords-files | -w /etc/shadow -p rwa -k passwords-files | ||
</code><code> | </code><code> | ||
- | # /etc/init.d/auditd restart | + | # service auditd restart |
</code> | </code> | ||
===== Генерация событий ===== | ===== Генерация событий ===== | ||
<code> | <code> | ||
- | # touch /etc/passwd | + | user1$ touch /etc/passwd |
- | # cat /etc/shadow | + | user1$ cat /etc/shadow |
</code> | </code> | ||
===== Поиск событий ===== | ===== Поиск событий ===== | ||
<code> | <code> | ||
- | # cat /var/log/audit/audit.log | + | # cat /var/log/audit/audit.log |
# ausearch -f /etc/passwd | # ausearch -f /etc/passwd | ||
# ausearch -k passwords-files | # ausearch -k passwords-files | ||
- | |||
- | # ausearch -f /etc/passwd -i | ||
</code> | </code> |