From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mummy.ncsc.mil (mummy.ncsc.mil [144.51.88.129]) by tarius.tycho.ncsc.mil (8.13.1/8.13.1) with ESMTP id n3M8dDgd025047 for ; Wed, 22 Apr 2009 04:39:13 -0400 Received: from tyo201.gate.nec.co.jp (jazzhorn.ncsc.mil [144.51.5.9]) by mummy.ncsc.mil (8.12.10/8.12.10) with ESMTP id n3M8dB9C003075 for ; Wed, 22 Apr 2009 08:39:12 GMT Message-ID: <49EED77F.5060407@ak.jp.nec.com> Date: Wed, 22 Apr 2009 17:38:23 +0900 From: KaiGai Kohei MIME-Version: 1.0 To: dwalsh@redhat.com, method@manicmethod.com CC: "Christopher J. PeBenito" , russell@coker.com.au, SE-Linux Subject: Re: daemons and MCS categories References: <200605220930.05483.russell@coker.com.au> <1148910738.14262.67.camel@sgc.columbia.tresys.com> <49EC1F11.6040003@ak.jp.nec.com> <49ED29CC.6080507@ak.jp.nec.com> In-Reply-To: <49ED29CC.6080507@ak.jp.nec.com> Content-Type: multipart/mixed; boundary="------------060403030700020708010200" Sender: owner-selinux@tycho.nsa.gov List-Id: selinux@tycho.nsa.gov This is a multi-part message in MIME format. --------------060403030700020708010200 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit The attached patch is a proof-of-concept for the facility to launch daemon processes with a certaon mcs ranges. The selinux-daemon-mcs-run_init.patch add run_init a new option which specifies the name of daemon. # run_init -n httpd /etc/init.d/httpd restart When -n option is given, run_init lookups under the /etc/selinux//contexts/initrc/, and replaces the range to be assigned on the init script. [root@saba run_init]# cat /etc/selinux/targeted/contexts/initrc/httpd s0-s0:c0.c31 [root@saba run_init]# ./run_init -n httpd /etc/init.d/httpd restart Authenticating kaigai. Password: Stopping httpd: [ OK ] Starting httpd: [ OK ] [root@saba run_init]# ps -AZ | grep httpd system_u:system_r:httpd_t:s0-s0:c0.c31 11303 ? 00:00:00 httpd system_u:system_r:httpd_t:s0-s0:c0.c31 11305 ? 00:00:00 httpd system_u:system_r:httpd_t:s0-s0:c0.c31 11308 ? 00:00:00 httpd system_u:system_r:httpd_t:s0-s0:c0.c31 11309 ? 00:00:00 httpd system_u:system_r:httpd_t:s0-s0:c0.c31 11310 ? 00:00:00 httpd : The selinux-daemon-mcs-rc-script.patch is a short hack to the system init script. It launches the required script with "runcon -l", if per-daemon range is configured. These reworks typicall enable web-application (launched by httpd) to perform in a certain restrictive category of MCS. Currently, mod_selinux's security policy module assigns "mcssetcats" on httpd_t, but it is fundamentally denger and nonsense. :( So, I would like to see the daemon processes with appropriate categories. Thanks, KaiGai Kohei wrote: > KaiGai Kohei wrote: >> Sorry for opening the old discussion again. >> >> If you don't ML logs in local, please see the archives: >> http://marc.info/?t=114825463100001&r=1&w=2 >> >> Christopher J. PeBenito wrote: >>> I agree with James on this, I don't think we want to impose semantics in >>> the MCS categories, and that this >>> >>>> Another possibility is to have the ability to configure which categories are >>>> assigned to a daemon via run_init or some similar program. It would not be >>>> difficult to read a config file that maps the domain of a daemon to the range >>>> that should be granted to it. >>> is useful so that if users do want to run a daemon with categories, they >>> can. >> Is it still unavailable on the current SELinux userspace utilities, isn't it? > > Shall we start to implement an extention of run_init and others based on > the above Russell's idea? > > Now, I have a plan to store configuration files at: > /etc/selinux/${POLICY_TYPE}/contexts/initrc/${DAEMON} > or > /etc/selinux/${POLICY_TYPE}/contexts/initrc_contexts with format extensions > > and, add a new option to run_init as: > run_init [-n ]