zoukankan      html  css  js  c++  java
  • 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 configuration
    20 - Rules that could match general rules but you want a different match
    30 - Main rules
    40 - Optional rules
    50 - Server-specific rules
    70 - System local rules
    90 - Finalize (immutable)

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

  • 相关阅读:
    基于深度学习的人脸识别系统,识别率高达99.7%
    计算机设计思想 —— 虚拟化
    计算机设计思想 —— 类比、建模与隐喻(同构)
    机器学习:simple linear iterative clustering (SLIC) 算法
    如何快速批量修改ArcGIS中的图层设置
    ubuntu 安装cuda 成功
    深度学习攒机配置
    修改hosts文件(判断是否为管理员/以管理员权限运行脚本)
    添加环境变量(永久生效)
    获取管理员组用户
  • 原文地址:https://www.cnblogs.com/xingmuxin/p/8795960.html
Copyright © 2011-2022 走看看