Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp106448lqr; Tue, 4 Jun 2024 23:39:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAUo8kwhPOPyVVhaoIe+AVljmE6TxdLMCeFd4IodpBQTUmCq+AeihLhbdxpykVCmaLU75WBTN10L1ClMQpjAcd7UTcosa34avvU+tyXA== X-Google-Smtp-Source: AGHT+IEDllkp/sBOZPyvL9yc66Er7oJhvFlNhFZ/Vgt9KG4SJbcObomMpAOYKO6leFfRPlCMwOq4 X-Received: by 2002:a25:ae87:0:b0:dee:4e47:808c with SMTP id 3f1490d57ef6-dfacac90f1amr1659386276.30.1717569553874; Tue, 04 Jun 2024 23:39:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717569553; cv=pass; d=google.com; s=arc-20160816; b=WNo+M/de8FEdzeUAcuD1+iHOndN08v2ZdrEil6AhM8rsqUHINCXl1TcEk0bDvpOu6l W3wn5pzRZmH4RpD7QZJ0yAxFe4Sv2kO2x+dw31tW+nFfzuVhZrYyHpv/NeSHv18PIg4L EVDy64Bk49OAz8nSZ/EihEA8G/U50h0zhSIyUULV/7uX+5UMSF0bK+JPUkpIPdHrm4pK JsL4C5f2GwbIKFxryRJtW2g7aibx0dkUY6g/cl+NLoBS1AJYmRdlKMTgXRtX/EVsJIqn 8DftvVB1Dh7sor6Rb+aAP3PHkZUEmXd9pXOSmJYrczIssohIkog5ru4zQBNqdhWGQhMv 269Q== 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=6uEeIxaAtKUsaZCPONZwKaUVOm5tyZ9wAIfVsq35F9E=; fh=IImizUpgYQGqiJQxdvmKf6mnuTxyqQ5pcSftwZ2TLno=; b=BT8jviIUDBCxIXrrF3m55lLMEQtk5sxWkBhQLLzMsfsMUBx3YPywN1tS35safQW+SM UWVW3KrvSNHEzSvfcNyPAYo7qNZkDPR2y+0jgXwEBZcZdfeitV5jdlucwB1Ya7f6GT4r 5l7Oj1UwvYJAbluXoQYh+Cfrz6R4H2nDYBuq+xEAWcQEgsEiozvKjeRCxRRzBDCKSNdB 8nuscVAVVTCGk4AXBV0RIwZ4r3mGiVpPsL95t9kX+F1xcZNStjbRvFWqK7eQBIXIzPqg aTZIiSmMsX1Jntb/IFTxI93vT5E/Tl+kFirg0QMK9R7M7Q+knb5Gju7RfEH4fi3jjtvx 8geQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ewwTk3V6; 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-27-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-27-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-4401fe59f36si31792681cf.807.2024.06.04.23.39.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 23:39:13 -0700 (PDT) Received-SPF: pass (google.com: domain of selinux-refpolicy+bounces-27-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ewwTk3V6; 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-27-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-27-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 8B3A71C22405 for ; Wed, 5 Jun 2024 06:39:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DFA719047A; Wed, 5 Jun 2024 06:38:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ewwTk3V6" 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 1EF1118C321 for ; Wed, 5 Jun 2024 06:38:42 +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=1717569525; cv=none; b=T/Zvdf4V1YVfq7X3dZLZE+ZM8eUJ8BZ5SXrWmXr1R31KhYPRKKPp4vjNLXStyF71dqm2tv5i7ygcCzBqn0Aj19l7yAQcB0sJ2jogbqZk7dQKEIb2YmLukXuEgKLc6ZqUjc/uqsKhreu53mk+eiME4RyD/Rr8cAFCXQmZ2WEWInA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717569525; c=relaxed/simple; bh=sKlWPgD00b3I8QYqoUJNi4w+i++KIa7hpRMxRoiDoRQ=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=FJ4uW9/UUJ5GjkvbcJiVeqR5H8Ilg8IAEPHNn09apABkBIc9tl+mK7UxX4/U9oeFkRH8+2tXynO1lOQ5DaKeImwmzQoPnqiC/eWFxXK9HbTliNb3YlJ0Uy1vlXNXD1MftmWKSvFGmU2FmwEXPuddkDsQrY0i4Iafsvr39656TZQ= 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=ewwTk3V6; 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 (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 454HI2rQ004659; Wed, 5 Jun 2024 06:38:40 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= 6uEeIxaAtKUsaZCPONZwKaUVOm5tyZ9wAIfVsq35F9E=; b=ewwTk3V6yDGqOAYR I+ZepTLUifyLOFmxfG1S9Bvre706zOiyS1KbBeP4VVDh9WQa1SGIGufVvrkZ+wMB f9mChplFseGg1T825iBSSeo7fwcYPPKDRZ8Azcr8tSi6ZlIC7LKY7jub3KutGCX5 lpzAQyr0OA8zynqcBg6kbJDBFG1trpeVfsBvMJrwH/t2oiO1HE/zQH2ztrMIQRpa s3XRmi2OR5/mSH3rwjeC0kl7LQBS3//fS0BvnL9vAkunx0+k+x2zPMhCyEkmiwqK yIjSFUZcxf2knKsALKCPMSwn+wdVFWpF8HJsHJc1pdElvY8Y0CV0odIeOxAfWgNu nhd0LA== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yj76whb9m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Jun 2024 06:38:39 +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 4556cdOm018785 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 5 Jun 2024 06:38:39 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; Tue, 4 Jun 2024 23:38:36 -0700 Message-ID: Date: Wed, 5 Jun 2024 12:08:22 +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: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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: T_cpD_gcgcC0etVvo0ftyHfp--YNB7wu X-Proofpoint-ORIG-GUID: T_cpD_gcgcC0etVvo0ftyHfp--YNB7wu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-04_11,2024-06-05_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406050048 Hi Chris PeBenito, We have an add-on query regarding bluetoothctl context Based on your comment on patchset 2 >> Yes, the point is that we probably need a bluetoothctl_t domain so the configuration can be done only via the bluetoothctl process, not just any initrc_t process. The existing bluetooth_helper_t domain may possibly be renamed/retrofitted for this purpose. We tried adding bluetooth_helper_t domain for bluetoothctl using "/usr/bin/bluetoothctl -- gen_context(system_u:object_r:bluetooth_helper_exec_t,s0)" but it was running in initrc_t context as shown when"ps -eZ | grep bluetoothctl" is run. Could you help us with this issue if it is already known. Thanks! On 6/4/2024 7:26 PM, Chris PeBenito wrote: > On 5/27/2024 3:49 AM, 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(` > > Merged.  There were a couple lint issues that I fixed. > > Thanks! > >