Significance of SELinux user and roles on objects.
I've read that the roles on objects (like files) are in reality of no use and are filled up just for the sake of filling. That's why every file has role object_r.
Which prompts me a question -- do the user and role of objects (like files) have any significance? Or can access be allowed/denied based on the object's role and user?
Quoted 3 lines · dE
I've read that the roles on objects (like files) are in reality of no use and are filled up just for the sake of filling. That's why every file has role
object_r.Which prompts me a question -- do the user and role of objects (like files) have any significance? Or can access be allowed/denied based on the object's role and user?
Roles on objects typically don't have any use. The kernel will create files with object_r regardless, so putting a role on a file can't easily be made useful right now. For example, I added user_tmp_t to the user_r so I could label a directory:
$ chcon user_u:user_r:user_tmp_t . $ ls -laZ total 12K drwxr-xr-x. 2 pebenito users user_u:user_r:user_tmp_t 6 May 20 09:25 . drwxrwxrwt. 127 root root system_u:object_r:tmp_t 8.0K May 20 09:25 ..
And then I touch a file:
$ touch test $ ls -laZ total 12K drwxr-xr-x. 2 pebenito users user_u:user_r:user_tmp_t 17 May 20 09:27 . drwxrwxrwt. 127 root root system_u:object_r:tmp_t 8.0K May 20 09:25 .. -rw-r--r--. 1 pebenito users user_u:object_r:user_tmp_t 0 May 20 09:27 test
So the new file still gets object_r instead of user_r. If you do have a role on an object, you can write constraints in the policy based on the role of the object. If the role was correctly set on objects, I would use the role on objects to enforce role separations in refpolicy.
The user is useful on some objects, as the basic constraints in refpolicy will deny creating or relabeling a file if the user of the process doesn't match the user of the file. If you have UBAC turned on in refpolicy, then the user separations will be enforced across all relevant object classes.
Signature · 3 lines
Chris PeBenito Tresys Technology, LLC www.tresys.com | oss.tresys.com
Quoted 1 line · Christopher J. PeBenito
The kernel will create files with
object_rregardless
Is this defined in the policy or is hard coded in the kernel?
If it's defined in the policy, can't the role on a newly created file be defined such that it's value depends on the SELinux user creating the file?
Quoted 4 lines · dE
Quoted 1 line · Christopher J. PeBenito
The kernel will create files with
object_rregardlessIs this defined in the policy or is hard coded in the kernel?
Hard coded into the kernel
Quoted 4 lines
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
Quoted 11 lines · Dominick Grift
Quoted 3 lines · dE
Quoted 1 line · Christopher J. PeBenito
The kernel will create files with
object_rregardlessIs this defined in the policy or is hard coded in the kernel?
Hard coded into the kernel
Quoted 4 lines
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
Ok. Thanks for clarifying all this.
Quoted 7 lines · Dominick Grift
Quoted 4 lines · dE
Quoted 1 line · Christopher J. PeBenito
The kernel will create files with
object_rregardlessIs this defined in the policy or is hard coded in the kernel?
Hard coded into the kernel
Unless the policy specifies to default from source or target for the file class...
Quoted 10 lines · Stephen Smalley
Quoted 5 lines · Dominick Grift
Quoted 3 lines · dE
Quoted 1 line · Christopher J. PeBenito
The kernel will create files with
object_rregardlessIs this defined in the policy or is hard coded in the kernel?
Hard coded into the kernel
Unless the policy specifies to default from source or target for the file class...
So you can define the default object in the policy file as per the object class.
Quoted 6 lines · dE
Quoted 5 lines · Stephen Smalley
Quoted 4 lines · Dominick Grift
Quoted 3 lines · dE
Quoted 1 line · Christopher J. PeBenito
The kernel will create files with
object_rregardlessIs this defined in the policy or is hard coded in the kernel?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Hard coded into the kernel
Unless the policy specifies to default from source or target for the file class...
So you can define the default object in the policy file as per the object class.
Quoted 8 lines · Stephen Smalley
Quoted 7 lines · dE
Quoted 6 lines · Stephen Smalley
Quoted 5 lines · Dominick Grift
Quoted 3 lines · dE
Quoted 1 line · Christopher J. PeBenito
The kernel will create files with
object_rregardlessIs this defined in the policy or is hard coded in the kernel?
Hard coded into the kernel
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Unless the policy specifies to default from source or target for the file class...
So you can define the default object in the policy file as per the object class.
Ok. So this's comparatively a new feature. Thanks for sharing.
Quoted 11 lines · Stephen Smalley
Quoted 7 lines · Dominick Grift
Quoted 4 lines · dE
Quoted 1 line · Christopher J. PeBenito
The kernel will create files with
object_rregardlessIs this defined in the policy or is hard coded in the kernel?
Hard coded into the kernel
Unless the policy specifies to default from source or target for the file class...
So if I explicitly put default_role from target it will start inheriting the directory's role? If so, did that change also fix role_transition to work on file creation? i.e. can I write a rule like:
role_transition user_r tmp_t:file user_r;
So I can get the default_role from source-like behavior on certain types (I'd like to bring back role separations in refpolicy)?
Signature · 3 lines
Chris PeBenito Tresys Technology, LLC www.tresys.com | oss.tresys.com
Quoted 10 lines · Christopher J. PeBenito
Quoted 9 lines · Stephen Smalley
Quoted 7 lines · Dominick Grift
Quoted 4 lines · dE
Quoted 1 line · Christopher J. PeBenito
The kernel will create files with
object_rregardlessIs this defined in the policy or is hard coded in the kernel?
Hard coded into the kernel
Quoted 8 lines
Quoted 2 lines
Unless the policy specifies to default from source or target for the file class...
So if I explicitly put
default_rolefrom target it will start inheriting the directory's role? If so, did that change also fixrole_transitionto work on file creation? i.e. can I write a rule like:
role_transitionuser_rtmp_t:fileuser_r;So I can get the
default_rolefrom source-like behavior on certain types (I'd like to bring back role separations in refpolicy)?
policy.26 added support for role transitions on object classes. policy.27 added support for default rules for user/role/range inheritance (and policy.28 did the same for type inheritance).