All of lore.kernel.org
 help / color / mirror / Atom feed
From: cpebenito@tresys.com (Christopher J. PeBenito)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] [PATCH 03/11] Introduce rc_exec_t as secundary entry file for initrc_t
Date: Thu, 25 Aug 2011 07:40:23 -0400	[thread overview]
Message-ID: <4E5634A7.5060102@tresys.com> (raw)
In-Reply-To: <20110823134044.GD857@siphos.be>

On 08/23/11 09:40, Sven Vermeulen wrote:
> Within Gentoo, the init system (openrc) uses a single binary (/sbin/rc) for all
> its functions, be it executing init scripts, managing runlevels, checking state,
> etc. This binary is not allowed to be labeled initrc_exec_t as that would
> trigger domain transitions where this isn't necessary (or even allowed).
> 
> A suggested solution is to use a separate type declaration for /sbin/rc
> (rc_exec_t) which transitions where necessary.
> 
> This patch includes support for the /sbin/rc rc_exec_t type and declares
> the init_rc_exec() interface which allows domains to execute the binary
> without transitioning.

I think the overall implementation is fine, except everything in this
patch should be in distro_gentoo blocks, except for the init_rc_exec()
implementation.

> Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
> ---
>  policy/modules/system/init.fc |    2 +-
>  policy/modules/system/init.if |   23 ++++++++++++++++++++++-
>  policy/modules/system/init.te |    4 ++++
>  3 files changed, 27 insertions(+), 2 deletions(-)
> 
> diff --git a/policy/modules/system/init.fc b/policy/modules/system/init.fc
> index 354ce93..c2021e3 100644
> --- a/policy/modules/system/init.fc
> +++ b/policy/modules/system/init.fc
> @@ -38,7 +38,7 @@ ifdef(`distro_gentoo', `
>  /sbin/upstart		--	gen_context(system_u:object_r:init_exec_t,s0)
>  
>  ifdef(`distro_gentoo', `
> -/sbin/rc		--	gen_context(system_u:object_r:initrc_exec_t,s0)
> +/sbin/rc		--	gen_context(system_u:object_r:rc_exec_t,s0)
>  /sbin/runscript		--	gen_context(system_u:object_r:initrc_exec_t,s0)
>  /sbin/runscript\.sh	--	gen_context(system_u:object_r:initrc_exec_t,s0)
>  /sbin/runsvcscript\.sh	--	gen_context(system_u:object_r:initrc_exec_t,s0)
> diff --git a/policy/modules/system/init.if b/policy/modules/system/init.if
> index 94fd8dd..b8b3337 100644
> --- a/policy/modules/system/init.if
> +++ b/policy/modules/system/init.if
> @@ -455,6 +455,26 @@ interface(`init_exec',`
>  
>  ########################################
>  ## <summary>
> +##	Execute the rc program in the caller domain.
> +## </summary>
> +## <param name="domain">
> +##	<summary>
> +##	Domain allowed access.
> +##	</summary>
> +## </param>
> +## <rolecap/>
> +#
> +interface(`init_rc_exec',`
> +	gen_require(`
> +		type rc_exec_t;
> +	')
> +
> +	corecmd_search_bin($1)
> +	can_exec($1, rc_exec_t)
> +')
> +
> +########################################
> +## <summary>
>  ##	Get the process group of init.
>  ## </summary>
>  ## <param name="domain">
> @@ -800,11 +820,12 @@ interface(`init_spec_domtrans_script',`
>  #
>  interface(`init_domtrans_script',`
>  	gen_require(`
> -		type initrc_t, initrc_exec_t;
> +		type initrc_t, initrc_exec_t, rc_exec_t;
>  	')
>  
>  	files_list_etc($1)
>  	domtrans_pattern($1, initrc_exec_t, initrc_t)
> +	domtrans_pattern($1, rc_exec_t, initrc_t)
>  
>  	ifdef(`enable_mcs',`
>  		range_transition $1 initrc_exec_t:process s0;
> diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te
> index 157e844..00586c6 100644
> --- a/policy/modules/system/init.te
> +++ b/policy/modules/system/init.te
> @@ -56,8 +56,10 @@ mls_trusted_object(initctl_t)
>  
>  type initrc_t, init_script_domain_type, init_run_all_scripts_domain;
>  type initrc_exec_t, init_script_file_type;
> +type rc_exec_t;
>  domain_type(initrc_t)
>  domain_entry_file(initrc_t, initrc_exec_t)
> +domain_entry_file(initrc_t, rc_exec_t)
>  role system_r types initrc_t;
>  # should be part of the true block
>  # of the below init_upstart tunable
> @@ -381,6 +383,8 @@ auth_delete_pam_pid(initrc_t)
>  auth_delete_pam_console_data(initrc_t)
>  auth_use_nsswitch(initrc_t)
>  
> +init_rc_exec(initrc_t)
> +
>  libs_rw_ld_so_cache(initrc_t)
>  libs_exec_lib_files(initrc_t)
>  libs_exec_ld_so(initrc_t)


-- 
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

  reply	other threads:[~2011-08-25 11:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23 13:36 [refpolicy] [PATCH v2 0/11] Portage-related updates Sven Vermeulen
2011-08-23 13:39 ` [refpolicy] [PATCH 01/11] Introduce portage_dontaudit_use_fds Sven Vermeulen
2011-08-25 11:46   ` Christopher J. PeBenito
2011-08-23 13:39 ` [refpolicy] [PATCH 02/11] Do not audit the use of portage' filedescriptors from load_policy_t Sven Vermeulen
2011-08-25 11:47   ` Christopher J. PeBenito
2011-08-23 13:40 ` [refpolicy] [PATCH 03/11] Introduce rc_exec_t as secundary entry file for initrc_t Sven Vermeulen
2011-08-25 11:40   ` Christopher J. PeBenito [this message]
2011-08-25 20:11     ` Sven Vermeulen
2011-08-30 12:20       ` Christopher J. PeBenito
2011-08-30 13:30         ` Christopher J. PeBenito
2011-08-23 13:41 ` [refpolicy] [PATCH 04/11] Allow gcc-config to execute /sbin/rc without transitioning Sven Vermeulen
2011-08-23 13:41 ` [refpolicy] [PATCH 05/11] Gentoo's integrated run_init support re-executes /sbin/rc Sven Vermeulen
2011-08-23 13:43 ` [refpolicy] [PATCH 06/11] Allow the sysadm domain to execute /sbin/rc without transitioning Sven Vermeulen
2011-08-23 13:43 ` [refpolicy] [PATCH 07/11] Introduce portage_fetch_t as an application domain Sven Vermeulen
2011-08-23 13:44 ` [refpolicy] [PATCH 08/11] Introduce search_conf_dirs and read_tmp_files interfaces for Portage Sven Vermeulen
2011-08-23 13:44 ` [refpolicy] [PATCH 09/11] Support GnuPG integration in Portage Sven Vermeulen
2011-08-23 13:46 ` [refpolicy] [PATCH 10/11] Allow cron to execute portage commands Sven Vermeulen
2011-08-25 11:36   ` Christopher J. PeBenito
2011-08-23 13:46 ` [refpolicy] [PATCH 11/11] Allow portage to call GnuPG Sven Vermeulen
2011-08-25 11:37   ` Christopher J. PeBenito

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E5634A7.5060102@tresys.com \
    --to=cpebenito@tresys.com \
    --cc=refpolicy@oss.tresys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.