Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2951030ybl; Sun, 11 Aug 2019 12:03:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqz18Z5Ph4G9JuQzsHJrzzQ4S4Ux5klX9gtYyVm7moKU7p9mzkoMQCqR+CDwevHhMPzd2F6h X-Received: by 2002:a17:902:f01:: with SMTP id 1mr23757610ply.337.1565550197549; Sun, 11 Aug 2019 12:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565550197; cv=none; d=google.com; s=arc-20160816; b=s8MMmfqZ9wqNtdxcsWWAQzLVdBJy0rrZKOwivNksstHvrqxZe29/4j3f0LTHODef2+ K1YKh2fJtoeRi4DzQTak4to+5hpaWcjbkVBrtjMvzpH6neBiIWlPGcotNK+lULjxIdD0 n+iQVh7Wf+CMZlTbjxggZjKEgQkPnL2LTAlfexgJIDsFKHxHFe5OHMaMcmkts+uZaKGJ efaA9LhIkQdb84yh2u1sJvjVGsHHDHw+2LIKfgUlkBWPKniL1Pri5SnrgNCKWVQTAuJn ftP3tak55qOE+RgKIwb5gg7eJbCzI61dM7vFobFv5ky9lqRNqx1oH1XnNf4DwSq+8GSz iWyw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=ShRK8SVzSTCZ9D8xd5aPjkQnmHsSUoPXaLBCqpedMYI=; b=KKcTgHGboZgf1hcZqCHwXVLuUY9XJ3xS59+xUXqX06xU3OxU8fftYTxrHuyWp/4kTa ChSf77aSigqQk0OGdfjdHFhJly93jMP/W4tZW89q196uMKYWlR5tdG+Q41Zw6xl+W8L7 ulS6478Gm9ZYaRvU8WJmIaqRWtVCc2SSOmNsf/fxOL30ygYVKArZW9qc4n8S0khvPvFJ YWAKQfcXGomgBjg9BjZA24rGEyDDtFJ66TtgS04TJlTlfo+jl8OqEIOS30wcoLsV7nnj hMFIfn5awaLG6CZDPSW+2dscUnF8/mvzCOk9hrMrxThkNfrpa7hIko2E4+pZQl6bw46p J7QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b=PxrXYyDo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ieee.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 72si5447283pfx.268.2019.08.11.12.03.13; Sun, 11 Aug 2019 12:03:17 -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; dkim=pass header.i=@ieee.org header.s=google header.b=PxrXYyDo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ieee.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725870AbfHKTDB (ORCPT + 11 others); Sun, 11 Aug 2019 15:03:01 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:37867 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbfHKTDB (ORCPT ); Sun, 11 Aug 2019 15:03:01 -0400 Received: by mail-qt1-f194.google.com with SMTP id y26so100869689qto.4 for ; Sun, 11 Aug 2019 12:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=ShRK8SVzSTCZ9D8xd5aPjkQnmHsSUoPXaLBCqpedMYI=; b=PxrXYyDoy763Hwnd/awoqPuNGj0TGELnMKz2DsOKAKKkX2Ff8JivOjMDwfN3SGyRp9 Sj0Y1A3ucbA/ClpLRlESGkPEzLTfYMxxwGCkXGtEXexDMnngZNCA6w8dcPIMAdim/UnZ iPUIwcb8fkCZHLKxyk870JoCrLWMb2pNO7+S4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ShRK8SVzSTCZ9D8xd5aPjkQnmHsSUoPXaLBCqpedMYI=; b=OkWWwEyAh/VrOpoUltR5Ek+bQg8uMHvQ/1zxutqkDv3UsOi4WzpR7UjVrcAgarekAf RB8vyhMVxcYTx7cA8kwjocoyBYTqF8Lw/cKDT157fJ0EvdZMQPyw7f+ZbRmoZNkgoUNV Sj587BMzp9n6yOtObiV1cCLlu2Uz2UDGm/Tp0rkACVsTIb6oZEu57aTMdGnz6Lp9cwNd 0DoS+vK4duSToAsZxCU2+tkvZh25Y3JPxocnbFXXb6GKm9jGPuk2/jKCMD6Gy+aX1Odd 5rz5PravgTGLHHMNRa+f0b3IuYtf2Ds8o6/KH1qgkXnXuJqNNW0jXltVeZlmGqf/YZiE 6aaQ== X-Gm-Message-State: APjAAAVjF0KgJ/6L0EaPxW8KbAS//R7/jnC2LmKrDd+bYiRJdE3BF2fn y6vKmiiDKnnWRkcZ6HBmCX6/UJEksfc= X-Received: by 2002:ad4:4985:: with SMTP id t5mr26713338qvx.193.1565550179962; Sun, 11 Aug 2019 12:02:59 -0700 (PDT) Received: from [192.168.1.190] (pool-108-15-23-247.bltmmd.fios.verizon.net. [108.15.23.247]) by smtp.gmail.com with ESMTPSA id i62sm47742055qke.52.2019.08.11.12.02.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 12:02:59 -0700 (PDT) Subject: Re: [PATCH v2] Module for tpm2 To: "Sugar, David" , "selinux-refpolicy@vger.kernel.org" References: <20190805191253.17089-1-dsugar@tresys.com> From: Chris PeBenito Message-ID: Date: Sun, 11 Aug 2019 15:02:58 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190805191253.17089-1-dsugar@tresys.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org On 8/5/19 3:13 PM, Sugar, David wrote: > Module for tpm2 > > v2 - updated to rename module and interface names, different dbus > interface > > Signed-off-by: Dave Sugar > --- > policy/modules/services/tpm2.fc | 3 ++ > policy/modules/services/tpm2.if | 58 +++++++++++++++++++++++++++++++++ > policy/modules/services/tpm2.te | 30 +++++++++++++++++ > 3 files changed, 91 insertions(+) > create mode 100644 policy/modules/services/tpm2.fc > create mode 100644 policy/modules/services/tpm2.if > create mode 100644 policy/modules/services/tpm2.te > > diff --git a/policy/modules/services/tpm2.fc b/policy/modules/services/tpm2.fc > new file mode 100644 > index 00000000..4ccf2f25 > --- /dev/null > +++ b/policy/modules/services/tpm2.fc > @@ -0,0 +1,3 @@ > +/usr/sbin/tpm2-abrmd -- gen_context(system_u:object_r:tpm2_abrmd_exec_t,s0) > + > +/usr/lib/systemd/system/[^/]*tpm2-abrmd\.service -- gen_context(system_u:object_r:tpm2_abrmd_unit_t,s0) > diff --git a/policy/modules/services/tpm2.if b/policy/modules/services/tpm2.if > new file mode 100644 > index 00000000..55133e4a > --- /dev/null > +++ b/policy/modules/services/tpm2.if > @@ -0,0 +1,58 @@ > +## Trusted Platform Module 2.0 > + > +######################################## > +## > +## Allow specified domain to enable/disable tpm2-abrmd unit > +## > +## > +## > +## Domain allowed access. > +## > +## > +# > +interface(`tpm2_enabledisable_abrmd',` > + gen_require(` > + type tpm2_abrmd_unit_t; > + class service { enable disable }; > + ') > + > + allow $1 tpm2_abrmd_unit_t:service { enable disable }; > +') > + > +######################################## > +## > +## Allow specified domain to start/stop tpm2-abrmd unit > +## > +## > +## > +## Domain allowed access. > +## > +## > +# > +interface(`tpm2_startstop_abrmd',` > + gen_require(` > + type tpm2_abrmd_unit_t; > + class service { start stop }; > + ') > + > + allow $1 tpm2_abrmd_unit_t:service { start stop }; > +') > + > +######################################## > +## > +## Allow specified domain to get status of tpm2-abrmd unit > +## > +## > +## > +## Domain allowed access. > +## > +## > +# > +interface(`tpm2_status_abrmd',` > + gen_require(` > + type tpm2_abrmd_unit_t; > + class service status; > + ') > + > + allow $1 tpm2_abrmd_unit_t:service status; > +') > diff --git a/policy/modules/services/tpm2.te b/policy/modules/services/tpm2.te > new file mode 100644 > index 00000000..aa607771 > --- /dev/null > +++ b/policy/modules/services/tpm2.te > @@ -0,0 +1,30 @@ > +policy_module(tpm2, 1.0.0) > + > +######################################## > +# > +# Declarations > +# > + > +type tpm2_abrmd_t; > +type tpm2_abrmd_exec_t; > +init_daemon_domain(tpm2_abrmd_t, tpm2_abrmd_exec_t) > + > +type tpm2_abrmd_unit_t; > +init_unit_file(tpm2_abrmd_unit_t) > + > +######################################## > +# > +# Local policy > +# > + > +allow tpm2_abrmd_t self:process signal; > +allow tpm2_abrmd_t self:unix_stream_socket create_socket_perms; > + > +dev_rw_tpm(tpm2_abrmd_t) > + > +kernel_read_crypto_sysctls(tpm2_abrmd_t) > +kernel_read_system_state(tpm2_abrmd_t) > + > +optional_policy(` > + dbus_system_domain(tpm2_abrmd_t, tpm2_abrmd_exec_t) > +') Merged. -- Chris PeBenito