Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2905368lqo; Tue, 21 May 2024 00:09:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1UGj1LgzP0kmgteQTXaMT0cbuNBjQCJIb8E4KGmPDe6KkGDcnUMURZFA+aqMNeaDSgOMpcQQo9Com08lauCQRaoAhHc/9sCwebTPxxw== X-Google-Smtp-Source: AGHT+IGaNiRZMB39MofaOGNOnAo1GYB4KJVG56DuLuHTEaagW6NZMNZWyhg8Gy99SWOquMRDobH8 X-Received: by 2002:ac8:5d44:0:b0:43a:b8e0:4536 with SMTP id d75a77b69052e-43dfda8e621mr359449411cf.4.1716275371438; Tue, 21 May 2024 00:09:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716275371; cv=pass; d=google.com; s=arc-20160816; b=ZFGCAqhbxcl6N6XYBgZVwwVl23LYVYgj4v3JxiUSR7DtJujaYarHwdId4GWlkeZBt2 rSNOQEtGBpKY+Llf8YBHk7DnCPNU5RvuPBSXIBOF43bKs4nlg+0V0tQXfw2JO+7UWOcS ry78UC+YiOyXLMKy2YG3rSDkVHH+cRggAWXjT0mRMKQiajga+/BNz9OO5F5NK6OIcMpL z2MDJxan41P5cS6FyzsVG6B+8ZDBN8yiSY78UfvheMtmjui/Y70kUOgM+z6txxBQY+tD EOuAAvgmyw8Ln8Lqra2AMN4SLYFY6iB93dQJp4PyyN/D3Kous/fuOPfYNNCqSckB8F2f Umxw== 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=uD8OwbEzcbxYB0w34rWLYhoA9V1EpR50NhVd38k32vM=; fh=KbreB3X5w5PX89R/JhNeRPZtSm6GfztEz9WxktC6eQ0=; b=tztyJyGX7enZQiAeua0x+J3t/oA0dQgiC/CcUOZUXStHMDJZNQH/kBzHRzJCKbjaUU YYgIPQCs547RLszmXfMxNIK45KentFJ7SRZjzGoIKThbwa6GisJbX9MnBMip8c5IvWFE ZE++KtfhfEnTepx6yppGkCYiQ9WDCkgKBzcEcSO2qNoH/n/mB3ZFNH3R7KGcQ3jKIiZC Zb2PgUS3eXB8oBIZ0o0QIxNMQzhNTQoa5OQEeU+VVPk9VSL+8fcYY/w9xetla0E6Mik7 6RdW920VCqeqO7pM/bA7seIxLlRsqPqe6+one4eS6Cjz2HqsBuSYl2hGHAzEjTqwrviN d4/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="bYK/kBSm"; 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-16-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-16-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43e1fdeb270si21726931cf.461.2024.05.21.00.09.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:09:31 -0700 (PDT) Received-SPF: pass (google.com: domain of selinux-refpolicy+bounces-16-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="bYK/kBSm"; 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-16-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-16-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0CE121C20AA9 for ; Tue, 21 May 2024 07:09:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 478EC4AED7; Tue, 21 May 2024 07:09:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="bYK/kBSm" X-Original-To: selinux-refpolicy@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 7AA1248CDD for ; Tue, 21 May 2024 07:09:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716275369; cv=none; b=d5K6fWIk3e+oMweelqUZrBbBju0ST/H5MV+C4Q5gerTcGGdjqZuF8zGDZQy8g8z76+ZRJ5laAvf+1CThSbdVgDbtiUeKKv2JNUUUdEjBFmTaqyRDaaVZsPwVQFCiwOE18jsKlXCGtQQ4Uv8hGfFLVfeaO0Qbh1GQPpfIJ5PlIP8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716275369; c=relaxed/simple; bh=5/xY3LRq7hNUGnx/y1cHBSIagZhtA4E5J7c2wAFQE+c=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=uICnGzcvMu6Zo6brA8c7hzhDJHqd4nq7a8eMyiJDrqLnBhFOJvD5NAiy93ttfqis5gxhbVFNyc3K9wqwuFsaqMM3/OEzr657Xob6lMGzB1kGrfHbjU9OHtliWzRGwU/2W1HE+Pyf7AVz80g4iEct0iJGsEbkHOJBO1Dc52QMhZo= 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=bYK/kBSm; arc=none smtp.client-ip=205.220.168.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 (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44KJw6EN004387 for ; Tue, 21 May 2024 07:09:26 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=uD8OwbEzcbxYB0w34rWLYhoA9V1EpR50NhVd38k32vM=; b=bY K/kBSm65lSwDFXpsxLKeQ0zIdz6v/Wa4D2e2TomLBSZuxsGr4kaEEKjhSArDkPih 3/hwClTcjNL7UvhrhXP5Uiweu856rJ7GCG2O9Qs88JcUrDLxj2dkNRf67ZJhZGTn DZDHibITVC8JmCpH+GGIzcTIxl3w55FbpGUy3olBM/FFN0cRTHxx1F3QZf1AFxoS 5emtg4iWHxtboFxnk0OwRHGj3t8q4E6m74DYWLzXdoiXhPFXfvYewYKAi9P/SoF7 xx3y/lJcprZNumamGrlGjWUzjT6uhxon+Qc0qWMEl6WfLyHJUT6KC9RjXuMr/wUV T5QB4v51RAn8SKVsQmiQ== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6pqan0ug-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 21 May 2024 07:09:26 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44L79P2P011933 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 21 May 2024 07:09:25 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, 21 May 2024 00:09:23 -0700 From: Naga Bhavani Akella To: CC: , , , Naga Bhavani Akella Subject: [PATCH] Adding Sepolicy rules to allow bluetoothctl and dbus-daemon to access unix stream sockets. Date: Tue, 21 May 2024 12:38:52 +0530 Message-ID: <20240521070855.23623-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: nasanex01b.na.qualcomm.com (10.46.141.250) 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-GUID: -CGk5bjwek2vysZCuuo05M08ZguaWQIN X-Proofpoint-ORIG-GUID: -CGk5bjwek2vysZCuuo05M08ZguaWQIN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_04,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 bulkscore=0 mlxscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxlogscore=850 clxscore=1015 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405210053 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/apps/pulseaudio.te | 1 + policy/modules/services/bluetooth.if | 22 ++++++++++++++++++++++ policy/modules/services/dbus.te | 1 + policy/modules/services/obex.te | 1 + 4 files changed, 25 insertions(+) diff --git a/policy/modules/apps/pulseaudio.te b/policy/modules/apps/pulseaudio.te index 65b9a7428..9bf69bedc 100644 --- a/policy/modules/apps/pulseaudio.te +++ b/policy/modules/apps/pulseaudio.te @@ -194,6 +194,7 @@ optional_policy(` optional_policy(` bluetooth_stream_connect(pulseaudio_t) + bluetooth_socket_connect(pulseaudio_t) ') optional_policy(` diff --git a/policy/modules/services/bluetooth.if b/policy/modules/services/bluetooth.if index c7e1c3f14..dd26d95f4 100644 --- a/policy/modules/services/bluetooth.if +++ b/policy/modules/services/bluetooth.if @@ -85,6 +85,28 @@ interface(`bluetooth_stream_connect',` stream_connect_pattern($1, bluetooth_runtime_t, bluetooth_runtime_t, bluetooth_t) ') +##################################### +## +## Connect to bluetooth over a unix domain +## stream socket. +## +## +## +## Domain allowed access. +## +## +# +interface(`bluetooth_socket_connect',` + gen_require(` + type bluetooth_t, bluetooth_runtime_t; + ') + + files_search_runtime($1) + 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; +') + ######################################## ## ## Execute bluetooth in the bluetooth domain. diff --git a/policy/modules/services/dbus.te b/policy/modules/services/dbus.te index 2d1d09d71..301c81aa5 100644 --- a/policy/modules/services/dbus.te +++ b/policy/modules/services/dbus.te @@ -266,6 +266,7 @@ optional_policy(` optional_policy(` bluetooth_stream_connect(system_dbusd_t) + bluetooth_socket_connect(system_dbusd_t) ') optional_policy(` diff --git a/policy/modules/services/obex.te b/policy/modules/services/obex.te index 6686edb37..edbdc7ecf 100644 --- a/policy/modules/services/obex.te +++ b/policy/modules/services/obex.te @@ -32,6 +32,7 @@ userdom_search_user_home_content(obex_t) optional_policy(` bluetooth_stream_connect(obex_t) + bluetooth_socket_connect(obex_t) ') optional_policy(` -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project