All of lore.kernel.org
 help / color / mirror / Atom feed
From: cpebenito@tresys.com (Christopher J. PeBenito)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] Transition not working as expected with boolean cron_userdomain_transition set to on
Date: Wed, 2 Dec 2015 09:35:36 -0500	[thread overview]
Message-ID: <565F01B8.6060602@tresys.com> (raw)
In-Reply-To: <565DCA23.3070301@debian.org>

On 12/1/2015 11:26 AM, Laurent Bigonville wrote:
> Le 01/12/15 16:50, Christopher J. PeBenito a ?crit :
>> On 11/23/2015 6:31 AM, Laurent Bigonville wrote:
>>> Hi,
>>>
>>> While testing my patch for the at daemon, I think I also found a bug in
>>> the policy.
>>>
>>> With the cron_userdomain_transition boolean set to off I see the
>>> following behavior, user bigon is unconfined_u, test is user_u and
>>> test_staff is staff_u
>>>
>>> bigon at soldur:~$ /usr/sbin/getdefaultcon bigon system_u:system_r:crond_t:s0
>>> unconfined_u:unconfined_r:unconfined_cronjob_t:s0-s0:c0.c1023
>>> bigon at soldur:~$ /usr/sbin/getdefaultcon test system_u:system_r:crond_t:s0
>>> user_u:user_r:cronjob_t:s0
>>> bigon at soldur:~$ /usr/sbin/getdefaultcon test_staff
>>> system_u:system_r:crond_t:s0
>>> staff_u:staff_r:cronjob_t:s0
>>>
>>>
>>> Everything seems OK here.
>>>
>>> But when I toggle the boolean to on, I see the following behavior:
>>>
>>> bigon at soldur:~$ /usr/sbin/getdefaultcon bigon system_u:system_r:crond_t:s0
>>> unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
>>> bigon at soldur:~$ /usr/sbin/getdefaultcon test system_u:system_r:crond_t:s0
>>> /usr/sbin/getdefaultcon: Invalid argument
>>> bigon at soldur:~$ /usr/sbin/getdefaultcon test_staff
>>> system_u:system_r:crond_t:s0
>>> staff_u:sysadm_r:sysadm_t:s0
>>>
>>> As you can see a default context cannot be computed for the user_u user
>>> and the staff_u domain is transitioned to sysadm_r:sysadm_t (not sure
>>> this is intended)
>>>
>>> In the fedora policy I've found this patch
>>> https://github.com/fedora-selinux/selinux-policy/commit/28afa6f6438070902daca6ecb5d97abad7d53a0d
>>>
>>>
>>> If I'm _adding_ the user context to the default context
>>>
>>> bigon at soldur:~$ /usr/sbin/getdefaultcon bigon system_u:system_r:crond_t:s0
>>> unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
>>> bigon at soldur:~$ /usr/sbin/getdefaultcon test system_u:system_r:crond_t:s0
>>> user_u:user_r:user_t:s0
>>> bigon at soldur:~$ /usr/sbin/getdefaultcon test_staff
>>> system_u:system_r:crond_t:s0
>>> staff_u:staff_r:staff_t:s0
>>>
>>> I've attached a patch, am I understanding everything correctly here?
>> This makes sense, though the default_context files should probably be
>> updated similarly.
> Is the order relevant here?

For each line, the order is relevant.  The libraries will choose the
first partial context that will result in a valid context.  I'd have to
look at the code to see if it will skip partial contexts if the context
is valid but the transition is denied.

-- 
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

  reply	other threads:[~2015-12-02 14:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-23 11:31 [refpolicy] Transition not working as expected with boolean cron_userdomain_transition set to on Laurent Bigonville
2015-11-23 12:00 ` Dominick Grift
2015-11-23 12:15   ` Laurent Bigonville
2015-11-23 12:39     ` Dominick Grift
2015-12-01 15:50 ` Christopher J. PeBenito
2015-12-01 16:26   ` Laurent Bigonville
2015-12-02 14:35     ` Christopher J. PeBenito [this message]
2015-12-03 14:33       ` Laurent Bigonville
2015-12-03 15:57         ` Christopher J. PeBenito

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=565F01B8.6060602@tresys.com \
    --to=cpebenito@tresys.com \
    --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.