Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3863602ybv; Sun, 16 Feb 2020 07:34:56 -0800 (PST) X-Google-Smtp-Source: APXvYqwAiCunJgr5S2iaHu6R+4n9l1F5r/EDjl3OP0vmdB7MkbSZdT/P59ZJ/pMghXkTIjC1Fy3d X-Received: by 2002:aca:b1d5:: with SMTP id a204mr7433654oif.82.1581867296064; Sun, 16 Feb 2020 07:34:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581867296; cv=none; d=google.com; s=arc-20160816; b=Zweq8zNrxlyscZWcg0V2kC9pzvO3MR+5YPBFYVdUg6DChluWyDYBaUB3zwajwGAGR3 8e5SpyambrgT6pPjYoLeghwC0roBO9N8nudC7ZwmO2ovMYRLuI1KFZQTO5lj6r46uXSx OrtCj2AGnZfeO0Gi9jMtb0jn4BiuMl2nkkOE7VAr16Ib3DC6YCydIJlZuyUqP3WT+1La qGr9LcBFhisSt+26vXE11C0oJ8m73ksKosVmkEh93Z/75+ZF9iqktyJZe64wtKCKyfF3 BGKcAZW9pXx3CKXsv4YFhfiI71W6VAjVC1GWFkpMcgfHVgFo/CNmHNT3J/9/UxRn9rSc LX5A== 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=torIaowc+t3sQS4BvpNAWoZkpZUOsV4DuZCCGLyN7aQ=; b=t1gtU9g0X2EgyZc9j1XdtyxOVBSQxJpZLG+GLhS0tKpAGmvy6tr5YxVXfKULCI0O6L zxSv5RcHWxk6ZvnnK6CoWig84C42MY9ECJA9kxr0ds2CoLs50wu6c93OwdGLxUOizgtk Xm0/+Ao+GVcnYezLafqqM3MlqQ/u0TK/q2PGTx44J9mD7FjHPhLP6U2AORYTkYk/QUYa YqpVkaG1q6xLwiuUbgoL8SIextVd3l+3JBGJN1pqZjuat2GyD/yRGn2gAv4R9I/Nxvis GgsNaKNZLtLqooDxGPKERGarEWTwMfRAGeFKMN43BazrNUvye61j0VuXQBTozGv8C9v4 j3eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b=W4idgvAg; 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 p14si6008744ota.71.2020.02.16.07.34.54; Sun, 16 Feb 2020 07:34:56 -0800 (PST) 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=W4idgvAg; 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 S1726171AbgBPPev (ORCPT + 13 others); Sun, 16 Feb 2020 10:34:51 -0500 Received: from mail-qk1-f171.google.com ([209.85.222.171]:43890 "EHLO mail-qk1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728362AbgBPPev (ORCPT ); Sun, 16 Feb 2020 10:34:51 -0500 Received: by mail-qk1-f171.google.com with SMTP id p7so13912213qkh.10 for ; Sun, 16 Feb 2020 07:34:49 -0800 (PST) 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=torIaowc+t3sQS4BvpNAWoZkpZUOsV4DuZCCGLyN7aQ=; b=W4idgvAgESTlEpPnDC8hKvHchhuVARVWQVLwmOdcNNdCo61R6G7WZEDTL+WiwT0xtS ab48p62kHdkBsKR46fS9kS8KtCPZ8ijTQJneLtq2qNe4qIbj6rdwBElqg7t+Y6A3NFdc AyRSviqP6b9XodgoEkNNk2rMsBb4T91KiwdFY= 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=torIaowc+t3sQS4BvpNAWoZkpZUOsV4DuZCCGLyN7aQ=; b=olxUrs2D9O3dQFu4SAkcPnAJgDJc9RJhLjVP1QmOXgxxxIrw1FsU4S5+SE1ryFUt4f uzttnFwtWTwc94/pUnnqcPki+HB9385JIlh8aQu+R3otjbSU9K7ZhfuQUv9bvhzKI/WW c6ZNJT6qgGcuEB4Q5OzCq6rUCncqTVtDcrWSDGNuFI62VPDDjqlyCJF8YOqxP14qbARO IL/1GYIMQP/Rovj2CThmgNw8VKMKqiiR27uSC0IESV7xzETtg+t28itwWq5D0zeEYY0I XJzIyOtqcu9vR2Sj5O1VUy5SIYwg6RuC67oREtpJALmW0AdnNWtDfYS+Wn0oUPG5Wd2J EMuA== X-Gm-Message-State: APjAAAVtClujhKLUZ8+40Q1dgBVXn4bJ7gQ2IxjVmTM+6HXsJUWBi3IM DMVFH3lnALATHYaT3/ts805A8lZSR7Y= X-Received: by 2002:ae9:e883:: with SMTP id a125mr6501255qkg.366.1581867288079; Sun, 16 Feb 2020 07:34:48 -0800 (PST) Received: from fedora.pebenito.net (pool-108-15-23-247.bltmmd.fios.verizon.net. [108.15.23.247]) by smtp.gmail.com with ESMTPSA id l25sm7252405qkk.115.2020.02.16.07.34.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 16 Feb 2020 07:34:47 -0800 (PST) Subject: Re: memlockd To: russell@coker.com.au, "selinux-refpolicy@vger.kernel.org" References: <1920940.Lkz1Kncxd7@xev> From: Chris PeBenito Message-ID: <109b4ae6-a8b4-7bc8-8a20-8edfc838ac2f@ieee.org> Date: Sun, 16 Feb 2020 10:30:13 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <1920940.Lkz1Kncxd7@xev> Content-Type: text/plain; charset=windows-1252; 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 2/11/20 10:34 PM, Russell Coker wrote: > The attach patch adds policy for memlockd, this is a daemon that locks > important programs and config files into RAM so that if the system is paging > heavily the sysadmin still has a good chance of being able to login to > diagnose problems. Please inline patch and add signed-off-by. > --- /dev/null > +++ refpolicy-2.20200209/policy/modules/services/memlockd.te > @@ -0,0 +1,42 @@ > +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 }; > +allow memlockd_t self:fifo_file rw_file_perms; > +allow memlockd_t self:unix_dgram_socket { create connect }; > + > +# cache /etc/shadow too > +auth_read_shadow(memlockd_t) > +auth_map_shadow(memlockd_t) > + > +sysnet_map_config(memlockd_t) > +files_read_etc_files(memlockd_t) > + > +# for ldd > +corecmd_exec_bin(memlockd_t) > +corecmd_exec_shell(memlockd_t) > + > +libs_exec_ld_so(memlockd_t) > + > +corecmd_search_bin(memlockd_t) > +files_map_etc_files(memlockd_t) > +# has to exec for ldd > +corecmd_exec_all_executables(memlockd_t) I would guess this is doing mmap_exec but not execute_no_trans. > +corecmd_read_all_executables(memlockd_t) > + > +logging_send_syslog_msg(memlockd_t) > + > +miscfiles_read_localization(memlockd_t) > + > Index: refpolicy-2.20200209/policy/modules/system/sysnetwork.if > =================================================================== > --- refpolicy-2.20200209.orig/policy/modules/system/sysnetwork.if > +++ refpolicy-2.20200209/policy/modules/system/sysnetwork.if > @@ -366,6 +366,31 @@ interface(`sysnet_read_config',` > > ####################################### > ## > +## map network config files. > +## > +## > +##

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

> +##
> +## > +## > +## Domain allowed access. > +## > +## > +# > +interface(`sysnet_map_config',` Please change name to sysnet_mmap_read_config(). > + gen_require(` > + type net_conf_t; > + ') > + > + files_search_etc($1) > + allow $1 net_conf_t:file { read_file_perms map }; > +') > + -- Chris PeBenito