All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Pilcher <arequipeno@gmail.com>
To: Dominick Grift <dominick.grift@defensec.nl>
Cc: SElinux list <selinux@vger.kernel.org>
Subject: Re: File access macros
Date: Mon, 15 Sep 2025 10:18:24 -0500	[thread overview]
Message-ID: <04030abe-6caa-4f94-ae0e-b67af88fc1b1@gmail.com> (raw)
In-Reply-To: <87frcpfvox.fsf@defensec.nl>

On 9/14/25 12:29 AM, Dominick Grift wrote:
> I can give you an example of how the public content feature might be
> implemented with an example. the refpolicy ftp module:
> 
> There are two scenario's there:
> 
> 1. by default ftpd_t can read(only) public_content_t and public_content_rw_t
> dirs, files and symlinks:
> 
> https://github.com/SELinuxProject/refpolicy/blob/main/policy/modules/services/ftp.te#L251
> 
> This interface is defined here:
> 
> https://github.com/SELinuxProject/refpolicy/blob/main/policy/modules/system/miscfiles.if#L915
> 
> 2. write access to public_content_rw_t is conditional in this
> example (with a boolean):
> 
> https://github.com/SELinuxProject/refpolicy/blob/main/policy/modules/services/ftp.te#L16
> https://github.com/SELinuxProject/refpolicy/blob/main/policy/modules/services/ftp.te#L260
> 
> This interface is defined here:
> 
> https://github.com/SELinuxProject/refpolicy/blob/main/policy/modules/system/miscfiles.if#L937

I did finally find the miscfiles_read_public_files and
miscfiles_manage_public_files macros by looking at the Apache policy
module (apache.te), so I ended up with this simple module:

	policy_module(container-public-content, 0)

	require {
		type container_t;
	};

	bool container_read_public_content false;
	if container_read_public_content {
		miscfiles_read_public_files(container_t)
	}

	bool container_manage_public_content false;
	if container_manage_public_content {
		miscfiles_manage_public_files(container_t)
	}

Thanks!

-- 
========================================================================
If your user interface is intuitive in retrospect ... it isn't intuitive
========================================================================

      parent reply	other threads:[~2025-09-15 15:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-13 21:00 File access macros Ian Pilcher
2025-09-14  5:29 ` Dominick Grift
2025-09-15 12:25   ` Stephen Smalley
2025-09-15 15:18   ` Ian Pilcher [this message]

Reply instructions:

You may reply publicly 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=04030abe-6caa-4f94-ae0e-b67af88fc1b1@gmail.com \
    --to=arequipeno@gmail.com \
    --cc=dominick.grift@defensec.nl \
    --cc=selinux@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.