Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp137530pxb; Wed, 20 Jan 2021 03:18:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzt20+7t77o129Mm2pTkT8tDPpm1vBseEVy7jWVQZnZrRYsOZPY4c+lxCrg6/C6wIYubmpH X-Received: by 2002:a17:907:1050:: with SMTP id oy16mr823385ejb.424.1611141513651; Wed, 20 Jan 2021 03:18:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611141513; cv=none; d=google.com; s=arc-20160816; b=ZlWb9HaViG9li2ifltMR0SXVBGQxwgfiAzzmtylFlBRpXn8j2630Issm6LIRmTpwIk rre/cieofnIyeTMkw6ZD/FkOQaqowlM+4QXhbLE1dGBkkyuqa4zJPtBX0Q8bKVIhIQLJ IYT7o7ZiDou9YQV+2V1ZtnqwBz8zBCVbrV9mxiWgtRvGckhiHYALLkqo6SbPiJtSAoUi vZT77YryGClTOMUjvy8HgZmYK6S/0zyeHHTu7w2/4Lo1KRBZSZ1ec3iNYA4+xa0wySU3 JPxauMaZbqCmf7/RhhOpzxC9BQ/B4GqEnx04S4p+hwdyvTKG1Pg9kdEyqCutRjZo2bmK b8Zw== 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=AqCL8OUwBzVwWmG1IIL2HT34YdsAa6oCIAJG9JHWfDE=; b=L/rOQXL/Q83DtHeOzUKDAleKFx6JBBwNUSe89t80v0e1VU7U4OA2WXdGdf9T5A801M HwWuYYTgVpKV0Jnu2T5UVz4cY49qKdytkFBfvTpmzFVmv9AjRCuP4r5+zAj5Gvp/AKNn KN6mTqesGxbuUPPiHp2Z9D833aIVOG6MrQbj4/zJrRKJMiHu4djrSvoGCQFoc6xVlY4w IncvITtYrUbCsdMfuFKoPR9LsLdVHKGQNa31quefvRQtbEIaHPB7qpJvtkJLOn3dNSEZ iS6VsgPnt7j9ZapvqtOjBaKt7jOzZQDo1jI+8cJH1YklQ0fLQKYjORyhzk5X46y+6BNx wT5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@coker.com.au header.s=2008 header.b=OkFHa9gD; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si691140edd.436.2021.01.20.03.18.29; Wed, 20 Jan 2021 03:18:33 -0800 (PST) Received-SPF: pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@coker.com.au header.s=2008 header.b=OkFHa9gD; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.18 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 S1730559AbhATLKA (ORCPT + 16 others); Wed, 20 Jan 2021 06:10:00 -0500 Received: from smtp.sws.net.au ([46.4.88.250]:41370 "EHLO smtp.sws.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732259AbhATKSG (ORCPT ); Wed, 20 Jan 2021 05:18:06 -0500 Received: from xev.coker.com.au (localhost [127.0.0.1]) by smtp.sws.net.au (Postfix) with ESMTP id D5F5C16AF5 for ; Wed, 20 Jan 2021 21:17:21 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coker.com.au; s=2008; t=1611137842; bh=AqCL8OUwBzVwWmG1IIL2HT34YdsAa6oCIAJG9JHWfDE=; l=3729; h=Date:From:To:Subject:From; b=OkFHa9gDSqKJWO6BO1ghSXFyuvhmlI9OX/ASWsTV/NqSMTQ+M6EbSdHX0cVf53y8Y H0JXgbzefY+bOkqmInJ1/DEsgFzyVmC7em1D6lJ1AYmfRL+4BmJiOkNUhG4d5UFj04 bWfyJTYJoV8I6PgvL8m58rq5wz5gWpTfci63k4sY= Received: by xev.coker.com.au (Postfix, from userid 1001) id BB37C131FD18; Wed, 20 Jan 2021 21:17:17 +1100 (AEDT) Date: Wed, 20 Jan 2021 21:17:17 +1100 From: Russell Coker To: selinux-refpolicy@vger.kernel.org Subject: [PATCH] latest memlockd patch Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org Includes the ifndef(`distro_debian' section that was requested. Should be ready for merging now. Signed-off-by: Russell Coker Index: refpolicy-2.20201205/policy/modules/services/memlockd.fc =================================================================== --- /dev/null +++ refpolicy-2.20201205/policy/modules/services/memlockd.fc @@ -0,0 +1 @@ +/usr/sbin/memlockd -- gen_context(system_u:object_r:memlockd_exec_t,s0) Index: refpolicy-2.20201205/policy/modules/services/memlockd.if =================================================================== --- /dev/null +++ refpolicy-2.20201205/policy/modules/services/memlockd.if @@ -0,0 +1,2 @@ +## memory lock daemon, keeps important files in RAM. + Index: refpolicy-2.20201205/policy/modules/services/memlockd.te =================================================================== --- /dev/null +++ refpolicy-2.20201205/policy/modules/services/memlockd.te @@ -0,0 +1,39 @@ +policy_module(memlockd, 1.0.0) + +######################################## +# +# Declarations +# + +type memlockd_t; +type memlockd_exec_t; +init_daemon_domain(memlockd_t, memlockd_exec_t) + +######################################## +# +# Local policy +# + +allow memlockd_t self:capability { setgid setuid ipc_lock }; +ifndef(`distro_debian', ` +allow memlockd_t self:capability dac_read_search; +') +allow memlockd_t self:fifo_file rw_file_perms; + +# cache /etc/shadow too +auth_read_shadow(memlockd_t) +auth_map_shadow(memlockd_t) + +corecmd_exec_all_executables(memlockd_t) +corecmd_exec_bin(memlockd_t) +corecmd_exec_shell(memlockd_t) +corecmd_read_all_executables(memlockd_t) +corecmd_search_bin(memlockd_t) +files_read_etc_files(memlockd_t) +libs_exec_ld_so(memlockd_t) +files_map_etc_files(memlockd_t) + +logging_send_syslog_msg(memlockd_t) +miscfiles_read_localization(memlockd_t) + +sysnet_mmap_read_config(memlockd_t) Index: refpolicy-2.20201205/policy/modules/system/sysnetwork.if =================================================================== --- refpolicy-2.20201205.orig/policy/modules/system/sysnetwork.if +++ refpolicy-2.20201205/policy/modules/system/sysnetwork.if @@ -393,6 +393,31 @@ interface(`sysnet_mmap_config_files',` ####################################### ## +## map network config files. +## +## +##

+## Allow the specified domain to mmap the +## general network configuration files. +##

+##
+## +## +## Domain allowed access. +## +## +# +interface(`sysnet_mmap_read_config',` + gen_require(` + type net_conf_t; + ') + + files_search_etc($1) + allow $1 net_conf_t:file mmap_read_file_perms; +') + +####################################### +## ## Do not audit attempts to read network config files. ## ## Index: refpolicy-2.20201205/policy/modules/system/authlogin.if =================================================================== --- refpolicy-2.20201205.orig/policy/modules/system/authlogin.if +++ refpolicy-2.20201205/policy/modules/system/authlogin.if @@ -577,6 +577,23 @@ interface(`auth_read_shadow',` ######################################## ## +## Map the shadow passwords file (/etc/shadow) +## +## +## +## Domain allowed access. +## +## +# +interface(`auth_map_shadow',` + gen_require(` + type shadow_t; + ') + allow $1 shadow_t:file map; +') + +######################################## +## ## Pass shadow assertion for reading. ## ##