Skip to contentSkip to conversation

range transitions in MCS

PATCH Russell Coker 2 participants 3 messages Oct 16, 2005 – Oct 20, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

Currently in the MCS policy in rawhide restarting a daemon changes it's MLS context from "s0" to "s0:c0.c255". This is obviously not what we want.

I suggest the attached patch to fix this.

The daemon policies cups.te, udev.te, and xdm.te need to be modified to include this attribute.

Signature · 4 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page
global_macros.te renamed from global_macros.te.orig +11 -0
@@ -324,11 +324,22 @@
 } else {
 ') dnl transitionbool
 domain_auto_trans(initrc_t, $1_exec_t, $1_t)
+
+# transition MLS range to "s0" when executing daemon.
+ifelse(index(`$2',`no_daemon_range_trans'), -1, `
+range_transition initrc_t $1_exec_t s0;
+')dnl no_daemon_range_trans
+
 allow initrc_t $1_t:process { noatsecure siginh rlimitinh };
 ifdef(`direct_sysadm_daemon', `
 ifelse(`$3', `nosysadm', `', `
 domain_auto_trans(sysadm_t, $1_exec_t, $1_t)
 allow sysadm_t $1_t:process { noatsecure siginh rlimitinh };
+
+# transition MLS range to "s0" when executing daemon.
+ifelse(index(`$2',`no_daemon_range_trans'), -1, `
+range_transition sysadm_t $1_exec_t s0;
+')dnl no_daemon_range_trans
 ')dnl end direct_sysadm_daemon
 ')dnl end nosysadm
 ifelse(index(`$2', `transitionbool'), -1, `', `
attrib.te renamed from attrib.te.orig +4 -0
@@ -494,6 +494,10 @@
 # For labeling of domains whos transition can be disabled
 attribute transitionbool;
 
+# For labelling daemons that should not have a range transition to "s0"
+# included in the daemon_base_domain macro
+attribute no_daemon_range_trans;
+
 # For labeling of file_context domains which users can change files to rather
 # then the default file context.  These file_context can survive a relabeling
 # of the file system.
#1 lore raw
Quoted 7 lines · Russell Coker

Currently in the MCS policy in rawhide restarting a daemon changes it's MLS context from "s0" to "s0:c0.c255". This is obviously not what we want.

I suggest the attached patch to fix this.

The daemon policies cups.te, udev.te, and xdm.te need to be modified to include this attribute.

Based on Joshua's message of subject "range_transition inside a conditional" I have come to believe that the above is the wrong solution (it works for strict but fails on targeted).

Adding the following to initrc.te seems to be a better solution to the problem.

range_transition sysadm_t initrc_exec_t s0;

PS Thanks for the fast response Joshua, this is for the tutorial I'm running in <24 hours...

Signature · 9 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
In reply to Russell Coker

Merged.

Along with:
2 patches from 9/17/05
5 patches from 9/19/05
1 patch from 9/22/05
2 patches from 10/13/05

I probably missed one somewhere.

Quoted 8 lines · Russell Coker

Currently in the MCS policy in rawhide restarting a daemon changes it's MLS context from "s0" to "s0:c0.c255". This is obviously not what we want.

I suggest the attached patch to fix this.

The daemon policies cups.te, udev.te, and xdm.te need to be modified to include this attribute.

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


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.