微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux-在Redhat 7中阻止停止Auditd服务

目前,我想使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  ]

我该如何预防呢?谢谢

解决方法:

管理员(超级用户)将始终能够手动终止审核的进程(service命令执行的操作). systemd在这里所做的只是防止管理员通过systemctl界面进行操作.

在这两种情况下,没有特权的用户都无法杀死该守护程序.

如果您甚至想限制root用户可以执行的操作,就必须使用SELinux并自定义策略.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