From: Dominick Grift <dominick.grift@defensec.nl>
To: Ian Pilcher <arequipeno@gmail.com>
Cc: SElinux list <selinux@vger.kernel.org>
Subject: Re: File access macros
Date: Sun, 14 Sep 2025 07:29:50 +0200 [thread overview]
Message-ID: <87frcpfvox.fsf@defensec.nl> (raw)
In-Reply-To: <78602e06-7db0-4e0c-9415-75098682e58a@gmail.com> (Ian Pilcher's message of "Sat, 13 Sep 2025 16:00:08 -0500")
Ian Pilcher <arequipeno@gmail.com> writes:
> I'm writing a policy module to allow containerized and non-containerized
> services to share content. (Basically to give container_t access to
> public_content_t and/or public_content_rw_t.)
>
> I don't normally make much use of SELinux policy macros, as the
> documentation seems to be rather difficult to find, scattered, and
> sometimes conflicting; instead I usually just use the denials generated
> by the program that I'm confining to determine exactly what access it
> needs.
>
> In this case, however, I'm trying to do something much more generic.
> I don't really know exactly what permissions a given containerized
> service might need, so I'm looking for a good, standard set of read-only
> and read/write permissions for files, directories, and symbolic links.
>
> It sure seems like this must be a solved problem. I.e. there must be
> something like this macro, which Google Gemini so helpfully
> hallucinated.
>
> fs_read_access(<domain_type>, <file_type>);
>
> Thus far, I've been completely unable to find anything like this.
>
> Am I wrong that macros like this exist?
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
--
gpg --locate-keys dominick.grift@defensec.nl (wkd)
Key fingerprint = FCD2 3660 5D6B 9D27 7FC6 E0FF DA7E 521F 10F6 4098
Dominick Grift
Mastodon: @kcinimod@defensec.nl
next prev parent reply other threads:[~2025-09-14 5:33 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 [this message]
2025-09-15 12:25 ` Stephen Smalley
2025-09-15 15:18 ` Ian Pilcher
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=87frcpfvox.fsf@defensec.nl \
--to=dominick.grift@defensec.nl \
--cc=arequipeno@gmail.com \
--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.