Received: by 2002:a05:7208:13c3:b0:82:bbfa:f723 with SMTP id r3csp1149963rbe; Tue, 14 May 2024 13:12:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWqZXMoGR6kEq8uTCS9RXiCN6FdW4tzRs2rLUjyIYvEtmm5hA8J2DPkG3EdNZXukTOnAc1x6x9ODnG/eMsqh02vHD1OmK2M2HVBcqPHJQ== X-Google-Smtp-Source: AGHT+IHl/602kb/BD7Q5Xw1aPRHj1cQb02ZIyZ1zJmoZ2/j1FGz6o8gHeAD69GF55z66D6Ahkzl5 X-Received: by 2002:a05:6359:459d:b0:186:1eab:832f with SMTP id e5c5f4694b2df-193bb63b596mr1542503255d.17.1715717547149; Tue, 14 May 2024 13:12:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715717547; cv=pass; d=google.com; s=arc-20160816; b=sucI/Lw4wVe8Vthb+ZaQ/rKAGzsEhyPAlGyaA5khtE7CVzTeamQonqztvXtyH6NStD iZZmIRBHESTvXqqzZXjDTtjxdODL5K/Squc1RwkL3eZoNPWmc2AmTXJ3ADxuNsqT114M Givi+dTaCWLlLSd8iXUxt5nC4JvuQJrp0sGDaSnBLDE2LwPuxvLYdXoUlSvqdiYXi1ZA JjGIFBXbLu063UvUYGYeXvPNZ3Ix9AtdxWFx8IefFZ5Q/n1ADjLFQFhq+ELJTOEkdnLR Pnhe0bEtSTqR7Va5LnbC5j8OQwti0yeLTAr+g6HCrjQOOzDYiFmACRRpX9SaGrYlBDhe zlaQ== 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=pfwDRrrSNQIj4utvPo0yO7gY/nvCTEqXHXtg0NigmIM=; fh=Ftwbow3fw3FgWxmkd0kMMzbtPawNvUhmi1rj8NyHtrE=; b=yihqVeqf7aapcO/2SLD3gXo4kD9nI8cToSlM4Hf13W8dMvAxm03ZujgG6FwUhzsFkU ovtahWmm8jeKKETTiVvz6QmCWUe0AHfHFF9TczBoD8drAJnFEU5tXk8Wb3YaCz9aNWGj dCr+t+mHko5fGByC0XKoPo93rjHz44H1DDZTjSWJHwoDTq1o95cWm9Hf9utP97NMVtI7 xMPcN8BREhpAG2qZgqay0rt/MbW4Uv2eRZYf95JFRlCSL0CQI5+wHDpYLiauzfrw6ZkB m0mEAP2W2eiQ/15npvQeFXgfKLvuLIgodDWO8QSSmOrNRs96asw6qO1kBwqeT/nYXMSr crcQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b=gj9yja+9; 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-9-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-9-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. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6341404fff8si11357164a12.878.2024.05.14.13.12.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 13:12:27 -0700 (PDT) Received-SPF: pass (google.com: domain of selinux-refpolicy+bounces-9-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b=gj9yja+9; 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-9-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-9-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 8CF10283CA1 for ; Tue, 14 May 2024 20:12:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC85343AA3; Tue, 14 May 2024 20:12:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="gj9yja+9" X-Original-To: selinux-refpolicy@vger.kernel.org Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (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 2714E2AF09 for ; Tue, 14 May 2024 20:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715717543; cv=none; b=XVvznbufeIWX1SDjPIy8xmKkixiVZtCnTV+3x4VngXNHwh7tBQmqmyPoidqKGTdpfA9EjXTq/ux0lOCBzOC7y+EWRAdK9BDbtNHId0Izl8M6Fbhp4n9SHgu2gzP5CCScDtKawzhQCTqIfsk4S0Sw5rxs3iPID+DWFF7htTz0Y3o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715717543; c=relaxed/simple; bh=X22wZHxvP02K3gEgJtlu4c/c9QQ2Lw98e5aSBZsZZho=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dtYwS+lcefsZEsfddxFpW9P0JwuCX7fbzOKDcDs7T3ul4FRfEbKdOIHDr11GTU5Qtf6eZVAYTKDAhHhHY7BBL1OHGXacSClHGkYsqWYCGFu84kfg4aACaJHyxWce3W2GbXlaU5EVQ/H/6mBKG+MZgUh/qmgpf7ZVNe2s7jeJ19A= 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=gj9yja+9; arc=none smtp.client-ip=209.85.222.171 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-qk1-f171.google.com with SMTP id af79cd13be357-792ecce9522so77394285a.3 for ; Tue, 14 May 2024 13:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; t=1715717540; x=1716322340; 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=pfwDRrrSNQIj4utvPo0yO7gY/nvCTEqXHXtg0NigmIM=; b=gj9yja+9l1fE18Hc50FKXDHhdgvT8EnGU2WiF7j9QMBWhzqDZKcFlCdPJ6EttKS5w0 7o+1Eq6HPwd1EI9sDKvgAID4/in9CJP8TgqcP9mZ4rMExXw8QoZ0gCpmOM4scmOurQPc gOktbjZ28Yzb7EVFAqSf8ujH3l/3qN51NTSq4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715717540; x=1716322340; 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=pfwDRrrSNQIj4utvPo0yO7gY/nvCTEqXHXtg0NigmIM=; b=S0aqU8nDrGU1PICKtl+AHLGIO5xGMUQn1KmekwMRuciXrB6zv3mU40rvVEmFFx0tEu 9GR66WZf/0VMyxBrxsikfG4AtIOXO6Lx4JzFVCjUrDn9ijEROFoQmKy35dVSivJXVTkQ S1F/B93PgdOYmstEC+HH7nwWR/cGsFEPQ8npXmnYutfCJPRAN4oNRULxfPK4awZSb+vD 60WyfNw+yX5t55QM7VqExidFrbTtPNMpEaWgG2/jYk5q7YVgqUxLmMmQqPBFT19S+lhZ TfU2e2r1NvQDWfk0ogoDX17SKOcFIF/TcchP+wNON+R2TPkAWnoceSkuP6rquas2CUqp zI/w== X-Forwarded-Encrypted: i=1; AJvYcCXHWUC4KsHnTgpMKKeXOJPX+2p4Yi5HO6/A+9Ys/KEqpwNeVSV4EghxJioU0/wW81n3B14f/tOaP7gKqvlkiref6p9hwxKgIoE4BmB0SHQSD1I= X-Gm-Message-State: AOJu0YxwY2aFMJ25jrw8gxXtcvOH5uDVrWBzzt2r84PClYBYFPXweE8J VTMe1CoY6yI+k7BGswEtOiN76lLSbkytehfZEOSHLKCCQ5tRn+rINJUJtdYxqw== X-Received: by 2002:a05:620a:394b:b0:790:c69a:d3f3 with SMTP id af79cd13be357-792c7577bdemr1867911785a.15.1715717540095; Tue, 14 May 2024 13:12:20 -0700 (PDT) Received: from ?IPV6:2601:145:c200:2c70:edff:228d:f072:fe07? ([2601:145:c200:2c70:edff:228d:f072:fe07]) by smtp.gmail.com with ESMTPSA id af79cd13be357-792bf2758c2sm602242485a.25.2024.05.14.13.12.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 May 2024 13:12:19 -0700 (PDT) Message-ID: <877cf03e-037d-4708-8ac0-bce5b2caa48a@ieee.org> Date: Tue, 14 May 2024 16:12:16 -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 v1] 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: <20240514072123.11376-1-quic_nakella@quicinc.com> Content-Language: en-US From: Chris PeBenito In-Reply-To: <20240514072123.11376-1-quic_nakella@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/14/2024 3:21 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(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) > ') I have two main concerns: 1. is the added access in this interface required for all users that connect to bluetoothd over a unix domain socket? 2. does bluetoothctl really need all the access of the bluetooth_t domain? It may only need a small permission set, like udev and udevctl. -- Chris PeBenito