过去,我能够根据上下文更轻松地解决这个问题,但这个问题却让我困惑。当我运行sealert -a /var/log/audit/audit.log
并得到典型的输出时,例如...
--------------------------------------------------------------------------------
SELinux is preventing /usr/sbin/php-fpm from write access on the file index.html.
***** Plugin httpd_write_content (92.2 confidence) suggests ***************
If you want to allow php-fpm to have write access on the index.html file
Then you need to change the label on 'index.html'
Do
# semanage fcontext -a -t httpd_sys_rw_content_t 'index.html'
# restorecon -v 'index.html'
...
...
...
Additional Information:
Source Context system_u:system_r:httpd_t:s0
Target Context unconfined_u:object_r:httpd_sys_content_t:s0:c30
Target Objects index.html [ file ]
Source php-fpm
Source Path /usr/sbin/php-fpm
Port <Unknown>
Host <Unknown>
Source RPM Packages php-fpm-...
Target RPM Packages
Policy RPM selinux-policy-3.14.3-20.el8.noarch
Selinux Enabled True
Policy Type targeted
Enforcing Mode Enforcing
Host Name --REMOVED--
Platform --REMOVED--
Alert Count 12
First Seen 2020-07-28 10:31:59 EDT
Last Seen 2020-07-28 10:31:59 EDT
Local ID --REMOVED--
Raw Audit Messages
type=AVC msg=audit(...): avc: denied { write } for pid=... comm="php-fpm" name="index.html" dev="sda" ino=... scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:httpd_sys_content_t:s0:c30 tclass=file permissive=0
type=SYSCALL msg=audit(...): arch=x86_64 syscall=access success=no exit=EACCES a0=... a1=2 a2=0 a3=0 items=0 ppid=... pid=... auid=... uid=... gid=... euid=... suid=... fsuid=... egid=... sgid=... fsgid=... tty=(none) ses=... comm=php-fpm exe=/usr/sbin/php-fpm subj=system_u:system_r:httpd_t:s0 key=(null)ARCH=x86_64 SYSCALL=access AUID=unset UID=... GID=... EUID=... SUID=... FSUID=... EGID=... SGID=... FSGID=...
Hash: php-fpm,httpd_t,httpd_sys_content_t,file,write
--------------------------------------------------------------------------------
(为简洁起见,删除了一些信息,出于隐私考虑)
此概要中没有任何内容表明index.html
文件的位置。我唯一的想法是,返回的信息之一可以用作更详细的答案?但是哪一个?我相信花一点时间我就能找出这个特定的答案,因为我的系统上不会有太多的 index.html 文件,但我一直遇到这种情况,尝试找到所引用的文件非常耗时。任何帮助都将不胜感激!
答案1
您应该能够使用 find 和ino=...
已删除的 inode 编号来追踪它。