Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp276177lqh; Fri, 31 May 2024 00:26:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUyYDQxi3R6pVGN+inqk8AaapBd2whqWSh7kl76bQaTlASbrHg1qYEkun+cLYgq/+RZmiz6qijba0wHvOEH3nzdTmmPDpGiE9Jc9hc+Sw== X-Google-Smtp-Source: AGHT+IFJlH5f94+axix0x6hfBiDPsx2vt6twwMb0zkQGf0XuH2iLD72IoZlk9XTMK0Wt/jjnarz1 X-Received: by 2002:a05:6214:4343:b0:6ae:1160:adec with SMTP id 6a1803df08f44-6aecd6ff7c5mr15238146d6.44.1717140387181; Fri, 31 May 2024 00:26:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717140387; cv=pass; d=google.com; s=arc-20160816; b=QZJWzuj4n676MECxowF/m8N0JCRRxtjC1440LHTsJ26V9Fp3gI/WpBTczCqN7kPtjX 5BfLUrY5o3K5XE2OsMutlOrCRKkN7ITMzMQzbD4xHNYgRIAJjPfK4XanCrAzWdr3D1Hv yqtjP2Pwa8oE+YlqpRzVYZjEaXR3gL88bWnq5TLuue7Q9KL5P3EvgpcXCaJfcHCh8/9+ qSr1sben4T7DHCovSeFhrJqRHVFBKW7w3RfFhe4jwW17FImOMtZ0whbCyq4ELzKCmbsy MscvvnbmFBIM0+iRYXUw0qwH3EGtEzjDunEnUqXyd7qlxkVFXbB5d2h1AWUEETjJuKVN VH9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=9rFeOv9+qsI1Z4ufSLEIjlrIavjh8UIWTWDBo6ZTOU8=; fh=KTglsYublX6v8uKRYTrvyw0D84Ol5ifHLbhX7Hodf5c=; b=NrkAsuqxvF/vlZkgCLWj/1Ud4EgrclFcuqdQcOnjSKGIE8mJnMvYY678wyYo/rgNKw jEFI28GF2rrEBmj+l1sPaRVkGUvy8X65k675Qw44bqHSxaakFMtcJ23pFTeFoCw6sz7o JuGGixYFxP0lEqa8pX/vqclGJrE01A6ZyNReKxfVnC1NIi7zDg33lEAeFcU6fZY59Vld UWnGp9/ZneB0rsqo3i4iOk9xqKxPcFPtSI/uIObDBjonEbZKkn1vzYYsw3aRaEM0oOTA pJIKj+AjYQg/HZWUl+K2z/lctTCzB9CrtLgaZJuSeNQa3RybYhQKpvFh0D7gcWFfK6eA vKaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=QOaiG4yy; 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-24-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-24-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 6a1803df08f44-6ae4b42b885si14395036d6.502.2024.05.31.00.26.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 00:26:27 -0700 (PDT) Received-SPF: pass (google.com: domain of selinux-refpolicy+bounces-24-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=QOaiG4yy; 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-24-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-24-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 C194D1C20AD9 for ; Fri, 31 May 2024 07:26:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4CE64EB52; Fri, 31 May 2024 07:26:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="QOaiG4yy" 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 F058025569 for ; Fri, 31 May 2024 07:26:21 +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=1717140383; cv=none; b=eMQl7wII/A2RIflBCiddP/fFpVdx8EiphFf2KRQnnh0DAK8YAjbd3cJyWpQpvDRFnj6VYfr1KFCZ7KllJ4HyXDJh22HOBO5tes9rM1oZ03r+hLj1zxz58z+YoDNnDL7xdGLNgz5otkqBmpXwT3J9xfe/ULN+rEq3im0xWxNBjng= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717140383; c=relaxed/simple; bh=n1fUpZG/ycFZM88ABuwDjw5hZuZ7dSwtzwch/4fxbDs=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=P3ATRLRHAddJcgAXrjX0PHfFemYcKBR1Qn8etYcEfIxDae+lf8VTy04+UDxi4DL5wcC3ZLWVjZgEZKjrNHZb8LRhIDvWWLQ3XDZ2iI1vYj6/AOI64Dy6VVFoMYUo8sjTV9ypNkRZaeF6Km/k6Z0spFiM+p6U922QiAa3KtMo5hw= 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=QOaiG4yy; 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 (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44V0qi7h018848; Fri, 31 May 2024 07:26:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 9rFeOv9+qsI1Z4ufSLEIjlrIavjh8UIWTWDBo6ZTOU8=; b=QOaiG4yyKjykISrE LSx1U1z0kVZuyFv1b9LTDifwgAW7rBxbHvkK2WmoTahasaqoGB+zV4optnDt7x5S HxKKDIAL1iOGX8hMA3bkC3ZeIVhYy2sd5bfv/bbbPxSe8RzuIzam1lX94C4jdcyo K+97CR+c1ZwlsCUlIlKzO+ijgMslxA2Q0DkD6HWnRNC70vpeRO8OJGEWLRoI6BJQ s7lgrF5ToOszqk6RkR5MkjuPWx+UWpaLguBT/mlZ36HvTvKmSjfGSY/m1AHLJZxX gZKBVBLqZDFQgcd9/tcnBlJQqAj+Oz9X9HgEfOFitGc8ZZC7i5avYaN0DSCeHlwQ /M/xYA== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yba0geb3t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 May 2024 07:26:18 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44V7QH7H000409 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 May 2024 07:26:17 GMT Received: from [10.218.30.62] (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; Fri, 31 May 2024 00:26:15 -0700 Message-ID: Date: Fri, 31 May 2024 12:56:02 +0530 Precedence: bulk X-Mailing-List: selinux-refpolicy@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4] Adding Sepolicy rules to allow bluetoothctl and dbus-daemon to access unix stream sockets. To: , Chris PeBenito CC: , , References: <20240527074945.24168-1-quic_nakella@quicinc.com> Content-Language: en-US From: Naga Bhavani Akella In-Reply-To: <20240527074945.24168-1-quic_nakella@quicinc.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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-GUID: mMMFklTiP7S1xB_E4S7mkWhL7E0mF86d X-Proofpoint-ORIG-GUID: mMMFklTiP7S1xB_E4S7mkWhL7E0mF86d 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-31_04,2024-05-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 phishscore=0 adultscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 clxscore=1011 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2405310056 hi Chris PeBenito, Could you please review the change and suggest if something needs to be modified. On 5/27/2024 1:19 PM, Naga Bhavani Akella wrote: > 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(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 > 2. 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 | 2 +- > policy/modules/services/bluetooth.if | 24 ++++++++++++++++++++++++ > policy/modules/services/dbus.te | 2 +- > policy/modules/services/obex.te | 2 +- > 4 files changed, 27 insertions(+), 3 deletions(-) > > diff --git a/policy/modules/apps/pulseaudio.te b/policy/modules/apps/pulseaudio.te > index 65b9a7428..42ed3a1d2 100644 > --- a/policy/modules/apps/pulseaudio.te > +++ b/policy/modules/apps/pulseaudio.te > @@ -193,7 +193,7 @@ optional_policy(` > ') > > optional_policy(` > - bluetooth_stream_connect(pulseaudio_t) > + bluetooth_use(pulseaudio_t) > ') > > optional_policy(` > diff --git a/policy/modules/services/bluetooth.if b/policy/modules/services/bluetooth.if > index c7e1c3f14..b21dac021 100644 > --- a/policy/modules/services/bluetooth.if > +++ b/policy/modules/services/bluetooth.if > @@ -85,6 +85,30 @@ 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. The socket can be used > +## for read and write. > +## > +## > +## > +## Domain allowed access. > +## > +## > +# > +interface(`bluetooth_use',` > + 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 rw_socket_perms; > + allow $1 bluetooth_t:fd use; > + bluetooth_stream_connect($1); > +') > + > ######################################## > ## > ## Execute bluetooth in the bluetooth domain. > diff --git a/policy/modules/services/dbus.te b/policy/modules/services/dbus.te > index 2d1d09d71..855ce86bd 100644 > --- a/policy/modules/services/dbus.te > +++ b/policy/modules/services/dbus.te > @@ -265,7 +265,7 @@ optional_policy(` > ') > > optional_policy(` > - bluetooth_stream_connect(system_dbusd_t) > + bluetooth_use(system_dbusd_t) > ') > > optional_policy(` > diff --git a/policy/modules/services/obex.te b/policy/modules/services/obex.te > index 6686edb37..5e2f20578 100644 > --- a/policy/modules/services/obex.te > +++ b/policy/modules/services/obex.te > @@ -31,7 +31,7 @@ miscfiles_read_localization(obex_t) > userdom_search_user_home_content(obex_t) > > optional_policy(` > - bluetooth_stream_connect(obex_t) > + bluetooth_use(obex_t) > ') > > optional_policy(` -- Naga Bhavani Akella