From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id B52451381F3 for ; Wed, 18 Sep 2013 08:58:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BB2CCE0AED; Wed, 18 Sep 2013 08:58:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0B25EE0AD5 for ; Wed, 18 Sep 2013 08:58:33 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DB26A33EA87 for ; Wed, 18 Sep 2013 08:58:32 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 830E5E530A for ; Wed, 18 Sep 2013 08:58:31 +0000 (UTC) From: "Sven Vermeulen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Vermeulen" Message-ID: <1379338759.c8dac85b28937570df596a1dbc3c5e34fa87cfb9.SwifT@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/contrib/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/contrib/portage.fc policy/modules/contrib/portage.if policy/modules/contrib/portage.te X-VCS-Directories: policy/modules/contrib/ X-VCS-Committer: SwifT X-VCS-Committer-Name: Sven Vermeulen X-VCS-Revision: c8dac85b28937570df596a1dbc3c5e34fa87cfb9 X-VCS-Branch: master Date: Wed, 18 Sep 2013 08:58:31 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 788b52a5-508b-4e89-83d4-e591cc326f53 X-Archives-Hash: 2563e3cb192ebcf021fadca35b302870 commit: c8dac85b28937570df596a1dbc3c5e34fa87cfb9 Author: Sven Vermeulen siphos be> AuthorDate: Mon Sep 16 13:39:19 2013 +0000 Commit: Sven Vermeulen siphos be> CommitDate: Mon Sep 16 13:39:19 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-refpolicy.git;a=commit;h=c8dac85b Fix bug 482196 - Support emerge --config Currently, running "emerge --config" transitions the command to portage_t, which does not have the necessary permissions SELinux-wise to do its usual things (--config is meant to configure the system outside Portage sandboxing). With these changes, we can have users run "emerge --config" using runcon: ~# runcon -t sysadm_t emerge --config ... We mark ebuild and ebuild.sh as bin_t so no automatic transitions occur anymore. Also, portage_t now has bin_t as a valid entrypoint as Portage is SELinux-aware and calls setexeccon() upon calling ebuild and ebuild.sh to transition to portage_t. --- policy/modules/contrib/portage.fc | 5 +++-- policy/modules/contrib/portage.if | 3 +++ policy/modules/contrib/portage.te | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/policy/modules/contrib/portage.fc b/policy/modules/contrib/portage.fc index 8584af4..a2738ea 100644 --- a/policy/modules/contrib/portage.fc +++ b/policy/modules/contrib/portage.fc @@ -8,12 +8,13 @@ /usr/bin/glsa-check -- gen_context(system_u:object_r:portage_exec_t,s0) /usr/bin/layman -- gen_context(system_u:object_r:portage_fetch_exec_t,s0) /usr/bin/sandbox -- gen_context(system_u:object_r:portage_exec_t,s0) +/usr/bin/emerge -- gen_context(system_u:object_r:portage_exec_t,s0) -/usr/lib/portage/bin/ebuild -- gen_context(system_u:object_r:portage_exec_t,s0) +/usr/lib/portage/bin/ebuild -- gen_context(system_u:object_r:bin_t,s0) /usr/lib/portage/bin/emerge -- gen_context(system_u:object_r:portage_exec_t,s0) /usr/lib/portage/bin/emerge-webrsync -- gen_context(system_u:object_r:portage_fetch_exec_t,s0) /usr/lib/portage/bin/quickpkg -- gen_context(system_u:object_r:portage_exec_t,s0) -/usr/lib/portage/bin/ebuild\.sh -- gen_context(system_u:object_r:portage_exec_t,s0) +/usr/lib/portage/bin/ebuild\.sh -- gen_context(system_u:object_r:bin_t,s0) /usr/lib/portage/bin/regenworld -- gen_context(system_u:object_r:portage_exec_t,s0) /usr/lib/portage/bin/sandbox -- gen_context(system_u:object_r:portage_exec_t,s0) diff --git a/policy/modules/contrib/portage.if b/policy/modules/contrib/portage.if index 06655e1..fd1ae2a 100644 --- a/policy/modules/contrib/portage.if +++ b/policy/modules/contrib/portage.if @@ -13,10 +13,13 @@ interface(`portage_domtrans',` gen_require(` type portage_t, portage_exec_t; + type portage_tmp_t; ') corecmd_search_bin($1) domtrans_pattern($1, portage_exec_t, portage_t) + + can_exec($1, portage_tmp_t) # Portage does exectest ') ######################################## diff --git a/policy/modules/contrib/portage.te b/policy/modules/contrib/portage.te index 20da39d..533919c 100644 --- a/policy/modules/contrib/portage.te +++ b/policy/modules/contrib/portage.te @@ -395,6 +395,9 @@ ifdef(`distro_gentoo',` # allow portage_t self:capability2 block_suspend; + # Portage is selinuxaware, transitions on calling ebuild, now marked as bin_t + corecmd_bin_entry_type(portage_t) + auth_use_nsswitch(portage_t) libs_generic_etc_filetrans_ld_so_cache(portage_t, file, "ld.so.cache~")