Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9EF1C43219 for ; Fri, 26 Apr 2019 18:52:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 97242206A3 for ; Fri, 26 Apr 2019 18:52:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IESF80z9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726049AbfDZSw4 (ORCPT ); Fri, 26 Apr 2019 14:52:56 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43191 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725875AbfDZSw4 (ORCPT ); Fri, 26 Apr 2019 14:52:56 -0400 Received: by mail-ed1-f66.google.com with SMTP id j20so3984478edq.10 for ; Fri, 26 Apr 2019 11:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oGXMJS1wSyFdPTJRDttUw35+b9c6RdPiFsLqyHiqpwM=; b=IESF80z9VzYgbZVAAbsg2rn7L13v+q+KF/EhcIWORncq8v2jL6dI+cBL9srUkDi5Lq yhZsL6ThmAvSFAogxUhfswDoTZcZnNMJXArVeevs0mTpdiJECkBCHo9584HGSySXMAck JvB3OE4/lGcXWQesotlmqx2WfLTr4Qy/zv3MU4YpU28zBiDFoxNgkUjk+3VJ7OdYeYog y4yK0Ewsriwr8unAd9n6WmAi0zcVLR1PI9lJTcG5qUf/4S8dRVIzD6GiOHepSwCEqJlH BLHpUTEZMaF/lCzCv0W4tpd1h9EdeEtv58lfh0ObVGVP527opJ0uEjQQ3zw/9ChSRLMT wO9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=oGXMJS1wSyFdPTJRDttUw35+b9c6RdPiFsLqyHiqpwM=; b=WAjEF/UQ0vO7UadZLS/A94a+b6WiwyeZZK4PKmsucpLWF67v16NNTphB8dUwE0oPZ0 0hwP5e3Flq56VQ4U3QkWANdn7HWrFZQr7qtWq82yvdxArlFGDtCqLr9HTCOgVNmopwqT hVROffxhH7soqtYyOybkMcxio4q7Eb0qJaEbuGNy46z1wVlA0mYTz4v1uaXMug+oJC2a juhUnatNJ8OgCJmVDvJBCMYjFA658tvpG/o9uGHznUR95+55Jmd56lMn7MQXORruvhOc yWP2X7rSISnbqemChXu+vNXlpItcpOiGMtpEP0RAEb8BffZP0tfF3XB4WQFVPOTlWpjY EEWA== X-Gm-Message-State: APjAAAXF25miL8R2FshQR1TXQElegveeOvufy4bJwbSaSXamCfAY75nC 98DBOjEfTsVg8XRWM8xxtig= X-Google-Smtp-Source: APXvYqxnk3IfIYsUHnB+0JEe/5zaLa53+PX4VVJYR/n/FUmZC4+CTvZB7kfYxrGOTSOn+tX4uCfaew== X-Received: by 2002:a50:aeb6:: with SMTP id e51mr29176689edd.76.1556304773668; Fri, 26 Apr 2019 11:52:53 -0700 (PDT) Received: from brutus.lan (brutus.defensec.nl. [2001:985:d55d::438]) by smtp.gmail.com with ESMTPSA id x44sm4713368edb.51.2019.04.26.11.52.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Apr 2019 11:52:52 -0700 (PDT) Date: Fri, 26 Apr 2019 20:52:50 +0200 From: Dominick Grift To: Lukas Vrabec Cc: selinux-refpolicy@vger.kernel.org Subject: Re: [PATCH] Introduce allow_bluetooth boolean Message-ID: <20190426185250.GA3419@brutus.lan> Mail-Followup-To: Lukas Vrabec , selinux-refpolicy@vger.kernel.org References: <20190426092710.320-1-lvrabec@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="82I3+IH0IqGh5yIs" Content-Disposition: inline In-Reply-To: <20190426092710.320-1-lvrabec@redhat.com> User-Agent: Every email client sucks, this one just sucks less. X-PGP-Key: https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 26, 2019 at 11:27:10AM +0200, Lukas Vrabec wrote: > 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. Two observations: 1. are you using 4 spaces ident instead of 8 space tab indentation? 2. this rule is questionable: allow init_t self:bluetooth_socket { create_socket_perms listen }; >=20 > 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/init.te | 4 ++++ > policy/modules/system/userdomain.if | 8 ++++++++ > 8 files changed, 39 insertions(+) >=20 > 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. > # > =20 > +## > +##

