From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-946999-garchives=archives.gentoo.org@lists.gentoo.org>
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 602F6139694
	for <garchives@archives.gentoo.org>; Sun, 30 Apr 2017 09:32:48 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 7062FE0DC0;
	Sun, 30 Apr 2017 09:32:47 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(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 38FFFE0DC0
	for <gentoo-commits@lists.gentoo.org>; Sun, 30 Apr 2017 09:32:47 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(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 01D1C341698
	for <gentoo-commits@lists.gentoo.org>; Sun, 30 Apr 2017 09:32:46 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 83EEC7448
	for <gentoo-commits@lists.gentoo.org>; Sun, 30 Apr 2017 09:32:44 +0000 (UTC)
From: "Jason Zaman" <perfinion@gentoo.org>
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" <perfinion@gentoo.org>
Message-ID: <1493543572.cb26336af2009ff82257bb3d49f0630259471070.perfinion@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/wm.if policy/modules/contrib/wm.te
X-VCS-Directories: policy/modules/contrib/
X-VCS-Committer: perfinion
X-VCS-Committer-Name: Jason Zaman
X-VCS-Revision: cb26336af2009ff82257bb3d49f0630259471070
X-VCS-Branch: master
Date: Sun, 30 Apr 2017 09:32:44 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: e9aa2919-8766-4a61-b449-aaccb8d50581
X-Archives-Hash: 6dd0ae9afe0f04a0125cab8920fa1e57

commit:     cb26336af2009ff82257bb3d49f0630259471070
Author:     Guido Trentalancia <guido <AT> trentalancia <DOT> net>
AuthorDate: Sun Apr 16 22:39:36 2017 +0000
Commit:     Jason Zaman <perfinion <AT> gentoo <DOT> org>
CommitDate: Sun Apr 30 09:12:52 2017 +0000
URL:        https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=cb26336a

wm: interactive start

Update the window manager (wm) module (support starting
gnome-shell from an X terminal).

This second version curbs on an open permission when dealing with the user terminal (terminal is already opened by the X terminal application, thanks to Christian Göttsche for the tip).

Signed-off-by: Guido Trentalancia <guido <AT> trentalancia.net>

 policy/modules/contrib/wm.if | 27 +++++++++++++++++++++++++++
 policy/modules/contrib/wm.te |  7 ++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/policy/modules/contrib/wm.if b/policy/modules/contrib/wm.if
index dbe32237..e8fd7706 100644
--- a/policy/modules/contrib/wm.if
+++ b/policy/modules/contrib/wm.if
@@ -73,6 +73,8 @@ template(`wm_role_template',`
 	xserver_role($2, $1_wm_t)
 	xserver_manage_core_devices($1_wm_t)
 
+	wm_write_pipes($1, $3)
+
 	optional_policy(`
 		dbus_connect_spec_session_bus($1, $1_wm_t)
 		dbus_spec_session_bus_client($1, $1_wm_t)
@@ -219,3 +221,28 @@ interface(`wm_application_domain',`
 	userdom_user_application_domain($1, $2)
 	domtrans_pattern(wm_domain, $2, $1)
 ')
+
+########################################
+### <summary>
+###	Write wm unnamed pipes.
+### </summary>
+## <param name="role_prefix">
+###	<summary>
+###	The prefix of the user domain (e.g., user
+###	is the prefix for user_t).
+###	</summary>
+### </param>
+### <param name="domain">
+###	<summary>
+###	Domain allowed access.
+###	</summary>
+### </param>
+### </param>
+##
+interface(`wm_write_pipes',`
+	gen_require(`
+		type $1_t;
+	')
+
+	allow $2 $1_wm_t:fifo_file write;
+')

diff --git a/policy/modules/contrib/wm.te b/policy/modules/contrib/wm.te
index 77dcc432..5b39df69 100644
--- a/policy/modules/contrib/wm.te
+++ b/policy/modules/contrib/wm.te
@@ -64,6 +64,8 @@ kernel_read_fs_sysctls(wm_domain)
 kernel_read_proc_symlinks(wm_domain)
 kernel_read_sysctl(wm_domain)
 
+locallogin_dontaudit_use_fds(wm_domain)
+
 miscfiles_read_fonts(wm_domain)
 miscfiles_read_generic_certs(wm_domain)
 miscfiles_read_localization(wm_domain)
@@ -72,13 +74,16 @@ networkmanager_read_etc_files(wm_domain)
 
 udev_read_pid_files(wm_domain)
 
-# this is needed by gnome-shell
+# the following is needed by gnome-shell
 userdom_exec_user_home_content_files(wm_domain)
 
 userdom_manage_user_tmp_sockets(wm_domain)
 userdom_tmp_filetrans_user_tmp(wm_domain, sock_file)
 userdom_user_runtime_filetrans_user_tmp(wm_domain, sock_file)
 
+# to print error messages
+userdom_use_inherited_user_terminals(wm_domain)
+
 userdom_manage_user_home_content_dirs(wm_domain)
 userdom_manage_user_home_content_files(wm_domain)