All of lore.kernel.org
 help / color / mirror / Atom feed
From: cpebenito@tresys.com (Christopher J. PeBenito)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] [ v3 PATCH 5/8] Gitweb, cgit and the git_content attribute
Date: Fri, 26 Aug 2011 09:35:45 -0400	[thread overview]
Message-ID: <4E57A131.3070703@tresys.com> (raw)
In-Reply-To: <1314189346-10866-6-git-send-email-domg472@gmail.com>

On 08/24/11 08:35, Dominick Grift wrote:
> Cgit and gitweb are both cgi web applications that run in the httpd_git_script_t apache CGI domain.
> The policy in this commit was taken from Fedora. It is well tested i believe.
> These web applications display Git repositories. And they Should be able to read any Git
> repository whether shared or personal. We implemented another attribute for it called git_content.

Really all repos?  It seems like access to user repos should be tunable.

> This attribute will be assigned to any and all Git repository content types, either existing or
> to be created. Hopefully the next commit should explain why this attribute makes sense.
> 
> Signed-off-by: Dominick Grift <domg472@gmail.com>
> ---
> :100644 100644 7314ecb... c005782... M	policy/modules/services/git.fc
> :100644 100644 f1466e1... 83356f2... M	policy/modules/services/git.if
> :100644 100644 7040bf6... 8602887... M	policy/modules/services/git.te
>  policy/modules/services/git.fc |    4 ++-
>  policy/modules/services/git.if |   46 ++++++++++++++++++++++++++++++++++++++++
>  policy/modules/services/git.te |   11 +++++++-
>  3 files changed, 58 insertions(+), 3 deletions(-)
> 
> diff --git a/policy/modules/services/git.fc b/policy/modules/services/git.fc
> index 7314ecb..c005782 100644
> --- a/policy/modules/services/git.fc
> +++ b/policy/modules/services/git.fc
> @@ -2,8 +2,10 @@ HOME_DIR/public_git(/.*)?	gen_context(system_u:object_r:git_user_content_t,s0)
>  
>  /usr/libexec/git-core/git-daemon	--	gen_context(system_u:object_r:gitd_exec_t,s0)
>  
> -/var/cache/cgit(/.*)?		gen_context(system_u:object_r:httpd_git_rw_content_t,s0)
> +/var/cache/cgit(/.*)?	gen_context(system_u:object_r:httpd_git_rw_content_t,s0)
>  
>  /var/lib/git(/.*)?	gen_context(system_u:object_r:git_sys_content_t,s0)
>  
>  /var/www/cgi-bin/cgit	--	gen_context(system_u:object_r:httpd_git_script_exec_t,s0)
> +/var/www/git(/.*)?	gen_context(system_u:object_r:httpd_git_content_t,s0)
> +/var/www/git/gitweb.cgi	gen_context(system_u:object_r:httpd_git_script_exec_t,s0)
> diff --git a/policy/modules/services/git.if b/policy/modules/services/git.if
> index f1466e1..83356f2 100644
> --- a/policy/modules/services/git.if
> +++ b/policy/modules/services/git.if
> @@ -40,6 +40,52 @@ template(`git_session_role_template',`
>  
>  ########################################
>  ## <summary>
> +##	Read all Git daemon repository
> +##	content.
> +## </summary>
> +## <param name="domain">
> +##	<summary>
> +##	Domain allowed access.
> +##	</summary>
> +## </param>
> +#
> +interface(`git_read_all_content',`
> +	gen_require(`
> +		attribute git_content;
> +	')
> +
> +	list_dirs_pattern($1, git_content, git_content)
> +	read_files_pattern($1, git_content, git_content)
> +	userdom_search_user_home_dirs($1)
> +	files_search_var_lib($1)
> +
> +	tunable_policy(`use_nfs_home_dirs',`
> +		fs_read_nfs_files($1)
> +	',`
> +		fs_dontaudit_read_nfs_files($1)
> +	')
> +
> +	tunable_policy(`use_samba_home_dirs',`
> +		fs_read_cifs_files($1)
> +	',`
> +		fs_dontaudit_read_cifs_files($1)
> +	')
> +
> +	tunable_policy(`git_system_use_cifs',`
> +		fs_read_cifs_files($1)
> +	',`
> +		fs_dontaudit_read_cifs_files($1)
> +	')
> +
> +	tunable_policy(`git_system_use_nfs',`
> +		fs_read_nfs_files($1)
> +	',`
> +		fs_dontaudit_read_nfs_files($1)
> +	')
> +')
> +
> +########################################
> +## <summary>
>  ##	Execute Git daemon generic shared
>  ##	repository content files.
>  ## </summary>
> diff --git a/policy/modules/services/git.te b/policy/modules/services/git.te
> index 7040bf6..8602887 100644
> --- a/policy/modules/services/git.te
> +++ b/policy/modules/services/git.te
> @@ -5,6 +5,7 @@ policy_module(git, 1.0)
>  # Git daemon global declarations
>  #
>  
> +attribute git_content;
>  attribute git_daemon;
>  
>  type gitd_exec_t;
> @@ -18,7 +19,7 @@ type git_session_t, git_daemon;
>  application_domain(git_session_t, gitd_exec_t)
>  ubac_constrained(git_session_t)
>  
> -type git_user_content_t;
> +type git_user_content_t, git_content;
>  userdom_user_home_content(git_user_content_t)
>  
>  ########################################
> @@ -54,7 +55,7 @@ type git_system_t, git_daemon;
>  typealias git_system_t alias gitd_t;
>  inetd_service_domain(git_system_t, gitd_exec_t)
>  
> -type git_sys_content_t;
> +type git_sys_content_t, git_content;
>  files_type(git_sys_content_t)
>  
>  ########################################
> @@ -155,3 +156,9 @@ tunable_policy(`git_system_use_nfs',`
>  #
>  
>  apache_content_template(git)
> +
> +files_dontaudit_getattr_tmp_dirs(httpd_git_script_t)
> +
> +auth_use_nsswitch(httpd_git_script_t)
> +
> +git_read_all_content(httpd_git_script_t)


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

  reply	other threads:[~2011-08-26 13:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 12:35 [refpolicy] [ v3 PATCH 0/8] Git daemon domain Dominick Grift
2011-08-24 12:35 ` [refpolicy] [ v3 PATCH 1/8] Git inetd service domain and a primage Git shared repository type Dominick Grift
2011-08-24 12:35 ` [refpolicy] [ v3 PATCH 2/8] Git personal repositories Dominick Grift
2011-08-26 13:18   ` Christopher J. PeBenito
2011-08-26 13:30     ` Dominick Grift
2011-08-30 13:37       ` Christopher J. PeBenito
2011-08-30 17:31         ` Dominick Grift
2011-08-24 12:35 ` [refpolicy] [ v3 PATCH 3/8] Git shell users Dominick Grift
2011-08-25  9:07   ` Dominick Grift
2011-08-26 13:28     ` Christopher J. PeBenito
2011-08-26 15:36       ` Dominick Grift
2011-08-26 17:26       ` Dominick Grift
2011-08-24 12:35 ` [refpolicy] [ v3 PATCH 4/8] Git session daemon Dominick Grift
2011-08-26 13:33   ` Christopher J. PeBenito
2011-08-26 15:30     ` Dominick Grift
2011-08-30 13:50       ` Christopher J. PeBenito
2011-08-30 17:20         ` Dominick Grift
2011-08-31 14:36           ` Christopher J. PeBenito
2011-08-31 14:49             ` Dominick Grift
2011-08-31 15:14               ` Christopher J. PeBenito
2011-08-31 15:38                 ` Dominick Grift
2011-08-24 12:35 ` [refpolicy] [ v3 PATCH 5/8] Gitweb, cgit and the git_content attribute Dominick Grift
2011-08-26 13:35   ` Christopher J. PeBenito [this message]
2011-08-26 16:14     ` Dominick Grift
2011-08-30 13:23       ` Christopher J. PeBenito
2011-08-30 17:15         ` Dominick Grift
2011-08-31 14:48           ` Christopher J. PeBenito
2011-08-24 12:35 ` [refpolicy] [ v3 PATCH 6/8] Git shared repository separation and custom shared repository types Dominick Grift
2011-08-26 13:46   ` Christopher J. PeBenito
2011-08-26 15:46     ` Dominick Grift
2011-08-24 12:35 ` [refpolicy] [ v3 PATCH 7/8] Git session daemons binding TCP sockets to unreserved ports Dominick Grift
2011-08-24 12:35 ` [refpolicy] [ v3 PATCH 8/8] I am not sure about this but it might prove useful for NIS? Dominick Grift

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=4E57A131.3070703@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.