Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3588893ybv; Sun, 16 Feb 2020 00:54:56 -0800 (PST) X-Google-Smtp-Source: APXvYqx5S+kp84oOUPRwyPVMlwLhvRt/0JDAeDsQyXt2ODaxMmD5g2Nl1L17PvUh6NB1e6GrLNM5 X-Received: by 2002:a9d:7cd0:: with SMTP id r16mr8683184otn.50.1581843296130; Sun, 16 Feb 2020 00:54:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581843296; cv=none; d=google.com; s=arc-20160816; b=q+hQcamqHVMn9hVq60dS6FmDArjiZmBDRqn7ma8DJBnYvQBk+9SXJ8zAE/ycWStmU2 rWGXBSxXCVMlzwocqHMIQHPvCrOMZ/xJOO5nj63pB8BeOUhChr/y+aI3NtQs5iOd8MVR v2Yv3e61r+HaigspKfeuH8+zciwQnn6oJBHcwPCRblt6Nm1K/ZwvUZ3utYUeRAbN11pN j3UlYD6JwY/HgikY/QYafmUZaBCTIzNXg5llw1uxQY9xKdwrWyFE5sNvrrei+9yNnYRr /rxc7YMkubby9eKTbTeXf/swybMhxuxdILMOAUeBbg7A7IRKC8R/KOtxzJeOzOQFpedh VTEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7uG+64uXYktJosLuR+N0moNMBUeMjyUbNrPqazX1ZXo=; b=FJa93YnciSNeyIeEOxzBIs36dVeHOQltagnJ/GoM1BNTDp6oV8ZtWXM28P8/T5EpYr XpcA2hixWmc/zBqlOztXCJRLlyiNrhRfLwj6vC/lIlTVXpRXw/1zJwmkDQ21wMBMf365 uWPhKrLnIDrFhoFCZWn/gU1MB2c/K8kLxFqiT5N15MBjljwZnEwGxU83sSEHRMKJCvW8 8jVkV6tOLb6thOX2nht/TAi5bVvTfgZ8y5t0AyWMchNiiZNITA902SLLs/ULdr8ss7+A 1bF9OFaCPQdlns/pIK3EoPC/PRZ7tQ4s5jMzWwPghlbXBN+E8xT31+zrVab0B21W5MQ7 f11Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@perfinion-com.20150623.gappssmtp.com header.s=20150623 header.b=GHyZmpeC; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y73si4846029oia.246.2020.02.16.00.54.54; Sun, 16 Feb 2020 00:54:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@perfinion-com.20150623.gappssmtp.com header.s=20150623 header.b=GHyZmpeC; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726116AbgBPIyx (ORCPT + 13 others); Sun, 16 Feb 2020 03:54:53 -0500 Received: from mail-pj1-f52.google.com ([209.85.216.52]:54806 "EHLO mail-pj1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbgBPIyx (ORCPT ); Sun, 16 Feb 2020 03:54:53 -0500 Received: by mail-pj1-f52.google.com with SMTP id dw13so5841005pjb.4 for ; Sun, 16 Feb 2020 00:54:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=perfinion-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7uG+64uXYktJosLuR+N0moNMBUeMjyUbNrPqazX1ZXo=; b=GHyZmpeCmLtVwU8YtqZ/fT/Fil1pxiXeFTSOm0rnXxJ2dlQoQETlp/yRVNyZvo8z7l 29H0AbPRER7marKi4fU10hqneIdPw3F1e1NJVl25I0dFCcB2iyc97G7oPVlNa6v6uMzA 0M81wIChjf4bAfJ2LKfqq2lVv2pOjJSZg+RopTkUPHkAS7IQoISXqzg3vNGvL4Cqpok+ Gnjh8iA8yS4O/AIIvNxmKJY0Oh1ra5Eeae3pC+icm/YkX9LEJ4da4YWPPCtewVsTfXzf VJckZrZn7R/4SCPSgyKII3b+y0xG8mHJndFjJ8wLhT9XBsDz/lfljpWK6Bm0Tr/0laSD DpJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7uG+64uXYktJosLuR+N0moNMBUeMjyUbNrPqazX1ZXo=; b=cmGvVdhd8yjSeW2Lg/PBgvPB4zzZIWRBhc6vBjG72K88MsYHTANWS8kFfzeCygp+Io KTLXXiyZVFMnIML43+iPH7kaHDMAtv3TINSQKNJ4CestKsE0fe8HAFHcAwJ75Jbs+9l6 fgmto6Y3+h28Y4PsKbUT02vlfc4I8McdHTUCK1xwX36bmhPijpnMkHk9BUIX12M+Lw2p tT/+ICTAYAcuLhKRctvl3O1Nah42peVKLWWxF0mPkD/bXMTjrp1u6Pkq9VSq0jpyeETv 542aQnaFGomM3J/7YgW3Ypytsuj8EtLGeIg8rrW9M1/BdlN28s0s5W3BxnT/DBKmZSSd s2ZQ== X-Gm-Message-State: APjAAAXfUx9TTG6r66NeqGwpcNEDsAb+Ar1/c9jn4U3yd0g/tv+/yC+q Dt7NGYlbcj8djLNpvervNjXf3rNhuMGmrQ== X-Received: by 2002:a17:90a:af81:: with SMTP id w1mr13956590pjq.14.1581843291386; Sun, 16 Feb 2020 00:54:51 -0800 (PST) Received: from localhost ([101.127.140.252]) by smtp.gmail.com with ESMTPSA id x21sm12415825pfn.164.2020.02.16.00.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Feb 2020 00:54:50 -0800 (PST) From: Jason Zaman To: selinux-refpolicy@vger.kernel.org Cc: Jason Zaman Subject: [PATCH 06/10] policykit devicekit: Add watch perms Date: Sun, 16 Feb 2020 16:54:18 +0800 Message-Id: <20200216085422.36530-6-jason@perfinion.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200216085422.36530-1-jason@perfinion.com> References: <20200216085422.36530-1-jason@perfinion.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org From: Jason Zaman avc: denied { watch } for pid=12488 comm="gmain" path="/etc" dev="zfs" ino=1436 scontext=system_u:system_r:devicekit_disk_t:s0-s0:c0.c1023 tcontext=system_u:object_r:etc_t:s0 tclass=dir permissive=0 avc: denied { watch } for pid=6452 comm="gmain" path="/run/ConsoleKit" dev="tmpfs" ino=17611 scontext=system_u:system_r:policykit_t:s0-s0:c0.c1023 tcontext=system_u:object_r:consolekit_runtime_t:s0 tclass=dir permissive=0 avc: denied { watch } for pid=6452 comm="gmain" path="/usr/share/polkit-1/actions" dev="zfs" ino=235638 scontext=system_u:system_r:policykit_t:s0-s0:c0.c1023 tcontext=system_u:object_r:usr_t:s0 tclass=dir permissive=0 avc: denied { watch } for pid=6452 comm="gmain" path="/etc/polkit-1/rules.d" dev="zfs" ino=268215 scontext=system_u:system_r:policykit_t:s0-s0:c0.c1023 tcontext=system_u:object_r:etc_t:s0 tclass=dir permissive=0 --- policy/modules/services/consolekit.if | 18 ++++++++++++++++++ policy/modules/services/devicekit.te | 1 + policy/modules/services/policykit.te | 3 +++ 3 files changed, 22 insertions(+) diff --git a/policy/modules/services/consolekit.if b/policy/modules/services/consolekit.if index 9aa0dbce..422c19cd 100644 --- a/policy/modules/services/consolekit.if +++ b/policy/modules/services/consolekit.if @@ -121,3 +121,21 @@ interface(`consolekit_read_pid_files',` allow $1 consolekit_runtime_t:dir list_dir_perms; read_files_pattern($1, consolekit_runtime_t, consolekit_runtime_t) ') + +######################################## +## +## Watch consolekit runtime dir. +## +## +## +## Domain allowed access. +## +## +# +interface(`consolekit_watch_runtime_dir',` + gen_require(` + type consolekit_runtime_t; + ') + + allow $1 consolekit_runtime_t:dir watch; +') diff --git a/policy/modules/services/devicekit.te b/policy/modules/services/devicekit.te index f58a7a19..ed88f10b 100644 --- a/policy/modules/services/devicekit.te +++ b/policy/modules/services/devicekit.te @@ -127,6 +127,7 @@ files_manage_boot_dirs(devicekit_disk_t) files_manage_mnt_dirs(devicekit_disk_t) files_read_etc_runtime_files(devicekit_disk_t) files_read_usr_files(devicekit_disk_t) +files_watch_etc_dirs(devicekit_disk_t) fs_getattr_all_fs(devicekit_disk_t) fs_list_inotifyfs(devicekit_disk_t) diff --git a/policy/modules/services/policykit.te b/policy/modules/services/policykit.te index 04e88500..4989157c 100644 --- a/policy/modules/services/policykit.te +++ b/policy/modules/services/policykit.te @@ -95,6 +95,8 @@ dev_read_urand(policykit_t) domain_read_all_domains_state(policykit_t) files_dontaudit_search_all_mountpoints(policykit_t) +files_watch_etc_dirs(policykit_t) +files_watch_usr_dirs(policykit_t) fs_getattr_xattr_fs(policykit_t) fs_list_inotifyfs(policykit_t) @@ -127,6 +129,7 @@ optional_policy(` optional_policy(` consolekit_read_pid_files(policykit_t) + consolekit_watch_runtime_dir(policykit_t) ') optional_policy(` -- 2.24.1