From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 85A74C76199 for ; Sun, 16 Feb 2020 15:34:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B19420857 for ; Sun, 16 Feb 2020 15:34:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="W4idgvAg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726171AbgBPPev (ORCPT ); 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-Google-Smtp-Source: APXvYqyEigDBVlz0V1tv8Y46duSon6owqjoNWtYfWHVHPOEZt8l0INtKJu9WNrI1Fm1groVpYVa42A== 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