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 C2DBBC43219 for ; Sat, 27 Apr 2019 17:17:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 874AA20693 for ; Sat, 27 Apr 2019 17:17:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cjBeFRvt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726362AbfD0RRB (ORCPT ); Sat, 27 Apr 2019 13:17:01 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:46705 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbfD0RRB (ORCPT ); Sat, 27 Apr 2019 13:17:01 -0400 Received: by mail-ed1-f68.google.com with SMTP id d1so5684920edd.13 for ; Sat, 27 Apr 2019 10:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=n1ouiFv2oG918TjhxQJP1MhnWiPxEingfhaXTE6BjYQ=; b=cjBeFRvtudd5QpY61o6sZ2US+5n72EWni4CRPnnUfjj9fHXo7Wzb9teCKUMq5WhvNb lxz8NxFcPJ07YzOhJJHZKlgkwahZipZJlATK00nJeSOpb+Ajrm/SsnxpbXiLALe98e+z RDhIWLZVWH7KYj6rZ8I/YtXbRLQPza4+MZ7GWkrDXCvl6z+UJrI/aHXh5K2HA0n92zO5 6fXRURcjxoEyjphmBlvXTUFv4FMIbJJXC0DXWv9PxooNbhtair/T0tgA12yp28MwmEq5 /qp4s+khhJUY7OPLeY60PcDdiKpGiMnEBx/7hothwomAVOU1jssuvvB1+n9o8RLPVKTI V8gg== 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:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=n1ouiFv2oG918TjhxQJP1MhnWiPxEingfhaXTE6BjYQ=; b=gAs69o58b/++jW+VrxuREHF67mNG96PPkslAHO4/RJMtvIKg8JUYD75N5RquDUoOd9 1srdEhNMLGsJqecobw1+gV/ntdAL06FbubsiEpT7sOzFy1RyWHG8ikTeF3g46Dqjo2O7 s1hHnio6NrnX6uJkXPtVjbALp4v5wEfVocNKBSDvsqAj71iLgKrYDxlRLYwNuLvbmmGN 5R11or8LWRXT6SNf7UykdX5ojmGboLKs+08JL0XvSwrRWRXrVUok8KDtKICXRTb9Tc3P 0P4orHylmWKYMO0mg2fTFgJg2hDKhUCGcM91BN1sFAOt4UGdmhHr7MiaW1ibnsIJVC/r E/ng== X-Gm-Message-State: APjAAAVDnc2R6Jsj2pFCeUKTzApKZBLPH6y6m+pqesKHs9M6IYGat/2b 21R1/0L0jVSJfWMZGZrx1KsWvQnC X-Google-Smtp-Source: APXvYqwgHwwGGiNxnYW0i3gTJOJrd9hafslcwb2Y9lfbSFGxqgzxtTGNUpRU6FOTHb/r+gQRbKDTmQ== X-Received: by 2002:a50:a49c:: with SMTP id w28mr33045282edb.151.1556385419000; Sat, 27 Apr 2019 10:16:59 -0700 (PDT) Received: from brutus.lan (brutus.defensec.nl. [2001:985:d55d::438]) by smtp.gmail.com with ESMTPSA id a9sm7901718edm.14.2019.04.27.10.16.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 27 Apr 2019 10:16:58 -0700 (PDT) Date: Sat, 27 Apr 2019 19:16:56 +0200 From: Dominick Grift To: Lukas Vrabec , selinux-refpolicy@vger.kernel.org Subject: Re: [PATCH] Introduce allow_bluetooth boolean Message-ID: <20190427171656.GA30243@brutus.lan> Mail-Followup-To: Lukas Vrabec , selinux-refpolicy@vger.kernel.org References: <20190426092710.320-1-lvrabec@redhat.com> <20190426185250.GA3419@brutus.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6c2NcOVqGQ03X4Wi" Content-Disposition: inline In-Reply-To: <20190426185250.GA3419@brutus.lan> 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 --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 26, 2019 at 08:52:50PM +0200, Dominick Grift wrote: > 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. >=20 > Two observations: >=20 > 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 }; I looked into this and tracked the above down to this: https://bugzilla.redhat.com/show_bug.cgi?id=3D1592223 In that report the bluetoothd executable file was mislabeled and that is wh= y it ended up in init_t. Please address the indents and remove the above rule. >=20 > >=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 wireles= s 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 executab= le, but could indicate an attack. This executable should be reported in bug= zilla > > diff --git a/policy/modules/admin/netutils.te b/policy/modules/admin/ne= tutils.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/servi= ces/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/serv= ices/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, = bluetooth_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/serv= ices/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/= ntop.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= =2Ete > > 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/syste= m/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 ln= k_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 > --=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 --=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 --6c2NcOVqGQ03X4Wi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAEBCAAdFiEEujmXliIBLFTc2Y4AJXSOVTf5R2kFAlzEjoQACgkQJXSOVTf5 R2kbmwv+IS9/eTX4ZHDJDb3y7TO7vgKV8nyUUfGc879JUr9PlagJAeb/83nUeFmg AtnzF214AiWKPW43LT0qQVRs5K0wgTuJEWv6tD5o6SmOA1TBe10C5AZVImBc1zzn 2NzGixoXmlswHDpWkL58KTAPlSd3aeuGP93xbfT5zMiqbKLz0PaSWqKo6Tjip4sA U6+tV3iy4Od9T3TEyuD2v1KSQAwx6B5FDNG0bwmwnW4IiQHb0tSb60crLYr+UO0j I6jkJ7hUZEci/aoV1+3gvGd6NSUbB2tJi/PF+Yf7SdIU1Fy/m0S/Q9RiMB2JveqE QHBsc4/ai6mTn8h0LRoL91fjBhE6KlF7sOL3pyGzKzvCRSRZEoQ5kJ5PcuyaxVq0 uohLBSpUhkDaowpCia1SIbirOPVzSSqxRUARszcSY5a97XP7nqbeTvflMtCKkFOi Hj0PjiAouo6YdgsnYl/IPGQHXT1wPQv3DPjUFWyy/2dDjzl6aLmwBCj0IgAlFxKA oe5C9P6E =n1ZS -----END PGP SIGNATURE----- --6c2NcOVqGQ03X4Wi--