Linux审计主要用于查看系统改动的信息,如系统密码修改,用户的新建,主要用于保障系统的安全,下面简单介绍审计如何使用
1启动审计进程:
[tommy@xie-testlog]$ sudo service auditd start
2查看当前审计规则
[tommy@xie-testlog]$ sudo auditctl -l
[sudo] passwordfor tommy:
LIST_RULES:exit,always watch=/etc/passwd perm=rwxa
我这里已经新建了一条规则,默认是no rules
3新建临时规则
[tommy@xie-testlog]$ sudo auditctl -w /etc/passwd -p rxwa
参数说明
-w :审计监视的路径
-p:目录或者文件的权限 ,rxwa分别是读、执行、写、属性
在输入命令
[tommy@xie-testlog]$ sudo auditctl -l
就能看到添加的一条规则,这里是对/etc/passwd这个密码文件的监视,如果这个文件发生修改那么就会在审计日志中被记录下来
说明:sudo auditctl -w /etc/passwd -p rxwa这条命令只是新建一条临时规则,如果服务重启或者系统重启,那么这条命令会被清空,如果要让其成为永久的规则,必须修改audit.rules文件,如下
[tommy@xie-testlog]$ sudo vi /etc/audit/audit.rules
[sudo] passwordfor tommy:
# This filecontains the auditctl rules that are loaded
# whenever theaudit daemon is started via the initscripts.
# The rules aresimply the parameters that would be passed
# to auditctl.</