Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp1091169lqp; Thu, 23 May 2024 08:43:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUSzYEFWBDrWLf07h4Bdr1wHV012Z9Ox90tiZnmg0JalpkdKrlQ79b6+9/vU30OpAxoUbmkRzOlWJzFRlX/QEA8oIGJR55Lp2ukA1Cpfw== X-Google-Smtp-Source: AGHT+IGYUD2ERsHGZmTYUiwK7jCADR0S4WyrBtxbQhAp8Raqd4YNSCFU0lnuJ/kaYlAFWTXVDHfC X-Received: by 2002:a17:90a:fa03:b0:2b2:b00b:a341 with SMTP id 98e67ed59e1d1-2bd9f3456b0mr5637949a91.8.1716479033456; Thu, 23 May 2024 08:43:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716479033; cv=pass; d=google.com; s=arc-20160816; b=SLPjz4Q4vN6JRWIg3bdUBenrv9rym1lv1VTCUF9QwBCQ+x8uIHranJDPYmm5LxiUi0 RjTIX6MW0S/PAM268dvCQ4r+4T7dc0H2jigieU9Diq65ZBXQ+Er0dgqqHMdihtX9QWHN cdqRRmlHpCAtndgW2AdXKyLkzgSlO5gxVssefyiglHpv6DSEf1XTLOPoQMc1OG12BVw2 Bp/dmN3TBtYQRVMqbbnYndj063uGbtuegz8cvohgD3BA4yOGW+M34TXLC/eoDVQKe5XV 3erBzMrbSJ+Ld9+0p5l10l2rDu2SJ2eNcWrl+1tJ52TKk30SRkXEClUQXApY3Xqrpoo0 olDg== 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=8mnZmm29Ve1q6AQtraMW9e61sTk4LKAD4lu/nEtwKSw=; fh=gMRHrdercN52yJzeuKokmILhKY8dk8WuWb2smkVdX14=; b=i/t3qoZN3hsbu73nLmIVXexYZSxi3y8/4JHN3cPIwZtj/LK2an8d9A5JvdGCHmw9nb Atbdw41QxUTf+X+GnPVu0tmy1jpJwanq/Fjggrs5MzLqPy16TIvxFIH7xKRCkl5ueHkd I+8pLe0Xgfg++zPrZwa3y8b4Kr1x0VMyOJDfk/c86GiKZvLjhUatGU0EX7rnsg3FssJl QRTZcDQEMRGTCZahsw0zUpn9ydrq7+NtK0An1JTnHvyv3UyzvGztHH+jHBoENgIjRwC1 kRMku9j2ndizJzkkOTrJdorH3O39YGSOjohz4vUTpOBRQIeXKBfShStbzpc/p5dKDR5f L5tQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b="ZxWp/rRa"; arc=pass (i=1 spf=pass spfdomain=ieee.org dkim=pass dkdomain=ieee.org dmarc=pass fromdomain=ieee.org); spf=pass (google.com: domain of selinux-refpolicy+bounces-21-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-21-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ieee.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bdf8bf8970si589733a91.86.2024.05.23.08.43.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 08:43:53 -0700 (PDT) Received-SPF: pass (google.com: domain of selinux-refpolicy+bounces-21-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b="ZxWp/rRa"; arc=pass (i=1 spf=pass spfdomain=ieee.org dkim=pass dkdomain=ieee.org dmarc=pass fromdomain=ieee.org); spf=pass (google.com: domain of selinux-refpolicy+bounces-21-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-21-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ieee.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id CFEE32823D3 for ; Thu, 23 May 2024 15:43:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C2CE11720; Thu, 23 May 2024 15:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="ZxWp/rRa" X-Original-To: selinux-refpolicy@vger.kernel.org Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A73717BAA for ; Thu, 23 May 2024 15:43:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479031; cv=none; b=gTtR7wLJybboXE7zCHJMmqyOdGIhwNWx/OkdCgWBOEvbA2+UIG39+xU34gccT2cSl0dBf8uKJ2KRxymNyQ0SPCt8fYhV5zPdtzO/goUvx6tkfmDFeTtrxd3PGhv/acJUKuOCtw5M1dU4H3KEI5WQeheNHwags35beH311fx2vbw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479031; c=relaxed/simple; bh=JQIxAgohsDHJkgjwu1rEV0fCH1LsME0HK2BYVHyulx4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lbZhFc8bNGc7qaqHiw1zTKzCzEcbGBXUVR7LkGiQ2lP4CpIS/+Q5cn5tnu9P7pLzLra+1sqOkZUCfVs+5/YA/Q6p/ree9PMrf4I2ggy8jHgYXlG4p/uuCZnnvhSiH6wt53U+G6LCB1m3GZZa5qW321B8WRxZdVgp3yYbwZZ+Utk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ieee.org; spf=pass smtp.mailfrom=ieee.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b=ZxWp/rRa; arc=none smtp.client-ip=209.85.160.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ieee.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ieee.org Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-43df732cb05so8912311cf.0 for ; Thu, 23 May 2024 08:43:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; t=1716479027; x=1717083827; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=8mnZmm29Ve1q6AQtraMW9e61sTk4LKAD4lu/nEtwKSw=; b=ZxWp/rRa5WzaJ5EJGsdJxlOe+o6Q33WBZ2cW1mnUyrO631NXiLzujMiIN2fxVC7IRt pKSOzJEcY396j2yxCIFTaoJOSpjMj/vv3CZfqjtVUZWziSzw0ZxEeg6RopwtZXIfMSqi u8rO7i4VQepZya68rrdb80LDNIlBmIPDuYLFY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716479027; x=1717083827; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8mnZmm29Ve1q6AQtraMW9e61sTk4LKAD4lu/nEtwKSw=; b=cNDGqSjTNhVbah81BfNqBgnQ2QY1s2C+yqbKlPWvYylmoDlu2h0GqZhkl/dK1EdHTp 6/pew9rDLBv5pMERGGUsF5p1SaVWW+6nLza807gVFf5OI9bi4qRfJTuErjGFIJdZTJST d8IPEk+yur+73TOzOstrqDF4LQ9B4VmFR8vH1bnpfxq3duDZbvTX5YKUIyQO81I0uY3z evVCTS2USAqphy24LkP6zDYspJ1GvGP6zwvEHNGze73FFwrApESanasFWWkc+1neZ5mX 0jw+b4jp+cMfTfriNg5YMHmGU9ufk5oSGvMHfu4iC1Pdfs0R6wPTM1deDfHp659oEW+v Hwpw== X-Forwarded-Encrypted: i=1; AJvYcCWShHPmF6KvBhG92ClIBoszWMyNFXzPw+RdU/C4eHOlqM0prI29T2pv3CgW4UvDht364iNJXzUyt5pRCmgdAfxDbHcw9WqX9Xa9Cf9Q5oYQYnU= X-Gm-Message-State: AOJu0Yz3HO8JJ1Pjnqxl78+hxbaIc4/zyjIKEkaAS3b5Vp9MNOeMCjeO RySXhU0FROOVMgJ8ZpiNfols8Tv3si6L/K6H+umLwtV4/9Z+x91bs48nTonkeQ== X-Received: by 2002:a05:6214:3a0a:b0:6ab:7349:6a49 with SMTP id 6a1803df08f44-6ab7f349303mr61671176d6.4.1716479027335; Thu, 23 May 2024 08:43:47 -0700 (PDT) Received: from ?IPV6:2601:145:c200:2c70:5558:67ee:4cb1:6441? ([2601:145:c200:2c70:5558:67ee:4cb1:6441]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6a15f1ff09fsm144019006d6.133.2024.05.23.08.43.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 May 2024 08:43:47 -0700 (PDT) Message-ID: Date: Thu, 23 May 2024 11:43:44 -0400 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 v3] Adding Sepolicy rules to allow bluetoothctl and dbus-daemon to access unix stream sockets. To: Naga Bhavani Akella , selinux-refpolicy@vger.kernel.org Cc: quic_mohamull@quicinc.com, quic_hbandi@quicinc.com, quic_anubhavg@quicinc.com References: <20240523041314.21998-1-quic_nakella@quicinc.com> Content-Language: en-US From: Chris PeBenito In-Reply-To: <20240523041314.21998-1-quic_nakella@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/23/2024 12:13 AM, Naga Bhavani Akella wrote: > Required for using acquire-notify, acquire-write options (Gatt Client) > and Sending notifications (Gatt Server) A couple minor things remain. > 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 | 2 +- > policy/modules/services/bluetooth.if | 23 +++++++++++++++++++++++ > policy/modules/services/dbus.te | 2 +- > policy/modules/services/obex.te | 2 +- > 4 files changed, 26 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..edead1fa1 100644 > --- a/policy/modules/services/bluetooth.if > +++ b/policy/modules/services/bluetooth.if > @@ -85,6 +85,29 @@ 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. Please add a little more here; something about using the returned bluetooth socket. > +## > +## > +## > +## 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 { connectto rw_socket_perms }; The connectto is provided by bluetooth_stream_connect(), so only the rw_socket_perms should be needed. Otherwise looks good. -- Chris PeBenito