Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp298123pxb; Thu, 17 Feb 2022 04:30:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJz261BEQTrNBi5p3Ztp2KVpHkb4uD8QNCH7U7YTJsWlo+QjporKGwU6Q24lB1EcFiTc9Mwk X-Received: by 2002:a17:90a:9109:b0:1bb:8504:8640 with SMTP id k9-20020a17090a910900b001bb85048640mr2816915pjo.173.1645101042440; Thu, 17 Feb 2022 04:30:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645101042; cv=none; d=google.com; s=arc-20160816; b=tAUyQmVtITzh8jH3dUVB60w/pdfZEz/fg2/OsTaW44cUROsGUuUw4PzVk1yGBkKC4Y yCN6/w9csQipDmcbo6nzMstltSU2XvdwMAU6SQVZ/15kSPM/8lDvX2Bh9GYgrxAGxkbM EJaDTlnHhE2TlpBuuqGiLGNpAZXgoHhmAsacqViHdDFVjzJMT/oowxt9Cnbkk9HuJgUG sVqxSw0K+H16Y4r4JlpqooxMKGBqhoPXANBZgcZ0GaFzjU2vUrcdyb2tO3jHX2mxsYNe rZpQoPqsY1lGm9hNdOprNRmfLph2WsjxEwqxgHVp3uqV1tlrlMHrtvApc7j5VKokqe20 9mPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date:dkim-signature; bh=EIFROsRx4x8QMWglrh/r3YfS06+AC+Nyl4dhMeTkbVY=; b=Xb8Kqmw0vfnoSvBKEM7KLRLttY9a8VSMe/UhQSLVoEtngp8kY2/8TpXFH7h6PaAT/K aUCPB8RHcuoQYgsIEO6VhkSrF895kRpInnc98A1vMFAi8TQC3gkNOzR9b8wp5J7Pyivy E6dymWZw6M+jGnhep3tZJIwegJZwq3iABP6yAudnP2CjCtn0tzvgeRDVveSjkUeP5vL5 QFt16phJrfgGSGlPvPBs1Dw6I1XIVDKf4dIKY6mpylaCfZ6R8yFTEK3b7Jmh09kmjyD4 Gha1UPnwyMMiCsX7JPHGa0/0oo/QfkSGZDgFLBybwzvQfqYpQENEyo2scrgfAyHA8wyk 0+7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@coker.com.au header.s=2008 header.b=CfLllcD9; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=coker.com.au Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19si7907642pgl.818.2022.02.17.04.30.36; Thu, 17 Feb 2022 04:30:42 -0800 (PST) Received-SPF: pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@coker.com.au header.s=2008 header.b=CfLllcD9; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=coker.com.au Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231587AbiBQCul (ORCPT + 22 others); Wed, 16 Feb 2022 21:50:41 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231570AbiBQCuk (ORCPT ); Wed, 16 Feb 2022 21:50:40 -0500 Received: from smtp.sws.net.au (smtp.sws.net.au [144.76.241.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F7172A82D0 for ; Wed, 16 Feb 2022 18:50:26 -0800 (PST) Received: from xev.coker.com.au (localhost [127.0.0.1]) by smtp.sws.net.au (Postfix) with ESMTP id 2D878F5DE for ; Thu, 17 Feb 2022 13:50:24 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coker.com.au; s=2008; t=1645066224; bh=EIFROsRx4x8QMWglrh/r3YfS06+AC+Nyl4dhMeTkbVY=; l=3800; h=Date:From:To:Subject:From; b=CfLllcD95CeBxp+D109Zod+3jd7/5f047djXUICX0qgiAJgNyIbiGXvQz9hl8rON+ LgjPi259mIYQhxVWy+Vs2snWUnzfc6YOE7SncCzJxIEEeOqgbCe3+WsQEPqKEYlD0T 3ss/vb2UtTEczyrU6g5rd4pemztByIis8ZL3xNI4= Received: by xev.coker.com.au (Postfix, from userid 1001) id A5A6B1733DA4; Thu, 17 Feb 2022 13:50:19 +1100 (AEDT) Date: Thu, 17 Feb 2022 13:50:19 +1100 From: Russell Coker To: selinux-refpolicy@vger.kernel.org Subject: [PATCH] rasdaemon policy Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org This is the policy for the Reliability, Availability, and Servicability daemon. It's designed to extract and log information on hardware events on server hardware. Signed-off-by: Russell Coker Index: refpolicy-2.20220217/policy/modules/kernel/filesystem.if =================================================================== --- refpolicy-2.20220217.orig/policy/modules/kernel/filesystem.if +++ refpolicy-2.20220217/policy/modules/kernel/filesystem.if @@ -5485,6 +5485,43 @@ interface(`fs_getattr_tracefs_files',` ######################################## ## +## Read/write trace filesystem files +## +## +## +## Domain allowed access. +## +## +# +interface(`fs_write_tracefs_files',` + gen_require(` + type tracefs_t; + ') + + allow $1 tracefs_t:dir list_dir_perms; + allow $1 tracefs_t:file rw_file_perms; +') + +######################################## +## +## create trace filesystem directories +## +## +## +## Domain allowed access. +## +## +# +interface(`fs_create_tracefs_dirs',` + gen_require(` + type tracefs_t; + ') + + allow $1 tracefs_t:dir { create rw_dir_perms }; +') + +######################################## +## ## Mount a XENFS filesystem. ## ## Index: refpolicy-2.20220217/policy/modules/services/rasdaemon.fc =================================================================== --- /dev/null +++ refpolicy-2.20220217/policy/modules/services/rasdaemon.fc @@ -0,0 +1,3 @@ +/usr/sbin/rasdaemon -- gen_context(system_u:object_r:rasdaemon_exec_t,s0) +/var/lib/rasdaemon(/.*)? gen_context(system_u:object_r:rasdaemon_var_t,s0) + Index: refpolicy-2.20220217/policy/modules/services/rasdaemon.if =================================================================== --- /dev/null +++ refpolicy-2.20220217/policy/modules/services/rasdaemon.if @@ -0,0 +1 @@ +## Index: refpolicy-2.20220217/policy/modules/services/rasdaemon.te =================================================================== --- /dev/null +++ refpolicy-2.20220217/policy/modules/services/rasdaemon.te @@ -0,0 +1,50 @@ +policy_module(rasdaemon, 1.0.0) + +# rasdaemon is a RAS (Reliability, Availability and Serviceability) logging +# tool. It currently records memory errors, using the EDAC tracing events. +# EDAC are drivers in the Linux kernel that handle detection of ECC errors +# from memory controllers for most chipsets on x86 and ARM architectures. +# +# https://git.infradead.org/users/mchehab/rasdaemon.git + +######################################## +# +# Declarations +# + +type rasdaemon_t; +type rasdaemon_exec_t; +init_daemon_domain(rasdaemon_t, rasdaemon_exec_t) + +type rasdaemon_var_t; +files_type(rasdaemon_var_t) + +######################################## +# +# Local policy +# + +allow rasdaemon_t self:unix_dgram_socket create_socket_perms; + +# confidentiality for tracefs and integrity for debugfs +allow rasdaemon_t self:lockdown { confidentiality integrity }; + +allow rasdaemon_t rasdaemon_var_t:dir manage_dir_perms; +allow rasdaemon_t rasdaemon_var_t:file manage_file_perms; + +kernel_read_debugfs(rasdaemon_t) +kernel_read_system_state(rasdaemon_t) +kernel_read_vm_overcommit_sysctl(rasdaemon_t) +kernel_search_fs_sysctls(rasdaemon_t) + +dev_list_sysfs(rasdaemon_t) +dev_read_urand(rasdaemon_t) + +files_read_etc_symlinks(rasdaemon_t) +files_search_var_lib(rasdaemon_t) +fs_write_tracefs_files(rasdaemon_t) +fs_create_tracefs_dirs(rasdaemon_t) + +logging_send_syslog_msg(rasdaemon_t) +miscfiles_read_localization(rasdaemon_t) +