Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp120672lqb; Tue, 4 Jun 2024 06:56:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVjarHXV916ah+nSztDA8wxBnxPVyVtNUJCwpoi+lBEE9sAw/cdPGXTfMMC7QYhJn/HiMBC+pXFtKf0OheREaQOMp+/vc8Zl+lVfb8t2Q== X-Google-Smtp-Source: AGHT+IH1XKjepZGabMhN6mxQfOcP2gLKGGL9mdyYogSIFS+9vZviMLyTs0IYuu5+p+uJRu0Xoh2F X-Received: by 2002:a17:906:fccf:b0:a69:280:f379 with SMTP id a640c23a62f3a-a690280f70cmr478290566b.45.1717509378353; Tue, 04 Jun 2024 06:56:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717509378; cv=pass; d=google.com; s=arc-20160816; b=pxP2ZtYSTOPKbgjy7+LfUz7SOsosjMCiNAAUmytvsicZhuQcp4/q+YF82uC/DUV+Gw dyaQGa95g24unBmphRXaJjCnd6gk8Ew0r0wKr3hCvpszBgIHKmQpvTSQAGNZBMYTOAX7 mdddqalNSS0NcysHdo5eGIRe7aFQcL70EqTt2M5pWbtF6lKernbN44qs1HCqc8jyh1rd 3+G8XjkhLkZXhGDkS5eGwBDV9J3zFueDrXU6kunSi6uCJnuC90ExIAJSd38bgNe9fHTS WkDU6RSLu6ryIcf9pOl5bQqpmXgiVSl3/a4WNa/LLvNZV4v/6Kv5LHsE81X2h3ShwNpm HLPA== 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=rTcfoEs73zzh9NkYNTEjIpVvH5yXEOnnQBSko5lDBAI=; fh=VSuRTbN5Hs+bJqeojAwHTzrefQsfLCpqVF1r1j78tfA=; b=riGJht0VpaswkTmbj5xlPAJWcAOUxtQjn5MlAGjTdA5BYyXxp3MfiZJjGGgBybPytu TfTZSYCUi7wvOIhGddwfyBNm+gNnRqubgX8FNHI89CECEMheYlYS2zmji9KnNdGw4fNy jjNDtFKcgDW2glN70ewYwNmjToE0vX334ncxINlJDY8eYDFO7g7LOnefR44WOIzHIQm3 vX+bczqStWOD++9sNg9nqWp/sbWrqXg0WPypTGQyWngCz8jaToui9MctM/ljcl7gRGTR iThAAJwS78d6jVnMogbbImuBhD647LdFoR9UapXd08It6k5YR9ctY/Tizj59QuqQULlS WidQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b=J9FxhWTt; 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-25-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-25-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ieee.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a68b8ba0311si356695866b.649.2024.06.04.06.56.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 06:56:18 -0700 (PDT) Received-SPF: pass (google.com: domain of selinux-refpolicy+bounces-25-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b=J9FxhWTt; 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-25-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="selinux-refpolicy+bounces-25-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 895791F20FD8 for ; Tue, 4 Jun 2024 13:56:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B65B9470; Tue, 4 Jun 2024 13:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="J9FxhWTt" X-Original-To: selinux-refpolicy@vger.kernel.org Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (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 881888F45 for ; Tue, 4 Jun 2024 13:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717509374; cv=none; b=AkXR+gvosIyd1xD6Kx1254HiqwGqN3moOU5mXTZYuWWzxcFkTRyAv2ciBO1nNLBE78iQcuNonmDpzkRqJU2R/XSTnH+prZYGkNiaVLHHbpCpfuE+kkc07gyjNM3EZ1624ROSYaVwZWe3gmmudJbJQokKGjkoGQWD22VNVxz2XAo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717509374; c=relaxed/simple; bh=93G9oFEPfXj7MC/rl93MNETQjEGzjs6nwnipNWTNZfU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lHdzomQ3VYlSWYGsFfctCRYsqceDMOHY/4YlRmtcRQ9joMugE+TL7XehAvbPvXuVOyo9GCSzOWNQtSNCmSVpbz9jo6pfTO8SqdcU4e8J48gjxMn08wS7hrClFv9jYrXtDVmPyfLU5sWWsBWunJfcUEb98yUMAnLIre5m9DdqMv8= 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=J9FxhWTt; arc=none smtp.client-ip=209.85.160.180 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-f180.google.com with SMTP id d75a77b69052e-43fdd85a284so5996721cf.0 for ; Tue, 04 Jun 2024 06:56:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; t=1717509370; x=1718114170; 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=rTcfoEs73zzh9NkYNTEjIpVvH5yXEOnnQBSko5lDBAI=; b=J9FxhWTtfRPviHJKvz3bRj8sxQJN0vf0NCnMgGBxCXYHq1wn4IaxQ7vAyszAFsv0uD fpqo65whmBOKkEAAP8VxKzaZIdFT/U9KUjGoierKeEw8TdooLFjs0ThpbcmySrhN0TS0 NlG1su+89YKi2TAiqSlVGjaJRJeCWqYhtw2uM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717509370; x=1718114170; 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=rTcfoEs73zzh9NkYNTEjIpVvH5yXEOnnQBSko5lDBAI=; b=AE9tOeIzQvmuiwkM0u9vcML9K6sYyvorfrjGL0+maESoX3V1ZI8Q+etezxZMYDEyvo KG0giyN03LDxZ2pGNGPKZHw136fivTenVS9wEhQvU6dDaH0rIYScrCTt5X8/DrpWNquh Lrc7fL2ecHGAo9IX5rLYJXt5FKvVscCivLPf8EXZSqyLepD+OFHJa0v4qDfEoDFyr9Gz cwPRz9/0Z0spxDixCY1DQsKREr5m7GIiHFfp9iaRXNI50aMnK7fIjjiCuGbvP0dJ05bV 9HxdcPpxOwQkYs4kL8iNwf+s9LIgVVmd/MpXS4nvEg3O/vx2JMuiO9cuLPzNePEGKGwu YFsg== X-Forwarded-Encrypted: i=1; AJvYcCWz59koWsdpBGOXifnmvQnepZ3yRlh6zYxrGHQ5/ejeMJUIJVRKTJjP+DwvM2f3VhIF77odWZ6E3FrBBc02mlbODe20xRGwNPsrqNMF90cInV4= X-Gm-Message-State: AOJu0YzeAKmW9xS2lA0NHIJW9TDn+KqP9HeJKOHPrLWCIapA/nxhT9vY /V/FD3xNUOwm3B5OmPyxP8H/XLJ5WbO1V1rY++P/bQah2elGJ78tymhyOV6ABw== X-Received: by 2002:a05:622a:1ba2:b0:43e:3d64:8c1 with SMTP id d75a77b69052e-43ff54a704fmr153908791cf.55.1717509370356; Tue, 04 Jun 2024 06:56:10 -0700 (PDT) Received: from ?IPV6:2601:145:c200:2c70:6d86:cca9:bdf6:56a9? ([2601:145:c200:2c70:6d86:cca9:bdf6:56a9]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4402627e268sm3254721cf.61.2024.06.04.06.56.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Jun 2024 06:56:09 -0700 (PDT) Message-ID: Date: Tue, 4 Jun 2024 09:56:07 -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 v4] 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: <20240527074945.24168-1-quic_nakella@quicinc.com> Content-Language: en-US From: Chris PeBenito In-Reply-To: <20240527074945.24168-1-quic_nakella@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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! -- Chris PeBenito