Raw audit messages are logged to /var/log/audit/audit.log
. The following is an example AVC denial that occurred when the Apache HTTP Server (running in the httpd_t
domain) attempted to access the /var/www/html/file1
file (labeled with the samba_share_t
type):
type=AVC msg=audit(1225875185.864:96): avc: denied { getattr } for pid=2608 comm="httpd" path="/var/www/html/file1" dev=dm-0 ino=284916 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:samba_share_t:s0 tclass=file
{ getattr }
The item in braces indicates the permission that was denied. getattr
indicates the source process was trying to read the target file's status information. This occurs before reading files. This action is denied due to the file being accessed having the wrong label. Commonly seen permissions include getattr
, read
, and write
.
httpd
"
The file that launched the process. In this case, the /usr/sbin/httpd
file launched the Apache HTTP Server.
/var/www/html/file1
"The path to the object (target) that the process attempted to access.
unconfined_u:system_r:httpd_t:s0
"
The SELinux context of the process that attempted the denied action. In this case, it is the SELinux context of the Apache HTTP Server, which is running in the httpd_t
domain.
unconfined_u:object_r:samba_share_t:s0
"
The SELinux context of the object (target) that the process attempted to access. In this case, it is the SELinux context of file1
. Note: the samba_share_t
type is not accessible to processes running in the httpd_t
domain.
In certain situations, the tcontext
may match the scontext
, for example, when a process attempts to execute a system service that will change characteristics of that running process, such as the user ID. Also, the tcontext
may match the scontext
when a process tries to use more resources (such as memory) than normal limits allow, resulting in a security check to see if that process is allowed to break those limits.
An incorrect file type is a common cause for SELinux denying access. To start troubleshooting, compare the source context (scontext
) with the target context (tcontext
). Should the process (scontext
) be accessing such an object (tcontext
)? For example, the Apache HTTP Server (httpd_t
) should only be accessing types specified in the httpd_selinux(8) manual page, such as httpd_sys_content_t
, public_content_t
, and so on, unless configured otherwise.