Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5212190yba; Tue, 30 Apr 2019 10:54:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhQMAvk0hw6/Wx+nqd67vzwhP9eAZmhATZifqmJNLCMuwWkHA7YVWHXydgIDtv0Jdmixls X-Received: by 2002:a65:4343:: with SMTP id k3mr36769623pgq.384.1556646840433; Tue, 30 Apr 2019 10:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556646840; cv=none; d=google.com; s=arc-20160816; b=uUp1XI8rqjTV3+Rhnz1qlTK2LyJCkAJMfBz7rVoKXlDdnmopzYtk/+h5twud7W/qIt K+opKtnS15pZBjH2osgrEKK0W9sHIpqRNIaQgQ8iZjqCPNdmmdOlzaAj5PDZjLHv/kyE YmMkTdjl+cRJZFPtkBufRveda/5fW7NKZkLaen6FcmfVxHz3guAuxvhcmUUSUnJwo3Ur dRUWs+3lNMlOsqJmuhGxdL1cGQPYXc/48hx9irwNvgTNzcZYpGdLR5Yj1yhHxjeLJUVg x1oKL++/ptM4qTh5izhXalFnzR9NKxT49P1WSkPvN+DUnThbXNYYVeRJvB7oGap/jdL/ TmmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=XKHdBnH+5bfNHwW7//mTLgFo/mB04LDk4rDhvf/HNQQ=; b=Db5NMRWQg03wf20tJAJmugX/k+TY+8k4lK7sXFCLSN4t4HDf0NserWCHPWuaGWdovO KhWIxtoAW599pe3HeIyVz/9MdFl52POffKbx0jYlqqExN/C9/zb1M0dtO3g+Eqkb1Yme n69iCmtmoUs2dmYJN4RAadfIKUCyzHEzwMVTzD2za4bV5ozwZSMclBRF7qJXTncehflL EbIs+6TGnn+pvXx03Iov2tFVGJ0R/cUg5BZgCE5oaD9g4kEUlQL+p6/K5fMWbcFN4AWD op941b3QM/bauGu8TziTOWdV5lZ0RKS3V6ZL8kc2FikHgm6aoSQViS3EQSTjcQQgGMBf iB0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8si37099709pgo.122.2019.04.30.10.53.56; Tue, 30 Apr 2019 10:54:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726017AbfD3Rxd (ORCPT + 11 others); Tue, 30 Apr 2019 13:53:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44588 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbfD3Rxd (ORCPT ); Tue, 30 Apr 2019 13:53:33 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1760F307D874 for ; Tue, 30 Apr 2019 17:53:33 +0000 (UTC) Received: from lvrabec-workstation.brq.redhat.com (unknown [10.43.12.239]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65CC76D0A8; Tue, 30 Apr 2019 17:53:32 +0000 (UTC) From: Lukas Vrabec To: selinux-refpolicy@vger.kernel.org Cc: Lukas Vrabec Subject: [PATCH] Introduce allow_bluetooth boolean Date: Tue, 30 Apr 2019 19:53:29 +0200 Message-Id: <20190430175329.25335-1-lvrabec@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 30 Apr 2019 17:53:33 +0000 (UTC) Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org Because of new bluetooth_socket which is part of extended_socket_class policy capability, it's possible to control which SELinux domains can use bluetooth wireless technology. Default value of the boolean is turned off. Signed-off-by: Lukas Vrabec --- policy/global_tunables | 7 +++++++ policy/modules/admin/netutils.te | 4 ++++ policy/modules/services/arpwatch.te | 4 ++++ policy/modules/services/bluetooth.if | 4 ++++ policy/modules/services/bluetooth.te | 4 ++++ policy/modules/services/ntop.te | 4 ++++ policy/modules/system/userdomain.if | 8 ++++++++ 7 files changed, 35 insertions(+) diff --git a/policy/global_tunables b/policy/global_tunables index affc020f..69b356e2 100644 --- a/policy/global_tunables +++ b/policy/global_tunables @@ -4,6 +4,13 @@ # file should be used. # +## +##

+## Allow all system processes and Linux users to use bluetooth wireless technology. +##

+##
+gen_tunable(allow_bluetooth,false) + ## ##

