本文是How To Use the Linux Auditing System on CentOS 7的中文版,翻译不到之处,还请指出和多多包涵。本文并不会完全遵从原文的一些格式,而是加入自己学习的理解。
引言
Linux审计系统可帮助系统管理员创建审核跟踪记录,即服务器上每个操作的日志。我们可以通过检查审计日志文件audit.log来跟踪与安全相关的事件,将事件记录在日志文件中,来检测滥用或未授权的活动。我们可以选择要监视服务器上的哪些操作以及监视的程度。 审计不会为您的系统提供额外的安全性,但是有助于跟踪任何违反系统策略的行为,并使您能够采取其他安全措施来防止这些行为。
本教程介绍了审计系统,如何配置它,如何生成报告以及如何阅读这些报告。我们还将了解如何在审核日志中搜索特定事件。
前提
对于这篇教程,你需要准备如下:
- CentOS 7 系统(或CentOS 6)
- 具有sudo权限的非root用户。 要设置此类用户,请按照CentOS 7初始服务器设置教程进行操作。 所有命令都将以此用户身份运行。
验证Audit安装
audit系统分为两个主要部分:
- audit内核组件拦截来自用户程序的系统调用,记录事件,并且将这些审计信息发送到audit守护进程(audit daemon即auditd);
- auditd收集来自内核的信息,在日志文件中创建记录项
Audit系统使用如下包:audit和audit-libs。CentOS 7上已经默认安装。可以通过如下命令验证您的系统中是否已经安装好:
[lz@mail ~]$ sudo yum list audit audit-libs
完整输出如下,可以看到已经安装完成:
[lz@mail ~]$ sudo yum list audit audit-libs 已加载插件:fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.163.com * updates: mirrors.aliyun.com 已安装的软件包 audit.x86_64 2.6.5-3.el7_3.1 @updates audit-libs.x86_64 2.6.5-3.el7_3.1 @updates 可安装的软件包 audit-libs.i686 2.6.5-3.el7_3.1 updates