Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A1A9C433EF for ; Mon, 9 Sep 2019 09:36:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 014D02086D for ; Mon, 9 Sep 2019 09:36:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=bigon.be header.i=@bigon.be header.b="AJUmVWkP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728313AbfIIJgF (ORCPT ); Mon, 9 Sep 2019 05:36:05 -0400 Received: from ithil.bigon.be ([163.172.57.153]:55884 "EHLO ithil.bigon.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728293AbfIIJgF (ORCPT ); Mon, 9 Sep 2019 05:36:05 -0400 X-Greylist: delayed 541 seconds by postgrey-1.27 at vger.kernel.org; Mon, 09 Sep 2019 05:36:03 EDT Received: from localhost (localhost [IPv6:::1]) by ithil.bigon.be (Postfix) with ESMTP id 9463F20063 for ; Mon, 9 Sep 2019 11:27:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bigon.be; h= content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=key1; t= 1568021221; x=1569835622; bh=7x4JLU4V0NHwfRgD5zuwBtA+nC/r+05QM4a PY8y9x/0=; b=AJUmVWkPqH1z46u3PPlHJF/tYqJrvG6OEKxMB93PL/h5JjRZGPc /IIpyxrNRqlQ8P7Cc2h9YviLJm6+FQQUM8qxuYAXaOt2P8w8mzoe4StIcdspCfLg nwZNT5By2w8b4tUQcOVYXFiMEaemlkx+OFodIeoLKI/XLOXy77ZTceGk= Received: from ithil.bigon.be ([IPv6:::1]) by localhost (ithil.bigon.be [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id 61I-pZip3hZu for ; Mon, 9 Sep 2019 11:27:01 +0200 (CEST) Received: from edoras.bigon.be (unknown [193.53.238.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bigon@bigon.be) by ithil.bigon.be (Postfix) with ESMTPSA for ; Mon, 9 Sep 2019 11:27:01 +0200 (CEST) Received: from bigon (uid 1000) (envelope-from bigon@bigon.be) id 20591 by edoras.bigon.be (DragonFly Mail Agent v0.12); Mon, 09 Sep 2019 11:27:01 +0200 From: Laurent Bigonville To: selinux-refpolicy@vger.kernel.org Subject: [PATCH 2/2] Allow udevadm_t to use dac_read_search capability Date: Mon, 9 Sep 2019 11:27:01 +0200 Message-Id: <20190909092701.8508-2-bigon@debian.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190909092701.8508-1-bigon@debian.org> References: <20190909092701.8508-1-bigon@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org From: Laurent Bigonville udevadm trigger tries to read files under /sys/module/ that might not be readable by root, for example: --w------- 1 root root 4096 sep 5 17:06 /sys/module/snd_hda_codec_generic/uevent We choose to allow it here because, according to Grift, "the cap_dac_read_search could maybe be dontaudited, but then cap_dac_override would have to be dontaudited as well. cap_dac_read_search would also be triggered when you run `sudo udevadm ...` where pwd or/and oldpwd is ~" type=PROCTITLE msg=audit(29/08/19 15:37:14.505:417) : proctitle=/bin/udevadm trigger --type=subsystems --action=add type=PATH msg=audit(29/08/19 15:37:14.505:417) : item=0 name=/sys/module/snd_hda_codec_generic/uevent inode=17769 dev=00:13 mode=file,200 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:sysfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 type=CWD msg=audit(29/08/19 15:37:14.505:417) : cwd=/ type=SYSCALL msg=audit(29/08/19 15:37:14.505:417) : arch=x86_64 syscall=openat success=no exit=EACCES(Permission non accordée) a0=0xffffff9c a1=0x7fff23710260 a2=O_RDONLY|O_CLOEXEC a3=0x0 items=1 ppid=1 pid=481 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=udevadm exe=/usr/bin/udevadm subj=system_u:system_r:udevadm_t:s0 key=(null) type=AVC msg=audit(29/08/19 15:37:14.505:417) : avc: denied { dac_override } for pid=481 comm=udevadm capability=dac_override scontext=system_u:system_r:udevadm_t:s0 tcontext=system_u:system_r:udevadm_t:s0 tclass=capability permissive=0 type=AVC msg=audit(29/08/19 15:37:14.505:417) : avc: denied { dac_read_search } for pid=481 comm=udevadm capability=dac_read_search scontext=system_u:system_r:udevadm_t:s0 tcontext=system_u:system_r:udevadm_t:s0 tclass=capability permissive=0 Signed-off-by: Laurent Bigonville --- policy/modules/system/udev.te | 1 + 1 file changed, 1 insertion(+) diff --git a/policy/modules/system/udev.te b/policy/modules/system/udev.te index 399e9157..ae56a764 100644 --- a/policy/modules/system/udev.te +++ b/policy/modules/system/udev.te @@ -385,6 +385,7 @@ optional_policy(` # udevadm Local policy # +allow udevadm_t self:capability dac_read_search; allow udevadm_t self:netlink_kobject_uevent_socket create_socket_perms; allow udevadm_t self:unix_stream_socket create_socket_perms; -- 2.23.0