From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 051F6139694 for ; Sun, 7 May 2017 17:47:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BB7D021C09C; Sun, 7 May 2017 17:47:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8AFE221C098 for ; Sun, 7 May 2017 17:47:18 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E34B83416E1 for ; Sun, 7 May 2017 17:47:15 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7AFEC7459 for ; Sun, 7 May 2017 17:47:13 +0000 (UTC) From: "Jason Zaman" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jason Zaman" Message-ID: <1494178829.78cc3af7eeadb770d4f84393a382979862a580c9.perfinion@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:next commit in: policy/modules/contrib/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/contrib/dirmngr.fc policy/modules/contrib/dirmngr.if policy/modules/contrib/dirmngr.te policy/modules/contrib/gpg.if policy/modules/contrib/gpg.te X-VCS-Directories: policy/modules/contrib/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: 78cc3af7eeadb770d4f84393a382979862a580c9 X-VCS-Branch: next Date: Sun, 7 May 2017 17:47:13 +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: 584f1237-c970-422f-9922-1284599b1073 X-Archives-Hash: 456f24b53bd86b43ac8bfbdd4b691bbb commit: 78cc3af7eeadb770d4f84393a382979862a580c9 Author: Jason Zaman perfinion com> AuthorDate: Sun Apr 16 06:38:47 2017 +0000 Commit: Jason Zaman gentoo org> CommitDate: Sun May 7 17:40:29 2017 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=78cc3af7 gpg dirmngr: create and connect to socket policy/modules/contrib/dirmngr.fc | 2 ++ policy/modules/contrib/dirmngr.if | 25 +++++++++++++++++++++++++ policy/modules/contrib/dirmngr.te | 13 +++++++++++++ policy/modules/contrib/gpg.if | 38 ++++++++++++++++++++++++++++++++++++++ policy/modules/contrib/gpg.te | 1 + 5 files changed, 79 insertions(+) diff --git a/policy/modules/contrib/dirmngr.fc b/policy/modules/contrib/dirmngr.fc index a0f261c9..a9cf15a8 100644 --- a/policy/modules/contrib/dirmngr.fc +++ b/policy/modules/contrib/dirmngr.fc @@ -12,3 +12,5 @@ /run/dirmngr\.pid -- gen_context(system_u:object_r:dirmngr_var_run_t,s0) /run/dirmngr(/.*)? gen_context(system_u:object_r:dirmngr_var_run_t,s0) + +/run/user/%{USERID}/gnupg/S.dirmngr -s gen_context(system_u:object_r:dirmngr_tmp_t,s0) diff --git a/policy/modules/contrib/dirmngr.if b/policy/modules/contrib/dirmngr.if index 2f6875a6..07af5063 100644 --- a/policy/modules/contrib/dirmngr.if +++ b/policy/modules/contrib/dirmngr.if @@ -18,6 +18,7 @@ interface(`dirmngr_role',` gen_require(` type dirmngr_t, dirmngr_exec_t; + type dirmngr_tmp_t; ') role $1 types dirmngr_t; @@ -29,6 +30,8 @@ interface(`dirmngr_role',` allow dirmngr_t $2:fd use; allow dirmngr_t $2:fifo_file { read write }; + + allow $2 dirmngr_tmp_t:sock_file { manage_sock_file_perms relabel_sock_file_perms }; ') ######################################## @@ -71,6 +74,28 @@ interface(`dirmngr_exec',` ######################################## ## +## Connect to dirmngr socket +## +## +## +## Domain allowed access. +## +## +# +interface(`dirmngr_stream_connect',` + gen_require(` + type dirmngr_t, dirmngr_tmp_t; + ') + + gpg_search_agent_tmp_dirs($1) + allow $1 dirmngr_tmp_t:sock_file rw_sock_file_perms; + allow $1 dirmngr_t:unix_stream_socket connectto; + userdom_search_user_runtime($1) + userdom_search_user_home_dirs($1) +') + +######################################## +## ## All of the rules required to ## administrate an dirmngr environment. ## diff --git a/policy/modules/contrib/dirmngr.te b/policy/modules/contrib/dirmngr.te index 23f40456..8e4a1a89 100644 --- a/policy/modules/contrib/dirmngr.te +++ b/policy/modules/contrib/dirmngr.te @@ -18,6 +18,9 @@ init_script_file(dirmngr_initrc_exec_t) type dirmngr_log_t; logging_log_file(dirmngr_log_t) +type dirmngr_tmp_t; +userdom_user_tmp_file(dirmngr_tmp_t) + type dirmngr_var_lib_t; files_type(dirmngr_var_lib_t) @@ -46,6 +49,8 @@ manage_files_pattern(dirmngr_t, dirmngr_var_lib_t, dirmngr_var_lib_t) manage_lnk_files_pattern(dirmngr_t, dirmngr_var_lib_t, dirmngr_var_lib_t) files_var_lib_filetrans(dirmngr_t, dirmngr_var_lib_t, dir) +manage_sock_files_pattern(dirmngr_t, dirmngr_tmp_t, dirmngr_tmp_t) + manage_dirs_pattern(dirmngr_t, dirmngr_var_run_t, dirmngr_var_run_t) manage_files_pattern(dirmngr_t, dirmngr_var_run_t, dirmngr_var_run_t) manage_sock_files_pattern(dirmngr_t, dirmngr_var_run_t, dirmngr_var_run_t) @@ -56,3 +61,11 @@ kernel_read_crypto_sysctls(dirmngr_t) files_read_etc_files(dirmngr_t) miscfiles_read_localization(dirmngr_t) + +userdom_search_user_home_dirs(dirmngr_t) +userdom_search_user_runtime(dirmngr_t) +userdom_user_runtime_filetrans(dirmngr_t, dirmngr_tmp_t, dir) + +optional_policy(` + gpg_agent_tmp_filetrans(dirmngr_t, dirmngr_tmp_t, sock_file) +') diff --git a/policy/modules/contrib/gpg.if b/policy/modules/contrib/gpg.if index efffff87..4480f9c6 100644 --- a/policy/modules/contrib/gpg.if +++ b/policy/modules/contrib/gpg.if @@ -216,6 +216,44 @@ interface(`gpg_stream_connect_agent',` ######################################## ## +## Search gpg agent dirs. +## +## +## +## Domain allowed access. +## +## +# +interface(`gpg_search_agent_tmp_dirs',` + gen_require(` + type gpg_agent_tmp_t; + ') + + allow $1 gpg_agent_tmp_t:dir search_dir_perms; +') + +######################################## +## +## filetrans in gpg_agent_tmp_t dirs +## +## +## +## Domain allowed access. +## +## +# +interface(`gpg_agent_tmp_filetrans',` + gen_require(` + type gpg_agent_t, gpg_agent_tmp_t; + type gpg_secret_t; + ') + + filetrans_pattern($1, gpg_agent_tmp_t, $2, $3, $4) + userdom_search_user_runtime($1) +') + +######################################## +## ## Send messages to and from gpg ## pinentry over DBUS. ## diff --git a/policy/modules/contrib/gpg.te b/policy/modules/contrib/gpg.te index 1b8448c7..140d8d94 100644 --- a/policy/modules/contrib/gpg.te +++ b/policy/modules/contrib/gpg.te @@ -140,6 +140,7 @@ tunable_policy(`use_samba_home_dirs',` optional_policy(` dirmngr_domtrans(gpg_t) + dirmngr_stream_connect(gpg_t) ') optional_policy(`