SELinux Security Module development
 help / color / mirror / Atom feed
From: Dominick Grift <dominick.grift@defensec.nl>
To: selinux@vger.kernel.org
Subject: Re: possible regression with filecon equivalency
Date: Thu, 29 May 2025 16:28:59 +0200	[thread overview]
Message-ID: <87a56vtrro.fsf@defensec.nl> (raw)
In-Reply-To: <87ecw7ts9b.fsf@defensec.nl> (Dominick Grift's message of "Thu, 29 May 2025 16:18:24 +0200")

Dominick Grift <dominick.grift@defensec.nl> writes:

In case its not clear. To clarify. I treat /usr/sbin like /usr/bin this
works fine. until it gets nested:

/fooroot / # treat /fooroot like / (works)
/fooroot/usr/sbin /usr/bin # treat /fooroot/usr/sbin like /usr/bin (no
longer works but use to work)

So now /fooroot/usr/sbin gets a label the equivalent of /usr because it
ignores to /fooroot/usr/sbin /usr/bin equivalency rule.

I hope that clears it up. I rely on this functionality.

> Dominick Grift <dominick.grift@defensec.nl> writes:
>
> example was too simple. Its more complicated:
>
> root@nimbus:~# matchpathcon -m dir /
> /       sys.id:sys.role:root.file:s0
> root@nimbus:~# matchpathcon -m dir /blaroot
> /blaroot        sys.id:sys.role:unknown.file:s0
> root@nimbus:~# matchpathcon -m dir /usr/bin
> /usr/bin        sys.id:sys.role:exec.file:s0
> root@nimbus:~# matchpathcon -m dir /usr/sbin
> /usr/sbin       sys.id:sys.role:exec.file:s0
> root@nimbus:~# cat >> /etc/selinux/dssp5-debian/contexts/files/file_contexts.subs_dist <<'EOF'
>> /blaroot /
>> /blaroot/usr/sbin /usr/bin
>> EOF
> root@nimbus:~# matchpathcon -m dir /
> /       sys.id:sys.role:root.file:s0
> root@nimbus:~# matchpathcon -m dir /blaroot
> /blaroot        sys.id:sys.role:root.file:s0
> root@nimbus:~# matchpathcon -m dir /usr/bin
> /usr/bin        sys.id:sys.role:exec.file:s0
> root@nimbus:~# matchpathcon -m dir /usr/sbin
> /usr/sbin       sys.id:sys.role:exec.file:s0
> root@nimbus:~# matchpathcon -m dir /blaroot/usr/sbin
> /blaroot/usr/sbin       sys.id:sys.role:data.file:s0
>
>> This worked a while ago:
>>
>> root@nimbus:~# cat >> /etc/selinux/dssp5-debian/contexts/files/file_contexts.subs_dist <<'EOF'
>>> /foo /usr/bin
>>> /sysroot/foo /usr/bin
>>> EOF
>>
>> root@nimbus:~# matchpathcon -m dir /usr/bin
>> /usr/bin        sys.id:sys.role:exec.file:s0
>> root@nimbus:~# matchpathcon -m dir /foo
>> /foo    sys.id:sys.role:exec.file:s0
>> root@nimbus:~# matchpathcon -m dir /sysroot/foo
>> /sysroot/foo    sys.id:sys.role:unknown.file:s0
>>
>> What happened?

-- 
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

  reply	other threads:[~2025-05-29 14:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-29 14:03 possible regression with filecon equivalency Dominick Grift
2025-05-29 14:18 ` Dominick Grift
2025-05-29 14:28   ` Dominick Grift [this message]
2025-05-29 16:14 ` Petr Lautrbach

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=87a56vtrro.fsf@defensec.nl \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox