4.2. 使用哪个日志文件


在 Red Hat Enterprise Linux 中,默认情况下会安装 dbusaudit 软件包,除非它们已从默认软件包选择中删除。必须使用 Yum 安装 setroubleshoot-server (使用 yum install setroubleshoot-server 命令)。
如果 auditd 守护进程正在运行,则 SELinux 拒绝消息(如下所示)会被写入 /var/log/audit/audit.log
type=AVC msg=audit(1223024155.684:49): avc:  denied  { getattr } for  pid=2000 comm="httpd" path="/var/www/html/file1" dev=dm-0 ino=399185 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:samba_share_t:s0 tclass=file
另外,类似以下的消息会写入 /var/log/message 文件:
May 7 18:55:56 localhost setroubleshoot: SELinux is preventing httpd (httpd_t) "getattr" to /var/www/html/file1 (samba_share_t). For complete SELinux messages. run sealert -l de7e30d6-5488-466d-a606-92c9f40d316d
在 Red Hat Enterprise Linux 7 中,setroubleshootd 不再作为服务持续运行。但是,它仍用于分析 AVC 信息。如果需要,两个新程序充当启动 setroubleshoot 的方法:
  • sedispatch 工具作为审计子系统 的一部分运行。当返回 AVC 拒绝消息时,sedispatch 使用 dbus 发送消息。如果这些消息已在运行,这些消息将直接变为 setroubleshootd。如果没有运行,sedispatch 会自动启动。
  • seapplet 实用程序在系统工具栏中运行,等待 setroubleshootd 中的 dbus 消息。它启动通知 bubble,允许用户查看 AVC 消息。

过程 4.1. 自动启动守护进程

  1. 要将 auditdrsyslog 守护进程配置为在引导时自动启动,请以 root 用户身份输入以下命令:
    ~]# systemctl enable auditd.service
    ~]# systemctl enable rsyslog.service
  2. 要确保启用了守护进程,在 shell 提示符后输入以下命令:
    ~]$ systemctl is-enabled auditd
    enabled
    
    ~]$ systemctl is-enabled rsyslog
    enabled
    
    或者,使用 systemctl status service-name.service 命令并搜索命令输出中 启用 的关键字,例如:
    ~]$ systemctl status auditd.service | grep enabled
    auditd.service - Security Auditing Service
       Loaded: loaded (/usr/lib/systemd/system/auditd.service; enabled)
    
要了解更多有关 systemd 守护进程如何管理系统服务的信息,请参阅系统管理员指南中的管理系统章节。https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html-single/system_administrators_guide/index#sect-Managing_Services_with_systemd-Services
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.