SELinux-Refpolicy Archive on lore.kernel.org
 help / color / Atom feed
From: Chris PeBenito <pebenito@ieee.org>
To: "Sugar, David" <dsugar@tresys.com>,
	"selinux-refpolicy@vger.kernel.org" 
	<selinux-refpolicy@vger.kernel.org>
Subject: Re: [PATCH v3] Allow systemd to getattr all files
Date: Sat, 8 Feb 2020 09:41:56 -0500
Message-ID: <76882587-a7a3-a210-49fd-b3234441620e@ieee.org> (raw)
In-Reply-To: <20200123124037.969990-1-dsugar@tresys.com>

On 1/23/20 7:40 AM, Sugar, David wrote:
> Systemd has ConditionPath.*, ConditionFile.* and ConditionDir* which
> are used to check various path/file/directory to control starting a
> service.  But this requires getattr permissions on the types.
> Example denials that fit the problem.
> 
> The first example is from lvm where accessing config file.
> 
> type=AVC msg=audit(1575427946.229:1624): avc:  denied  { getattr } for
> pid=1 comm="systemd" path="/etc/lvm/lvm.conf" dev="dm-0" ino=51799
> scontext=system_u:system_r:init_t:s0
> tcontext=system_u:object_r:lvm_etc_t:s0 tclass=file permissive=0
> 
> This second example is from chronyd, but it is happening becuase I added
> the conditional in a drop-in file.
> 
> type=AVC msg=audit(1575427959.882:1901): avc:  denied  { getattr } for
> pid=1 comm="systemd" path="/etc/chrony.conf" dev="dm-0" ino=53824
> scontext=system_u:system_r:init_t:s0
> tcontext=system_u:object_r:chronyd_conf_t:s0 tclass=file permissive=1
> 
> v3 - rework to not use interface and allow getattr for all files
> 
> Signed-off-by: Dave Sugar <dsugar@tresys.com>
> ---
>   policy/modules/system/init.te | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te
> index 281d4fd2..c772ff40 100644
> --- a/policy/modules/system/init.te
> +++ b/policy/modules/system/init.te
> @@ -335,6 +335,11 @@ ifdef(`init_systemd',`
>   	domain_subj_id_change_exemption(init_t)
>   	domain_role_change_exemption(init_t)
>   
> +	files_getattr_all_dirs(init_t)
> +	files_getattr_all_files(init_t)
> +	files_getattr_all_pipes(init_t)
> +	files_getattr_all_sockets(init_t)
> +	files_read_all_symlinks(init_t)
>   	files_read_all_pids(init_t)
>   	files_list_usr(init_t)
>   	files_list_var(init_t)

Sorry for the delay. Merged.

-- 
Chris PeBenito

      parent reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23 12:40 Sugar, David
2020-01-30 14:40 ` Sugar, David
2020-02-08 14:41 ` Chris PeBenito [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76882587-a7a3-a210-49fd-b3234441620e@ieee.org \
    --to=pebenito@ieee.org \
    --cc=dsugar@tresys.com \
    --cc=selinux-refpolicy@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

SELinux-Refpolicy Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/selinux-refpolicy/0 selinux-refpolicy/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux-refpolicy selinux-refpolicy/ https://lore.kernel.org/selinux-refpolicy \
		selinux-refpolicy@vger.kernel.org
	public-inbox-index selinux-refpolicy

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux-refpolicy


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git