AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
# :-: audit关闭解决方案 | 适用范围 | 适用版本 | 人员 | 发布时间 | 文档版本 |备注 | | --- | --- | --- | --- | --- |--- | | 服务器操作系统 | V7-SP1-Build03 | 王国武 |2022.3.24| V1.0|发布| | 服务器操作系统 | V7-SP1-Build03 | 张志勇 |2022.3.24| V1.1|模板调整| ### 经测试,该方案有效可行 ***** ### 1.客户目标: 关闭审计: `#auditctl -s` enabled 0 ### 2.具体要求: 关闭审计的具体要求: (1)已上线运行中的系统停止审计 (2)重新启动系统保证审计是关闭的 ### 3.现状: #### 3.1 系统运行中停止审计 `systemctl stop auditd`,结果如下: auditctl -s: enabled 1 #### 3.2 重新启动系统审计关闭 `systemctl disable auditd`,重启系统的验证结果如下: auditctl -s: enabled 1 ### 4. 原因分析: auditctl -s: 中enabled值是由内核返回,auditctl通过netlink 和内核的审计子系统通信。具体原因仍需进一步分析。 ![](https://img.kancloud.cn/23/ad/23ad105948b2295e0bf9554c80fa150b_554x338.png) ### 5.解决方案: #### 5.1系统运行中停止审计 `systemctl disable auditd` auditctl -e 0 #### 5.2重新启动系统审计关闭 方案1:grub参数添加audit=0,同时关闭audit服务 操作步骤: (1)关闭audit服务:`systemctl stop auditd.service` (2)禁用audit服务:`systemctl disable auditd.service` (3)重启,修改grub参数,添加audit=0参数: 结果:`auditctl -s` Error - audit support not in kernel Cannot open netlink audit socket 方案2:添加一个开机自启动服务,完成auditctl -e 0 操作步骤: (1)关闭audit服务:`systemctl stop auditd.service` (2)禁用audit服务:`systemctl disable auditd ` (3)`auditctl -e 0` (4)编写脚本auto_setup_auditctl.sh,放入/etc/init.d/目录 ``` #!/bin/sh #chkconfig:2345 80 90 #description:auto_setup_auditctl.sh /usr/sbin/auditctl -e 0 ``` (5)增加可执行权限 `chmod +x /etc/init.d/auto_setup_auditctl.sh` (6)添加到开机启动中 `chkconfig --add auto_setup_auditctl.sh` 结果:`auditctl -s` enabled 0 方案3:在rc.local中添加auditctl -e 0,并启动rc-local服务 操作步骤: (1)关闭audit服务:`systemctl stop auditd.service` (2)禁用audit服务:`systemctl disable auditd ` (3)`auditctl -e 0` (4)`echo "auditctl -e 0">>/etc/rc.d/rc.local ` (5)`chmod +x /etc/rc.d/rc.local` 结果:`auditctl -s` enabled 0 ### 6. 方案分析与总结 #### 1.系统运行中停止审计: `systemctl disable auditd` `auditctl -e 0` #### 2.重新启动系统关闭审计 方案1: grub中添加参数audit=0,将使内核中不支持审核,无法读取状态。 方案2:单独写脚本加入到开机自启动中,可将audit关闭。 方案3:将需要执行的命令加入到rc.local中,可将audit关闭。 目前来看方案1的修改导致无法读取audit状态,方案2和方案3可读取audit状态,方案3操作简单,推荐方案3。