All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: [RFC][PATCH] selinux:  introduce support for deferred mappingof inode security contexts
@ 2006-05-16 12:50 Joshua Brindle
  2006-05-16 13:41 ` Stephen Smalley
  0 siblings, 1 reply; 8+ messages in thread
From: Joshua Brindle @ 2006-05-16 12:50 UTC (permalink / raw)
  To: Stephen Smalley, selinux
  Cc: Thomas Bleher, Daniel J Walsh, selinux-dev, James Morris

> From: Stephen Smalley [mailto:sds@tycho.nsa.gov] 
> Sent: Tuesday, May 16, 2006 8:16 AM
> 
> On Mon, 2006-05-15 at 12:35 -0400, Stephen Smalley wrote:
> > # touch foo
> > # chcon -t foo_exec_t foo
> > # ls -Z foo
> > -rw-r--r--  root root system_u:object_r:unlabeled_t    foo
> 
> Note that an alternative would be to modify 
> security_sid_to_context() to return the unmapped string 
> representation if it exists rather than just falling through 
> to the unlabeled SID's context.  In that case,
> getxattr() would return the unmapped string, and userspace 
> would see user_u:object_r:foo_exec_t throughout the example 
> even though the kernel would internally be applying access 
> checks based on the unlabeled SID's context.  That seems 
> useful for programs that want to check the attributes (e.g. 
> restore), but prevents rpm from easily checking whether the 

In the restore case it is much more about what is on the physical disk
than what the kernel sees and that information is easy to obtain. If
this returns the unmapped string doesn't it make the canonicalization
fairly useless?

> attribute has been validated by a subsequent policy load 
> (although it could use security_check_context(3) for that 
> purpose).  Likewise, if an audit message is generated for a 
> SID that has been invalidated, having 
> security_sid_to_context() return the unmapped string 
> representation would preserve the original string label in 
> the audit message rather than degenerating to the unlabeled 
> SID's context.

I think it would be very confusing to have conflicting audit messages
(eg., avc says one thing, audit message says another) however, it is
probably very important to be able to audit privlabel events and be able
to see the unmapped context in an audit message, is that possible?

Joshua Brindle


--
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.

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: [RFC][PATCH] selinux:  introduce support for deferred mappingof inode security contexts
@ 2006-05-24 17:36 Joshua Brindle
  0 siblings, 0 replies; 8+ messages in thread
From: Joshua Brindle @ 2006-05-24 17:36 UTC (permalink / raw)
  To: Jeremy Katz, Stephen Smalley; +Cc: selinux, selinux-dev, Paul Nasrat

> From: Jeremy Katz [mailto:katzj@redhat.com] 
> 
> On Tue, 2006-05-23 at 13:15 -0400, Stephen Smalley wrote:
> > Below is an updated version of the kernel patch to support rpm 
> > labeling of files before policy load, with a couple of bug 
> fixes and a 
> > re-base to 2.6.17-rc4-mm3.  Note that before we can 
> upstream this, we 
> > need to resolve the issues of how rpm will check file label 
> validity 
> > after policy load (e.g. calling security_check_context(3) on each 
> > label from the header), what corrective action rpm will 
> take if a file 
> > label is invalid (options suggested include relabeling to 
> unlabeled_t, 
> > relabeling to the context returned by the system policy via 
> > matchpathcon, or reverting the install), and the issues 
> raised by Karl 
> > above (as they also affect the ability of rpm to perform such 
> > verification and correction sanely).
> 
> Well, given that the only labels that will end up in a header 
> will be from a policy in that package, I'm still not really 
> convinced what adding a verification step _really_ accomplishes.  
> 

There are a number of reasons the policy module insertion can fail. The
package and the base being out of sync, for example as we saw last week.
The policy server (when its deployed) denying the policy addition.
Assertion violations, hierarchical assertion violations, mutual
dependancies between modules (which you will hit btw, since you are
installing them one at a time), conflicting modules, the list goes on.

By leaving bogus labels on the filesystem you add an attack vector where
future (possibly legitimate) policy can change the behavior of the
on-disk labels (transisions, etc). Further the application you just laid
down will probably be unusable. Even if unconfined_t can execute the
unlabeled apps other labels may be affected. For example, if passwd gets
laid down with a bogus label and an unconfined user runs it (in
unconfined_t since there won't be a transition) then the shadow label
will be lost and the shadow file will be accessible to confined domains
(eg., apache).



--
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.

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: [RFC][PATCH] selinux:  introduce support for deferred mappingof inode security contexts
@ 2006-05-25 15:42 Joshua Brindle
  2006-05-25 16:03 ` Stephen Smalley
  0 siblings, 1 reply; 8+ messages in thread
From: Joshua Brindle @ 2006-05-25 15:42 UTC (permalink / raw)
  To: Stephen Smalley, Jeremy Katz; +Cc: selinux, selinux-dev, Paul Nasrat

> From: Stephen Smalley [mailto:sds@tycho.nsa.gov] 
> 
> On Thu, 2006-05-25 at 11:19 -0400, Stephen Smalley wrote:
> > The alternative model to post checking after policy load would be to
> > either:
> > 1) Precheck the file contexts from the header against the 
> .pp file in 
> > some manner at install time (in which case rpm can abort early), or
> 

I'm not sure this works. As noted earlier the policy module insertion
can fail for a number of reasons so the labels would still be
inconsistent after installation (even if they were valid in the module).
Further its very tricky to determine whether a label is valid without
going through a full link/expand since the role types, attributes, etc
need to be expanded to decide if labels are valid.

> And as I suspect that you'll say that since those contexts 
> were generated from the .pp file in the first place, no such 
> checking is required, let me note that:
> a) the contexts will have been generated from the file 
> contexts part of the .pp, not from the policy module itself, 
> so there could be an inconsistency between the two that 
> leaves the context invalid under the new policy, and
> b) having rpm recheck at install time provides us with both 
> greater robustness (in the event of a bug in rpmbuild or a 
> package corrupted in some manner along the way) and security 
> (in the event of a maliciously constructed package).
> 
> > 2) Have load_policy fail if any of these labelpriv-created contexts 
> > were not made valid by the new policy, reverting to the old 
> policy and 
> > returning an error all the way back to rpm (in which case rpm still 
> > has to take some corrective action).
> 

Implemented in the kernel? (trying to think this through) the sidtab
will be updated with the symbolic labels of the files but mapped to
unlabeled, the reload would check any label<->symbolic inconsistencies.
If a policy reload invalidates a label do you store the symbolic version
of it? If so how can you tell the difference between labels created with
labelpriv or otherwise invalidated labels?


I agree that this is very important from a robustness POV, specifically
the propagation of label inconsistencies that will happen if executables
stay unlabeled on the filesystem and therefore are unaffected by the
type_transition rules that would normally apply to them (which keep the
file labels consistent). This propagation could get worse and worse as
the system runs in an inconsistent state.


--
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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-05-25 16:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-16 12:50 [RFC][PATCH] selinux: introduce support for deferred mappingof inode security contexts Joshua Brindle
2006-05-16 13:41 ` Stephen Smalley
2006-05-16 14:02   ` Joshua Brindle
2006-05-16 14:54     ` Stephen Smalley
  -- strict thread matches above, loose matches on Subject: below --
2006-05-24 17:36 Joshua Brindle
2006-05-25 15:42 Joshua Brindle
2006-05-25 16:03 ` Stephen Smalley
2006-05-25 16:27   ` Stephen Smalley

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.