Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2512541lqo; Tue, 14 May 2024 00:22:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU5PW3rJBOpSDvcIEEvkruktl8tCBQteFnT58WHf8W+Vazrt/g1xRcHg57p9cLGY9xb3EGdfU4PCpYdf8qcAr6NhTN3kA5HkbPcMQ3f2Q== X-Google-Smtp-Source: AGHT+IE0itPm2hQi4I62hO6PUQBEI3KJob3yg5l7sNJdhNLkImBg9P4/uKyFwF682Y5sqbVkELhx X-Received: by 2002:a50:935b:0:b0:572:475c:a47c with SMTP id 4fb4d7f45d1cf-5734d5f4113mr8023824a12.22.1715671333413; Tue, 14 May 2024 00:22:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715671333; cv=pass; d=google.com; s=arc-20160816; b=yoSoy6NM/gTZByG20X8EiyDSDxphC7v61K0oYKh01LeCxljh7vyaWVAzq8Id1X5T1q PIIOA4KVfD0ToXrQOkgXH23Ymnk09eOgU38SpBucn1VWeppse4nr/fG66X83kWWUVLYN tsoUBuwskg19vhFiCMHSwFo9ByIF+13cFAlDIHihq20fz9MjbuE2yq/Vfd8OTtIfynK8 lAKEjGPLxMlliv1nc53uQ/JLz3qgtILveqMGFU3xLCpDiespBynVseeeYiZm29ymrkGu PocrhECBGSJY0HIZ2bHnCJmN6Hu7g7yIE7wug3EMcMXiGUP6XQoJNRop3BsIhf14RjBv AAYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from:dkim-signature; bh=HiFe5kltqDmVDJ7MRdMdgxdhcQOh8xuUsHBke9yH6bs=; fh=KbreB3X5w5PX89R/JhNeRPZtSm6GfztEz9WxktC6eQ0=; b=i80OPeOyHaZyR4VKDgRT7sBsYWyI0TaRkO1j3Yd3LvPOJQ6uH4vcHKG/++mDgwwYEG rP0sudjML+aAQd4p4gGQTfhR44XVK2VfPu7k4h3XN+wt6BnYLPbanB02Cs8k2ha6Mkcb X5+zLqts5NdSycnZOquHHtITwfqhFmWqeaOJ654f8zfAFPghdw3HK6HAL3EZsVGUCKM2 dlR6S11Tdktt+HIeIpRodazLdGiBQ0f1uPEIitYO77Nis5qLp0aPpclayD+F2h/j+HfW CHZXvIoyfyr++x7XcYK5lsWjcGg0JpLLrcHoI73DHc6Vcax/RWUWE0032GD5RUtQSzxT GlhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NB325R3V; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of selinux-refpolicy+bounces-7-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-7-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c36297dsi5891169a12.507.2024.05.14.00.22.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 00:22:13 -0700 (PDT) Received-SPF: pass (google.com: domain of selinux-refpolicy+bounces-7-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NB325R3V; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of selinux-refpolicy+bounces-7-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-7-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E7DA11F21643 for ; Tue, 14 May 2024 07:22:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E90F1E574; Tue, 14 May 2024 07:22:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="NB325R3V" X-Original-To: selinux-refpolicy@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50158D304 for ; Tue, 14 May 2024 07:22:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715671329; cv=none; b=hgcSA4+mDk9zIZ3rAveshyxY8ag39xR8EBs0X0QeG5SaEqTd81ORIteF0YB27PuYSBpFCGBDKDqEYBRm6XlOg6RKryyhasfyg+Ar0F2uNaMpM1FhcdeMoJ5kR1h7NAtfpmTxTzuBm0cDIyNKVmAoAudni6dGgkuQsMjf5K/dYB4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715671329; c=relaxed/simple; bh=+59w7hgHbzImGaeDKnmPcgjhw2Jfz3Oh6hWZDHMlOFs=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=r1vHrvZE3vREspc59Swpmb/457YYtsAbSTjw65zoG9LGl0A1HqkkR7SPWccjCQfpodujOm69E/IJR69cgXGAOCkZcSaMTKnlMS/HriBqU82uSSmhHSZCZYQ+iPvKDpqgTqOsBL4kq/dxrno2+Je6cweLBDvXVUjD0L7RDb/Xvuw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=NB325R3V; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44DJ9JTW021615 for ; Tue, 14 May 2024 07:22:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version:content-type; s= qcppdkim1; bh=HiFe5kltqDmVDJ7MRdMdgxdhcQOh8xuUsHBke9yH6bs=; b=NB 325R3VRFtOuD35tjb03Khbg1dyayOvx4erIVGTGrU9+gzxlfSGaUmVST6OgInSzu PymmyJ8Zdzq/n1bT+InXMAyAejwucpZA7Vs7ZtEYIB4qKW9kBVLZi51KXLKUUvyD LA/tNnmLFILbvY12Wcy3nbftziFUInFu7A2QUYpyqbgvJQHp5m0rhq2c1pL4M1oH T2jOFo/bGLuW5VKdOW8z+1ZyqRnGBL7XY3CrzfnS9OrfaK3JfQwL5pTyYvWCjyun 9jlCyLCzb9GLPbxoGgT4CmnQarbd5qg5mlCEaKR9PGwnmAk/sxPyTMe+LoGO0m/o hgUKbS7Od4hIGnl5ElNA== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y20rtdh9d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 14 May 2024 07:22:07 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44E7M5oX023545 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 14 May 2024 07:22:05 GMT Received: from hu-nakella-hyd.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 14 May 2024 00:22:03 -0700 From: Naga Bhavani Akella To: CC: , , , Naga Bhavani Akella Subject: [PATCH v1] Adding Sepolicy rules to allow bluetoothctl and dbus-daemon to access unix stream sockets. Date: Tue, 14 May 2024 12:51:23 +0530 Message-ID: <20240514072123.11376-1-quic_nakella@quicinc.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: selinux-refpolicy@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: MPFE69KVOQIwKI4ErTHbktNNH31-kdzq X-Proofpoint-GUID: MPFE69KVOQIwKI4ErTHbktNNH31-kdzq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-14_02,2024-05-10_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 clxscore=1011 mlxscore=0 malwarescore=0 adultscore=0 spamscore=0 priorityscore=1501 phishscore=0 mlxlogscore=919 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405140050 Required for using acquire-notify, acquire-write options (Gatt Client) and Sending notifications (Gatt Server) Below are the avc denials that are fixed with this patch - 1. audit: type=1400 audit(1651238006.276:496): avc: denied { read write } for pid=2165 comm="bluetoothd" path="socket:[43207]" dev="sockfs" ino=43207 scontext=system_u:system_r:bluetooth_t:s0-s15:c0.c1023 tcontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tclass=unix_stream_socket permissive=1 2. audit: type=1400 audit(1651238006.276:497): avc: denied { getattr } for pid=2165 comm="bluetoothd" path="socket:[43207]" dev="sockfs" ino=43207 scontext=system_u:system_r:bluetooth_t:s0-s15:c0.c1023 tcontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tclass=unix_stream_socket permissive=1 3. audit: type=1400 audit(1651238006.272:495): avc: denied { read write } for pid=689 comm="dbus-daemon" path="socket:[43207]" dev="sockfs" ino=43207 scontext=system_u:system_r:system_dbusd_t:s0-s15:c0.c1023 tcontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tclass=unix_stream_socket permissive=1 4. audit: type=1400 audit(315966559.395:444): avc: denied { use } for pid=710 comm="dbus-daemon" path="socket:[13196]" dev="sockfs" ino=13196 scontext=system_u:system_r:system_dbusd_t:s0-s15:c0.c1023 tcontext=system_u:system_r:bluetooth_t:s0-s15:c0.c1023 tclass=fd permissive=0 5. audit: type=1400 audit(315999854.939:523): avc: denied { read write } for pid=812 comm="dbus-daemon" path="socket:[99469]" dev="sockfs" ino=99469 scontext=system_u:system_r:system_dbusd_t:s0-s15:c0.c1023 tcontext=system_u:system_r:bluetooth_t:s0-s15:c0.c1023 tclass=bluetooth_socket permissive=1 Signed-off-by: Naga Bhavani Akella --- policy/modules/services/bluetooth.fc | 1 + policy/modules/services/bluetooth.if | 3 +++ 2 files changed, 4 insertions(+) diff --git a/policy/modules/services/bluetooth.fc b/policy/modules/services/bluetooth.fc index e167e93f7..03f42fc8b 100644 --- a/policy/modules/services/bluetooth.fc +++ b/policy/modules/services/bluetooth.fc @@ -7,6 +7,7 @@ /usr/bin/blue.*pin -- gen_context(system_u:object_r:bluetooth_helper_exec_t,s0) /usr/bin/bluetoothd -- gen_context(system_u:object_r:bluetooth_exec_t,s0) +/usr/bin/bluetoothctl -- gen_context(system_u:object_r:bluetooth_exec_t,s0) /usr/bin/dund -- gen_context(system_u:object_r:bluetooth_exec_t,s0) /usr/bin/hciattach -- gen_context(system_u:object_r:bluetooth_exec_t,s0) /usr/bin/hcid -- gen_context(system_u:object_r:bluetooth_exec_t,s0) diff --git a/policy/modules/services/bluetooth.if b/policy/modules/services/bluetooth.if index c7e1c3f14..c869eed71 100644 --- a/policy/modules/services/bluetooth.if +++ b/policy/modules/services/bluetooth.if @@ -82,6 +82,9 @@ interface(`bluetooth_stream_connect',` files_search_runtime($1) allow $1 bluetooth_t:socket rw_socket_perms; + allow $1 bluetooth_t:bluetooth_socket rw_socket_perms; + allow $1 bluetooth_t:unix_stream_socket { accept connectto listen rw_socket_perms }; + allow $1 bluetooth_t:fd use; stream_connect_pattern($1, bluetooth_runtime_t, bluetooth_runtime_t, bluetooth_t) ') --