Skip to contentSkip to conversation

User range vs. context's range

DISCUSSION Christopher J. PeBenito 3 participants 8 messages Jan 20, 2016 – Jan 22, 2016 SELinux security module

lore
Share & tools
lore
#0 lore raw

What is the intended behavior for a user's allowed range in the policy vs. any labels in the policy (e.g. netifcon)? My expectation is that the allowed range should still apply, but it doesn't seem that checkpolicy checks that, based on what I've seen. For example, the new sediff test policies have this user[1]:

user added_user roles system level s1 range s1;

and checkpolicy doesn't error on this[2] later in the policy:

genfscon added_genfs / added_user:object_r:system:s0

I think this should fail compilation since s0 is not in added_user's allowed range.

[1]
https://github.com/TresysTechnology/setools/blob/master/tests/diff_right.conf#L605
[2]
https://github.com/TresysTechnology/setools/blob/master/tests/diff_right.conf#L633

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#1 lore raw
Quoted 6 lines · Christopher J. PeBenito

What is the intended behavior for a user's allowed range in the policy vs. any labels in the policy (e.g. netifcon)? My expectation is that the allowed range should still apply, but it doesn't seem that checkpolicy checks that, based on what I've seen. For example, the new sediff test policies have this user[1]:

Quoted 8 lines

user added_user roles system level s1 range s1;

and checkpolicy doesn't error on this[2] later in the policy:

genfscon added_genfs / added_user:object_r:system:s0

I think this should fail compilation since s0 is not in added_user's allowed range.

Not for objects (object_r), same as with role-type relation.

#2 lore raw
Quoted 9 lines · Stephen Smalley
Quoted 8 lines · Christopher J. PeBenito

What is the intended behavior for a user's allowed range in the policy vs. any labels in the policy (e.g. netifcon)? My expectation is that the allowed range should still apply, but it doesn't seem that checkpolicy checks that, based on what I've seen. For example, the new sediff test policies have this user[1]:

user added_user roles system level s1 range s1;

Quoted 8 lines
Quoted 6 lines

and checkpolicy doesn't error on this[2] later in the policy:

genfscon added_genfs / added_user:object_r:system:s0

I think this should fail compilation since s0 is not in added_user's allowed range.

Not for objects (object_r), same as with role-type relation.

I don't understand the logic for that. For the role-type relation, all types are implicitly added to object_r, which makes that behavior make sense, but the user has an explicitly-stated allowed range.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#3 lore raw
Quoted 14 lines · Christopher J. PeBenito
Quoted 13 lines · Stephen Smalley
Quoted 12 lines · Christopher J. PeBenito

What is the intended behavior for a user's allowed range in the policy vs. any labels in the policy (e.g. netifcon)? My expectation is that the allowed range should still apply, but it doesn't seem that checkpolicy checks that, based on what I've seen. For example, the new sediff test policies have this user[1]:

user added_user roles system level s1 range s1;

and checkpolicy doesn't error on this[2] later in the policy:

genfscon added_genfs / added_user:object_r:system:s0

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I think this should fail compilation since s0 is not in added_user's allowed range.

Not for objects (object_r), same as with role-type relation.

I don't understand the logic for that. For the role-type relation, all types are implicitly added to object_r, which makes that behavior make sense, but the user has an explicitly-stated allowed range.

If that's true, it is only true of setools, not of libsepol or the kernel binary policy. policydb_context_isvalid() omits the role-type and user-role relation checks if the role is object_r, and mls_context_isvalid() does likewise for the user-range relation check.

#4 lore raw
Quoted 18 lines · Stephen Smalley
Quoted 17 lines · Christopher J. PeBenito
Quoted 16 lines · Stephen Smalley
Quoted 14 lines · Christopher J. PeBenito

What is the intended behavior for a user's allowed range in the policy vs. any labels in the policy (e.g. netifcon)? My expectation is that the allowed range should still apply, but it doesn't seem that checkpolicy checks that, based on what I've seen. For example, the new sediff test policies have this user[1]:

user added_user roles system level s1 range s1;

and checkpolicy doesn't error on this[2] later in the policy:

genfscon added_genfs / added_user:object_r:system:s0

I think this should fail compilation since s0 is not in added_user's allowed range.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Not for objects (object_r), same as with role-type relation.

I don't understand the logic for that. For the role-type relation, all types are implicitly added to object_r, which makes that behavior make sense, but the user has an explicitly-stated allowed range.

If that's true, it is only true of setools, not of libsepol or the

By "that", I mean "all types are implicitly added to object_r". I don't see that anywhere in libsepol or the kernel. I do see it in libqpol. But if you dump a kernel policy and look at object_r's role->types, they are empty.

Quoted 3 lines

kernel binary policy. policydb_context_isvalid() omits the role-type and user-role relation checks if the role is object_r, and mls_context_isvalid() does likewise for the user-range relation check.