## Allow unconfined executables to make their heap memory executable. Doing this is a really bad idea. Probably indicates a badly coded executable, but could indicate an attack. This executable should be reported in bugzilla diff --git a/policy/modules/admin/netutils.te b/policy/modules/admin/netutils.te index 46560a09..8821b108 100644 --- a/policy/modules/admin/netutils.te +++ b/policy/modules/admin/netutils.te @@ -99,6 +99,10 @@ optional_policy(` xen_append_log(netutils_t) ') +tunable_policy(`allow_bluetooth',` + allow netutils_t self:bluetooth_socket create_stream_socket_perms; +') + ######################################## # # Ping local policy diff --git a/policy/modules/services/arpwatch.te b/policy/modules/services/arpwatch.te index 87aed96f..6f05441a 100644 --- a/policy/modules/services/arpwatch.te +++ b/policy/modules/services/arpwatch.te @@ -77,6 +77,10 @@ miscfiles_read_localization(arpwatch_t) userdom_dontaudit_search_user_home_dirs(arpwatch_t) userdom_dontaudit_use_unpriv_user_fds(arpwatch_t) +tunable_policy(`allow_bluetooth',` + allow arpwatch_t self:bluetooth_socket create_socket_perms; +') + optional_policy(` mta_send_mail(arpwatch_t) ') diff --git a/policy/modules/services/bluetooth.if b/policy/modules/services/bluetooth.if index dc61988c..9097803f 100644 --- a/policy/modules/services/bluetooth.if +++ b/policy/modules/services/bluetooth.if @@ -68,6 +68,10 @@ interface(`bluetooth_stream_connect',` files_search_pids($1) allow $1 bluetooth_t:socket rw_socket_perms; stream_connect_pattern($1, bluetooth_var_run_t, bluetooth_var_run_t, bluetooth_t) + + tunable_policy(`deny_bluetooth',`',` + allow $1 bluetooth_t:bluetooth_socket rw_socket_perms; + ') ') ######################################## diff --git a/policy/modules/services/bluetooth.te b/policy/modules/services/bluetooth.te index 45e5a361..39af72d5 100644 --- a/policy/modules/services/bluetooth.te +++ b/policy/modules/services/bluetooth.te @@ -133,6 +133,10 @@ userdom_dontaudit_use_unpriv_user_fds(bluetooth_t) userdom_dontaudit_use_user_terminals(bluetooth_t) userdom_dontaudit_search_user_home_dirs(bluetooth_t) +tunable_policy(`allow_bluetooth',` + allow bluetooth_t self:bluetooth_socket create_stream_socket_perms; +') + optional_policy(` dbus_system_bus_client(bluetooth_t) dbus_connect_system_bus(bluetooth_t) diff --git a/policy/modules/services/ntop.te b/policy/modules/services/ntop.te index 178bbb1d..537d9323 100644 --- a/policy/modules/services/ntop.te +++ b/policy/modules/services/ntop.te @@ -96,6 +96,10 @@ miscfiles_read_localization(ntop_t) userdom_dontaudit_use_unpriv_user_fds(ntop_t) userdom_dontaudit_search_user_home_dirs(ntop_t) +tunable_policy(`allow_bluetooth',` + allow ntop_t self:bluetooth_socket create_socket_perms; +') + optional_policy(` apache_read_sys_content(ntop_t) ') diff --git a/policy/modules/system/userdomain.if b/policy/modules/system/userdomain.if index 5221bd13..5654de6e 100644 --- a/policy/modules/system/userdomain.if +++ b/policy/modules/system/userdomain.if @@ -1189,6 +1189,10 @@ template(`userdom_unpriv_user_template', ` corenet_udp_bind_generic_port($1_t) ') + tunable_policy(`allow_bluetooth',` + allow $1_t self:bluetooth_socket create_socket_perms; + ') + optional_policy(` netutils_run_ping_cond($1_t, $1_r) netutils_run_traceroute_cond($1_t, $1_r) @@ -1362,6 +1366,10 @@ template(`userdom_admin_user_template',` userdom_manage_user_home_content_sockets($1_t) userdom_user_home_dir_filetrans_user_home_content($1_t, { dir file lnk_file fifo_file sock_file }) + tunable_policy(`allow_bluetooth',` + allow $1_t self:bluetooth_socket create_stream_socket_perms; + ') + optional_policy(` postgresql_unconfined($1_t) ') -- 2.20.1