linux设置中断审计权限,linux audit审计(6)--audit永久生效的规则配置

定义reboot系统后,仍然生效的审计规则,有两种办法:

1、直接写入/etc/audit/audit.rules文件中,在service文件中需要加入ExecStartPost=-/sbin/auditctl -R /etc/audit/audit.rules

2、将规则文件放入到/etc/audit/rules.d/目录下,在service文件中加入ExecStartPost=-/sbin/augenrules --load

以上两种方法都有对应的命令:

1、auditctl -R path-to-rules,如

auditctl -R /etc/audit/rules.d/30-pci-dss.rules

2、augenrules --load

使用这个命令可以将/etc/audit/rules.d目录下的规则,按照顺序编辑到audit.rules中。

在/usr/share/doc/audit/rules/路径下,audit包提供了已经配置好的规则文件,用于各种认证,如PCI DSS,STIG等。如下:

linux-xdYUnA:/usr/share/doc/audit-2.7.6/rules # ll

total 96

-rw-r--r-- 1 root root 163 Mar 29 17:19 10-base-config.rules

-rw-r--r-- 1 root root 284 Apr 19 2017 10-no-audit.rules

-rw-r--r-- 1 root root 93 Apr 19 2017 11-loginuid.rules

-rw-r--r-- 1 root root 329 Apr 19 2017 12-cont-fail.rules -rw-r--r-- 1 root root 323 Apr 19 2017 12-ignore-error.rules -rw-r--r-- 1 root root 516 Apr 19 2017 20-dont-audit.rules -rw-r--r-- 1 root root 273 Apr 19 2017 21-no32bit.rules -rw-r--r-- 1 root root 252 Apr 19 2017 22-ignore-chrony.rules -rw-r--r-- 1 root root 4915 Apr 19 2017 30-nispom.rules -rw-r--r-- 1 root root 5952 Apr 19 2017 30-pci-dss-v31.rules -rw-r--r-- 1 root root 6663 Apr 19 2017 30-stig.rules -rw-r--r-- 1 root root 1498 Apr 19 2017 31-privileged.rules -rw-r--r-- 1 root root 218 Apr 19 2017 32-power-abuse.rules -rw-r--r-- 1 root root 156 Apr 19 2017 40-local.rules -rw-r--r-- 1 root root 439 Apr 19 2017 41-containers.rules -rw-r--r-- 1 root root 672 Apr 19 2017 42-injection.rules -rw-r--r-- 1 root root 424 Apr 19 2017 43-module-load.rules -rw-r--r-- 1 root root 326 Apr 19 2017 70-einval.rules -rw-r--r-- 1 root root 151 Apr 19 2017 71-networking.rules -rw-r--r-- 1 root root 86 Apr 19 2017 99-finalize.rules -rw-r--r-- 1 root root 1202 Apr 19 2017 README-rules

注意,每个rules有一个数字,这些表示的是加载顺序。如果需要pci-dss认证的规则,可以将10-base-config,30-pci-dss-v31,以及99-finalize拷贝到rules.d目录下。然后再使用augenrules --load命令把这些规则加载进来。

这些规则分类如下:

10 -Kernel and auditctl configuration20 -Rules that could match general rules but you want a different match30 -Main rules40 -Optional rules50 - Server-specific rules70 -System local rules90 - Finalize (immutable)

使用auditctl -R可以加载多个规则文件,不会覆盖,使用augenrules --load后,之前的规则就没有了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值