> +## 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. D= oing this is a really bad idea. Probably indicates a badly coded executable= , but could indicate an attack. This executable should be reported in bugzi= lla > diff --git a/policy/modules/admin/netutils.te b/policy/modules/admin/netu= tils.te > index 46560a09..b4e66e8f 100644 > --- a/policy/modules/admin/netutils.te > +++ b/policy/modules/admin/netutils.te > @@ -99,6 +99,10 @@ optional_policy(` > xen_append_log(netutils_t) > ') > =20 > +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/service= s/arpwatch.te > index 87aed96f..7e817035 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) > =20 > +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/servic= es/bluetooth.if > index dc61988c..5fda4f69 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, bl= uetooth_t) > + > + tunable_policy(`deny_bluetooth',`',` > + allow $1 bluetooth_t:bluetooth_socket rw_socket_perms; > + ') > ') > =20 > ######################################## > diff --git a/policy/modules/services/bluetooth.te b/policy/modules/servic= es/bluetooth.te > index 45e5a361..fa9daa48 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) > =20 > +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/nt= op.te > index 178bbb1d..50157b88 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) > =20 > +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/init.te b/policy/modules/system/init.te > index 00f36c99..26eff7bc 100644 > --- a/policy/modules/system/init.te > +++ b/policy/modules/system/init.te > @@ -523,6 +523,10 @@ optional_policy(` > unconfined_domain(init_t) > ') > =20 > +tunable_policy(`allow_bluetooth',` > + allow init_t self:bluetooth_socket { create_socket_perms listen }; > +') > + > ######################################## > # > # Init script local policy > diff --git a/policy/modules/system/userdomain.if b/policy/modules/system/= userdomain.if > index 5221bd13..50d2e080 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) > ') > =20 > + 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 }) > =20 > + tunable_policy(`allow_bluetooth',` > + allow $1_t self:bluetooth_socket create_stream_socket_perms; > + ') > + > optional_policy(` > postgresql_unconfined($1_t) > ') > --=20 > 2.20.1 >=20 --=20 Key fingerprint =3D 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=3Dget&search=3D0x3B6C5F1D2C7B6B02 Dominick Grift --82I3+IH0IqGh5yIs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGyBAEBCAAdFiEEujmXliIBLFTc2Y4AJXSOVTf5R2kFAlzDU30ACgkQJXSOVTf5 R2kc4gv4nf7ZfvMsmTFz+f+KsaYbB4Y43YgUNe/gTvivAYp/BfGiCAIHJUQ+CeVG kdAfPTp/EjQBEleeup62B9jMDytETnMaHbU41Lq6k9wQT55pHZNwjCm7dQC9JZS+ H2igCbAQXoeGi86FOFlOnmCZTTJ0wVLMDxCsZvVXDLmuB92uhCMI0LjsQTQ1OwHx bWhX9VFvFifyQu7t03dwyuZDl481gO+ois8rV4jo3kq9xGkzXA9fDs6ofTfXP6YE lMVpqDwzzgjfwUhHOLaqOTJRNdyawtPYXBX0hGfK28jEO3IHxqT+mpA/tTWjs1YY 41rhAumyoZAMK5VOXClbq6rHACg0UX5Ga1rSAsMt+1yTpphIDvS3wFxdA5ADnM2M s537C1JEXI9/F3CFAfnoCqK6g7MOsTDD0Tu4mShfIb7yiOBp0DsuEqCqkyLkYjM/ 8g7YK3vAqHTl9GvzdtkmfOTU7wJcGplPW+h0Qrj+PHR9pnWYr5FGMQCAvqrckmF4 xjZn91g= =CSQR -----END PGP SIGNATURE----- --82I3+IH0IqGh5yIs--