All of lore.kernel.org
 help / color / mirror / Atom feed
From: pcclark@nps.edu (Paul Clark)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] MLS file upgrade
Date: Thu, 2 Feb 2012 10:26:21 -0800	[thread overview]
Message-ID: <4F2AD54D.60804@nps.edu> (raw)
In-Reply-To: <4F2AAA61.3090304@tresys.com>

In my earlier attempts to debug this desired ability to have all 
processes have file upgrade capabilities, I reset the type on 'testfile' 
to user_t (in permissive mode) to try to remove as many variables as 
possible from the problem, but I guess I introduced more problems.

When I leave the type as user_home_t, it still fails:
ls -Z
     user_u:object_r:user_home_t:s0 testfile
id -Z
     user_u:user_r:user_t:s0
chcon -l s1 testfile
     chcon: failed to change context of 'testfile' to 
'user_u:object_r:user_home_t:s1': Permission denied
chcon runs with the following context:
     user_u:user_r:user_t:s0

It now is reporting a 'relabelto' error.  I changed the 2nd MLS 
'mlsconstrain' rule in 'policy/mls' that applies to 'relabelto' from
     ( h1 dom h2 )
to
    ( l1 domby l2)

When I run sealert:


Summary:

SELinux is preventing /usr/bin/chcon "relabelto" access on
/home/user2/Documents/testfile.

Detailed Description:

SELinux denied access requested by chcon. It is not expected that this 
access is
required by chcon 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:

You can generate a local policy module to allow this access - see FAQ
(http://docs.fedoraproject.org/selinux-faq-fc5/#id2961385) Please file a bug
report.

Additional Information:

Source Context                user_u:user_r:user_t:s0
Target Context                user_u:object_r:user_home_t:s1
Target Objects                /home/user2/Documents/testfile [ file ]
Source                        chcon
Source Path                   /usr/bin/chcon
Port <Unknown>
Host                          sel13.ern.nps.edu
Source RPM Packages           coreutils-8.4-6.fc13
Target RPM Packages
Policy RPM                    selinux-policy-3.7.19-101.fc13
Selinux Enabled               True
Policy Type                   mls
Enforcing Mode                Enforcing
Plugin Name                   catchall
Host Name                     sel13.ern.nps.edu
Platform                      Linux sel13.ern.nps.edu 
2.6.33.3-85.fc13.i686.PAE
                               #1 SMP Thu May 6 18:27:11 UTC 2010 i686 i686
Alert Count                   2
First Seen                    Thu Feb  2 10:10:27 2012
Last Seen                     Thu Feb  2 10:10:30 2012
Local ID                      c3096a25-dad6-425b-a6d1-72584a164bdb
Line Numbers

Raw Audit Messages

node=sel13.ern.nps.edu type=AVC msg=audit(1328206230.964:56): avc:  
denied  { relabelto } for  pid=2093 comm="chcon" name="testfile" 
dev=sda1 ino=526347 scontext=user_u:user_r:user_t:s0 
tcontext=user_u:object_r:user_home_t:s1 tclass=file

node=sel13.ern.nps.edu type=SYSCALL msg=audit(1328206230.964:56): 
arch=40000003 syscall=226 success=no exit=-13 a0=93a68d0 a1=71a185 
a2=93a7c70 a3=1f items=0 ppid=2069 pid=2093 auid=501 uid=501 gid=501 
euid=501 suid=501 fsuid=501 egid=501 sgid=501 fsgid=501 tty=pts1 ses=1 
comm="chcon" exe="/usr/bin/chcon" subj=user_u:user_r:user_t:s0 key=(null)


On 2/2/12 7:23 AM, Christopher J. PeBenito wrote:
> On 02/01/12 20:09, Paul Clark wrote:
>> I want to change the MLS policy to allow any process to upgrade a file or directory, but I'm currently failing on an "easy" first step with a "relabelfrom" error.
>>
>> I'm using Fedora 13 and selinux-policy-3.7.19-101.fc13.src.rpm.
>>
>> I did *not* change the mlscontrain rule that deals with relabelfrom because I think it should still work.
>>
>> My test file has the same type that chcon runs with (user_t), and I'm simply trying to change the level from s0 to s1 by doing the following:
>>      chcon -l s1 testfile
> Can you clarify this?  It sounds like you're saying that your file is labeled user_t.  If thats the case, then its a regular TE problem, as user_t isn't a file type, so you can't relabel it.
>
>> I changed the mlsvalidatetrans statement for "dir" and "file" so that the first line was changed from
>>      ((( l1 eq l2 ) or
>> to
>>      ((( l1 domby l2 ) or
>>
>> Any obvious problems or suggestions?
>>
>> Another approach would be to also give all domains the "mlsfileupgrade" attribute.  Because my test process was running with user_t, I added:
>>      mls_file_upgrade(user_t)
>> to modules/admin/usermanage.te, but there was no change in the error.
>

  reply	other threads:[~2012-02-02 18:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02  1:09 [refpolicy] MLS file upgrade Paul Clark
2012-02-02 15:23 ` Christopher J. PeBenito
2012-02-02 18:26   ` Paul Clark [this message]
2012-02-03 13:25     ` Christopher J. PeBenito
2012-02-03 22:12       ` Paul Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F2AD54D.60804@nps.edu \
    --to=pcclark@nps.edu \
    --cc=refpolicy@oss.tresys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.