【发布时间】:2016-07-22 07:10:43
【问题描述】:
目前,我希望 auditd 服务永远运行,用户无法通过任何命令停止此操作。
当前我的审核服务:
~]# systemctl cat auditd
# /usr/lib/systemd/system/auditd.service
[Unit]
Description=Security Auditing Service
DefaultDependencies=no
After=local-fs.target systemd-tmpfiles-setup.service
Conflicts=shutdown.target
Before=sysinit.target shutdown.target
RefuseManualStop=yes
ConditionKernelCommandLine=!audit=0
[Service]
ExecStart=/sbin/auditd -n
## To not use augenrules, copy this file to /etc/systemd/system/auditd.service
## and comment/delete the next line and uncomment the auditctl line.
## NOTE: augenrules expect any rules to be added to /etc/audit/rules.d/
ExecStartPost=-/sbin/augenrules --load
#ExecStartPost=-/sbin/auditctl -R /etc/audit/audit.rules
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
# /etc/systemd/system/auditd.service.d/override.conf
[Service]
ExecReload=
ExecReload=/bin/kill -HUP $MAINPID ; /sbin/augenrules --load
我无法通过命令停止此服务:
# systemctl stop auditd.service
Failed to stop auditd.service: Operation refused, unit auditd.service may be requested by dependency only.
但是当我使用service auditd stop 命令时。我可以正常停止这项服务。
# service auditd stop
Stopping logging: [ OK ]
我该如何预防呢?谢谢
【问题讨论】:
-
你应该包含
systemctl cat auditd的输出 -
我添加了这个命令的结果。
标签: linux service redhat systemd