Skip to contentSkip to conversation

I hope the user guide will explain what to do with a message such as this one

DISCUSSION Stanley A. Klein 2 participants 2 messages Sep 7, 2008 – Sep 8, 2008 SELinux security module

lore
Share & tools
lore
#0 lore raw

I'm running Centos 5.2 and since a recent upgrade have been getting a screen containing the information I've copied below. The suggestions on the screen for fixing the problem are unhelpful. (I've found this to generally be the case with other similar screens I occasionally get when running applications.)

This is all happening down in the system. I have no idea what is going on there, what the relevant applications are trying to do, or why they are being blocked from doing it.

I hope the user guide will provide clear information on what to do when these kinds of messages occur.

Stan Klein

-----------------------------------------------------------------------------

SELinux is preventing perl (logwatch_t) "getattr" to /root (user_home_dir_t).

Detailed Description:
SELinux denied access requested by perl. It is not expected that this access is required by perl and this access may signal an intrusion attempt. It is also possible that the specific version or configuration of the application is causing it to require additional access.

Allowing Access

Sometimes labeling problems can cause SELinux denials. You could try to restore the default system file context for /root, restorecon -v '/root' If this does not work, there is currently no automatic way to allow this access. Instead, you can generate a local policy module to allow this access - see FAQ Or you can disable SELinux protection altogether. Disabling SELinux protection is not recommended. Please file a bug report against this package.

Additional Information

Source Context:  system_u:system_r:logwatch_t:SystemLow-SystemHigh
Target Context:  root:object_r:user_home_dir_t
Target Objects:  /root [ dir ]
Source:  0logwatch
Source Path:  /usr/bin/perl
Port:  <Unknown>
Host:  localhost.localdomain
Source RPM Packages:  perl-5.8.8-10.el5_2.3
Target RPM Packages:  filesystem-2.4.0-1.el5.centos
Policy RPM:  selinux-policy-2.4.6-137.1.el5
Selinux Enabled:  True
Policy Type:  targeted
MLS Enabled:  True
Enforcing Mode:  Enforcing
Plugin Name:  catchall_file
Host Name:  localhost.localdomain
Platform:  Linux localhost.localdomain 2.6.18-92.1.6.el5 #1 SMP Wed Jun
25 13:49:24 EDT 2008 i686 i686
Alert Count:  281
First Seen:  Sun 29 Jun 2008 11:32:46 AM EDT
Last Seen:  Sun 07 Sep 2008 11:57:17 AM EDT
Local ID:  404a8dd6-c7da-4ad0-bd2e-af87ab7fd144

Line Numbers:
Raw Audit Messages :
host=localhost.localdomain type=AVC msg=audit(1220803037.282:24): avc:
denied { getattr } for pid=3570 comm="perl" path="/root" dev=hdb1 ino=2875137 scontext=system_u:system_r:logwatch_t:s0-s0:c0.c1023 tcontext=root:object_r:user_home_dir_t:s0 tclass=dir

host=localhost.localdomain type=SYSCALL msg=audit(1220803037.282:24):
arch=40000003 syscall=195 success=no exit=-13 a0=81e8be0 a1=819b0c8 a2=a70ff4 a3=81e8be0 items=0 ppid=3568 pid=3570 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="perl" exe="/usr/bin/perl" subj=system_u:system_r:logwatch_t:s0-s0:c0.c1023 key=(null)

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 1 line · Stanley A. Klein

/root

Issues are often:

files in wrong places.
files miss or unlabeled.
booleans.
missing policy.

Best thing in my view would be to learn how to translate AVC denials into something you can understand. audit2allow can help you with this.

Audit2allow takes a AVC denial as input and translates it into policy language. /sbin/ausearch -m avc -ts today | audit2allow -R

Audit2why tries to find an explanation for the denials. /sbin/ausearch -m avc -ts today.

If you translate AVC messages without using audit2allow then you can also quickly search if any such rule is in policy but maybe not activated (boolean/tunable policy) seearch --allow -s logwatch_t -t user_home_dir_t -c dir /etc/selinux/targeted/policy/policy.23

Also make sure that the context of both the source and target are valid. It looks like logwatch_t is a valid type for this source but the type for the targeted does not look right to me (/root with context type user_home_dir_t). Here in Fedora this context is admin_home_t

It may be that this location is miss labeled:

/sbin/restorecon -R -v /root

Als you can see if there is a rule for admin_home_t. sesearch --allow -s logwatch_t -t admin_home_t -c dir /etc/selinux/targeted/policy/policy.23

if you are sure that 1. contexts are correct, 2. there is no tunable policy to be set for this source, then this is a case of missing policy.

missing policy may or may not signal an intrusion and should be examined with care. You can try to reproduce the violation. This way you can send a bug report upstream. if it is reproducible then it may not be a intrusion but just a bug.

If it is a bug then you can decide to implement a temporary patch to manage this access. Audit2allow supports a -M function which compiles policy module for inputted avc denails. One can install,list , update and remove these and other policy modules with the semodule command.

If you are familiar with SELinux you can also manually write the source for your custom policy module and compile that with make
-f /usr/share/selinux/devel/Makefile and install the compiled binary policy module with semdule. Remember to save the sources for your own modules as you may want to modify these modules later.

I think your issue may or may not be a bug. My quick examination shows that logwatch_t can get attributes of both directories with context type admin_home_t as well as user_home_dir_t.

My money say's it is either a miss labeled directory or missing policy.

Dominick Grift <[email protected]>