Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 CA6AE84A2B for ; Mon, 1 Jul 2024 22:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719873588; cv=none; b=r1Eo4H7pwZxt9N4/yC0UViFAg62XIpQCtxyX5mul4YT682yJeTbPEwRNSo2R7Neu2WRx5C4mwY9ILK/+KLjbESWw8wSgxXkfpokRgKmldd8J9bnUXptOmP6CFFMVl8FlGOaqzUTb/a5vFebseE3znJWYdj1mXE1PY5kHUgARb5A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719873588; c=relaxed/simple; bh=zbAcH0C5eGDd1XNOPfKQqeZPWtQk533uGkkFLpK0uVw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=n5CRbYNZrt9Mm0dg5MwLgwTksXNIBZCO3D2wm59AUkM7buX00Arbvz3BV6EcQZ0OtQgPMWncIx1Nu+XSuZQ0V+3EOWKOEPNIk8GIJ9/YwF0IAvdRd/Uo7kSxJIneAJHfDL3u8gKWnzVwgKi3gQhuEpZ57YVn7L4jn17hZCp3rvM= 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=ZQFvkpZV; arc=none smtp.client-ip=209.85.222.170 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="ZQFvkpZV" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-79c06169e9cso247266385a.3 for ; Mon, 01 Jul 2024 15:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; t=1719873585; x=1720478385; 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=7M7MwEoalNobSp2KxYPny2onktEi2axq4VL2kysA6wE=; b=ZQFvkpZVgmyXRRLtNH3DKFdIshMxJb4jCQGin6KhEielMOJORSObgBG7xLnzK1DfKl 3HeaQdaGz31QXt/8oFaIsV8LvRS/P5H+pL89w0QA/4jGoaooACWhW5LZRtMo9qQjJhlk jahTam1F5bKRjn7wOUuRKCQ9qleYj9v49cHjY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719873585; x=1720478385; 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=7M7MwEoalNobSp2KxYPny2onktEi2axq4VL2kysA6wE=; b=jN0sZAo9aOMtwfZMsAwAONJfMwAafD/IIfuddEdt5Tbgt8CePHwfEgZecXViHfH/OC pq43Ii3oJA49gYSHpcYdsXTvkLLsk0QW/XpKApp9RpdJkOQuTSD3Cpu4fNoWHjL9VnYo ztRcFjPTfKKBiJbOf0+9IjHEidwBVGizpjfXlAnVDbRovSU0kWkvjfqgMyZLYebCndKr 22bEcMLsXfFhLTvfECJ+OSzpov/gQarK38tIxohH7IKrwZxv6H8OCbpLgSzoNIafy1wt dhdnT0y6GD1SpEfC5n8TBKVNM/0/NjlsfRdIqdzcGKVx5i7nsfaP+FvT5V4dOZysQvbs QFvA== X-Forwarded-Encrypted: i=1; AJvYcCVcu6HqGS5j5dYsyPOtVRHkCfDD23r6US48bPj2MW4gx3wknT1gkYOkJ6Jb1VQXJ3GwDcVq0DDF7ems7nGAx+swd5YhsIg/C2eQFhVQgWtOgTE= X-Gm-Message-State: AOJu0YwsQHjK8vFnsAbH6G7OhvJolde1En15OwU0Ursrvt1wbIIh2wqQ Vm88jeOKcC/sX0wM/fZA5UJhNlIX16qlWyA6PmpUStYQk5GhJUQnGUENZpulexIJplbzznntNas = X-Google-Smtp-Source: AGHT+IEmR5E6FX3WHnGSM8G3P5FrQ8e2+3tfM1e4nh930w1J65AyB/rN93KYtBpaJHVDMtEAzK5tTw== X-Received: by 2002:a05:620a:8210:b0:79d:6169:7ab6 with SMTP id af79cd13be357-79d7b9f1c80mr863370585a.33.1719873584655; Mon, 01 Jul 2024 15:39:44 -0700 (PDT) Received: from ?IPV6:2601:145:c200:2c70:f823:5b44:b553:7f76? ([2601:145:c200:2c70:f823:5b44:b553:7f76]) by smtp.gmail.com with ESMTPSA id af79cd13be357-79d6932e8efsm387995685a.136.2024.07.01.15.39.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Jul 2024 15:39:44 -0700 (PDT) Message-ID: <64da08dc-60b5-4ae3-9d5e-c592830356dc@ieee.org> Date: Mon, 1 Jul 2024 18:39:36 -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] Setting bluetooth helper domain for bluetoothctl To: Naga Bhavani Akella , selinux-refpolicy@vger.kernel.org Cc: quic_mohamull@quicinc.com, quic_hbandi@quicinc.com, quic_anubhavg@quicinc.com References: <20240628064312.12995-1-quic_nakella@quicinc.com> Content-Language: en-US From: Chris PeBenito In-Reply-To: <20240628064312.12995-1-quic_nakella@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/28/2024 2:43 AM, Naga Bhavani Akella wrote: > Required for fixing the below avc denials - > > 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[1894]: AVC avc: denied { read write } for pid=1894 > comm="bluetoothctl" path="/dev/pts/0" dev="devpts" ino=3 > scontext=system_u:system_r:bluetooth_helper_t:s0-s15:c0.c1023 > tcontext=system_u:object_r:initrc_devpts_t:s0 > tclass=chr_file permissive=0 > 5. audit[2022]: AVC avc: denied { use } for pid=2022 > comm="bluetoothctl" path="socket:[25769]" dev="sockfs" ino=25769 > scontext=system_u:system_r:bluetooth_helper_t:s0-s15:c0.c1023 > tcontext=system_u:system_r:bluetooth_t:s0-s15:c0.c1023 > tclass=fd permissive=0 > 6. audit[2006]: AVC avc: denied { read write } for pid=2006 > comm="bluetoothctl" path="socket:[21106]" dev="sockfs" ino=21106 > scontext=system_u:system_r:bluetooth_helper_t:s0-s15:c0.c1023 > tcontext=system_u:system_r:bluetooth_t:s0-s15:c0.c1023 > tclass=unix_stream_socket permissive=0 > > Signed-off-by: Naga Bhavani Akella > --- > policy/modules/services/bluetooth.fc | 1 + > policy/modules/services/bluetooth.te | 5 +++++ > 2 files changed, 6 insertions(+) > > diff --git a/policy/modules/services/bluetooth.fc b/policy/modules/services/bluetooth.fc > index e167e93f7..6067df4b8 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_helper_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.te b/policy/modules/services/bluetooth.te > index 0cbff0714..ae4a99fe9 100644 > --- a/policy/modules/services/bluetooth.te > +++ b/policy/modules/services/bluetooth.te > @@ -19,6 +19,7 @@ files_type(bluetooth_conf_rw_t) > > type bluetooth_helper_t; > type bluetooth_helper_exec_t; > +init_system_domain(bluetooth_helper_t, bluetooth_helper_exec_t) > userdom_user_application_domain(bluetooth_helper_t, bluetooth_helper_exec_t) > role bluetooth_helper_roles types bluetooth_helper_t; > > @@ -176,6 +177,8 @@ allow bluetooth_helper_t self:shm create_shm_perms; > allow bluetooth_helper_t self:unix_stream_socket { accept connectto listen }; > > allow bluetooth_helper_t bluetooth_t:socket { read write }; > +allow bluetooth_helper_t bluetooth_t:fd use; > +allow bluetooth_helper_t bluetooth_t:unix_stream_socket rw_socket_perms; > > manage_dirs_pattern(bluetooth_helper_t, bluetooth_helper_tmp_t, bluetooth_helper_tmp_t) > manage_files_pattern(bluetooth_helper_t, bluetooth_helper_tmp_t, bluetooth_helper_tmp_t) > @@ -204,6 +207,8 @@ term_dontaudit_use_all_ttys(bluetooth_helper_t) > > auth_use_nsswitch(bluetooth_helper_t) > > +init_use_script_ptys(bluetooth_helper_t) > + > locallogin_dontaudit_use_fds(bluetooth_helper_t) > > logging_send_syslog_msg(bluetooth_helper_t) Merged. -- Chris PeBenito