All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel J Walsh <dwalsh@redhat.com>
To: Joshua Brindle <method@manicmethod.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>,
	Ivan Gyurdiev <ivg231@gmail.com>,
	SE Linux <selinux@tycho.nsa.gov>
Subject: Re: libsemage patch to not compile modules for seusers and fcontext
Date: Thu, 04 Sep 2008 15:16:49 -0400	[thread overview]
Message-ID: <48C03421.2040406@redhat.com> (raw)
In-Reply-To: <48BFFBD7.9070806@manicmethod.com>

Joshua Brindle wrote:
> Joshua Brindle wrote:
>> Stephen Smalley wrote:
>>> On Tue, 2008-08-26 at 21:52 -0400, Ivan Gyurdiev wrote:
>>>>>> I'm a little unclear on what this is doing - can you clarify?
>>>>>>     
>>>>> This is clearing the existing seusers.final file, otherwise delete was
>>>>> not working.
>>>>>   
>>>> I think the previous code was doing more - it was merging the local file 
>>>> with the shipped base package file, like this:
>>>>
>>>>     data = extract_file_from_policy_package( )
>>>>     write_file ( "seusers.final", data )
>>>>     if ( data != null ) {
>>>>         seusers.clear_cache()  // thereby forcing reload from 
>>>> seusers.final when cache() is called again (in merge_components)
>>>>     } else {
>>>>         seusers.clear()
>>>>     }
>>>>
>>>> It's also doing this three times (once for fcontexts, once for seusers, 
>>>> once for seusers_extra).
>>>> The problem is that you're skipping the link_sandbox call, which builds 
>>>> the base package, containing this information.
>>> We're trying to avoid the overhead of re-linking the policy when we are
>>> only modifying non-policy components like seusers and fcontexts.
>>> fcontexts.local is split out to a separate file for precedence reasons
>>> so it doesn't get merged anymore.  I don't think Dan actually uses
>>> seusers in the base policy for anything at present, but others may be.
>>>
>> Verified. The seusers coming from the policy are not merged into the seusers.final with this patchset. 
>>
>> It appears that at present in sepol_link_packages() there is no merging of seusers from each module so we only support seusers in base presently. Therefore we don't have to worry about getting the seusers from all the modules but we do need to grab them out of the base module and combine them in.
>>
> 
> Ping on this, were you able to reproduce this Dan? I'd like to get this patch in before we do a toolchain release (which is soonish).

Testing results. On my rawhide system.


NOTE: Rebuild policy old fashioned way
# rpm -Uhv --force
/home/dwalsh/sources/RPMS/noarch/selinux-policy*3.5.6-2.fc10.noarch.rpm
Preparing...                ###########################################
[100%]
   1:selinux-policy         ###########################################
[ 50%]
   2:selinux-policy-targeted###########################################
[100%]


# grep root /etc/selinux/targeted/seusers
/etc/selinux/targeted/modules/active/seusers
/etc/selinux/targeted/modules/active/seusers.final
/etc/selinux/targeted/seusers:root:unconfined_u:s0-s0:c0.c1023
/etc/selinux/targeted/modules/active/seusers:root:unconfined_u:s0-s0:c0.c1023
/etc/selinux/targeted/modules/active/seusers.final:root:unconfined_u:s0-s0:c0.c1023

Note all three seusers files reference root.

# semanage login -d root
NOTE: Command did not fail.  This command is actually deleting the
customization of root to use unconfined_u.

# grep root /etc/selinux/targeted/seusers \
/etc/selinux/targeted/modules/active/seusers \
/etc/selinux/targeted/modules/active/seusers.final
/etc/selinux/targeted/seusers:root:root:s0-s0:c0.c1023
/etc/selinux/targeted/modules/active/seusers.final:root:root:s0-s0:c0.c1023

NOTE root entry is still in
/etc/selinux/targeted/modules/active/seusers.final and
/etc/selinux/targeted/seusers
But it is using SELinux User "root" now which is the default in the base
package.

# semanage login -l | grep root
root                      root                      s0-s0:c0.c1023

NOTE semanage and getseuserbyname still have root entry

# semanage login -d root
/usr/sbin/semanage: Login mapping for root is defined in policy, cannot
be deleted

NOTE If I try to delete root a second time, it gives me an error because
now there is no local customization.

So the patch does not leave us in a bad state even if the user tries to
do something evil.  But it is not perfect, the same command acts
differently depending on local customization.

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2008-09-04 19:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-14 19:46 libsemage patch to not compile modules for seusers and fcontext Daniel J Walsh
2008-08-15  1:38 ` Ivan Gyurdiev
2008-08-22 13:38 ` Stephen Smalley
2008-08-26 15:11   ` Daniel J Walsh
2008-08-26 15:28     ` Joshua Brindle
2008-08-26 17:26       ` Daniel J Walsh
2008-08-26 18:42         ` Joshua Brindle
2008-08-27  1:52     ` Ivan Gyurdiev
2008-08-27 12:04       ` Stephen Smalley
2008-08-27 22:44         ` Joshua Brindle
2008-08-27 22:55           ` Joshua Brindle
2008-09-04 15:16           ` Joshua Brindle
2008-09-04 19:16             ` Daniel J Walsh [this message]
2008-09-05  2:52               ` Ivan Gyurdiev
2008-09-10 14:30       ` Daniel J Walsh
2008-09-11  3:08         ` Ivan Gyurdiev
2008-09-12 18:53         ` Joshua Brindle
2008-09-15 12:53           ` Daniel J Walsh
2008-09-15 15:59         ` Joshua Brindle

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=48C03421.2040406@redhat.com \
    --to=dwalsh@redhat.com \
    --cc=ivg231@gmail.com \
    --cc=method@manicmethod.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /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.