#5 lore raw
In reply to Stephen Smalley
Quoted 20 lines · Stephen Smalley
Quoted 19 lines · Christopher J. PeBenito
Quoted 17 lines · Stephen Smalley
Quoted 6 lines · Christopher J. PeBenito

What is the intended behavior for a user's allowed range in the policy vs. any labels in the policy (e.g. netifcon)? My expectation is that the allowed range should still apply, but it doesn't seem that checkpolicy checks that, based on what I've seen. For example, the new sediff test policies have this user[1]:

Quoted 8 lines

user added_user roles system level s1 range s1;

and checkpolicy doesn't error on this[2] later in the policy:

genfscon added_genfs / added_user:object_r:system:s0

I think this should fail compilation since s0 is not in added_user's allowed range.

Not for objects (object_r), same as with role-type relation.

Quoted 8 lines
Quoted 3 lines

I don't understand the logic for that. For the role-type relation, all types are implicitly added to object_r, which makes that behavior make sense, but the user has an explicitly-stated allowed range.

If that's true, it is only true of setools, not of libsepol or the kernel binary policy. policydb_context_isvalid() omits the role-type and user-role relation checks if the role is object_r, and mls_context_isvalid() does likewise for the user-range relation check.

Apologies for being misled by the long-time setools object_r behavior (I'll undo that). However, I still disagree with ignoring the user-range check in the object_r case, because there is an explicit user-range relationship written in the policy.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#6 lore raw
Quoted 30 lines · Christopher J. PeBenito
Quoted 20 lines · Stephen Smalley
Quoted 19 lines · Christopher J. PeBenito
Quoted 17 lines · Stephen Smalley
Quoted 6 lines · Christopher J. PeBenito

What is the intended behavior for a user's allowed range in the policy vs. any labels in the policy (e.g. netifcon)? My expectation is that the allowed range should still apply, but it doesn't seem that checkpolicy checks that, based on what I've seen. For example, the new sediff test policies have this user[1]:

Quoted 8 lines

user added_user roles system level s1 range s1;

and checkpolicy doesn't error on this[2] later in the policy:

genfscon added_genfs / added_user:object_r:system:s0

I think this should fail compilation since s0 is not in added_user's allowed range.

Not for objects (object_r), same as with role-type relation.

Quoted 8 lines
Quoted 3 lines

I don't understand the logic for that. For the role-type relation, all types are implicitly added to object_r, which makes that behavior make sense, but the user has an explicitly-stated allowed range.

If that's true, it is only true of setools, not of libsepol or the kernel binary policy. policydb_context_isvalid() omits the role-type and user-role relation checks if the role is object_r, and mls_context_isvalid() does likewise for the user-range relation check.

Quoted 4 lines

Apologies for being misled by the long-time setools object_r behavior (I'll undo that). However, I still disagree with ignoring the user-range check in the object_r case, because there is an explicit user-range relationship written in the policy.

It was only intended for subjects, not for objects.
Whether or not a subject can create an object at a level outside its own range depends on the mls constraints.

#7 lore raw
Quoted 31 lines · Stephen Smalley
Quoted 30 lines · Christopher J. PeBenito
Quoted 28 lines · Stephen Smalley
Quoted 14 lines · Christopher J. PeBenito
Quoted 13 lines · Stephen Smalley
Quoted 12 lines · Christopher J. PeBenito

What is the intended behavior for a user's allowed range in the policy vs. any labels in the policy (e.g. netifcon)? My expectation is that the allowed range should still apply, but it doesn't seem that checkpolicy checks that, based on what I've seen. For example, the new sediff test policies have this user[1]:

user added_user roles system level s1 range s1;

and checkpolicy doesn't error on this[2] later in the policy:

genfscon added_genfs / added_user:object_r:system:s0

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I think this should fail compilation since s0 is not in added_user's allowed range.

Not for objects (object_r), same as with role-type relation.

I don't understand the logic for that. For the role-type relation, all types are implicitly added to object_r, which makes that behavior make sense, but the user has an explicitly-stated allowed range.

If that's true, it is only true of setools, not of libsepol or the kernel binary policy. policydb_context_isvalid() omits the role-type and user-role relation checks if the role is object_r, and mls_context_isvalid() does likewise for the user-range relation check.

Quoted 10 lines
Quoted 4 lines

Apologies for being misled by the long-time setools object_r behavior (I'll undo that). However, I still disagree with ignoring the user-range check in the object_r case, because there is an explicit user-range relationship written in the policy.

It was only intended for subjects, not for objects.
Whether or not a subject can create an object at a level outside its own range depends on the mls constraints.

So CIL does not treat object_r as special (except when creating the binary policy), so that genfscon statement would cause an error in CIL. Subject and object contexts are not treated differently by CIL, but that can be changed if needed. I hadn't known that there was a difference.

Signature · 2 lines
James Carter <[email protected]>
National Security Agency