From: Dominick Grift <dominick.grift@defensec.nl>
To: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnacek <omosnace@redhat.com>,
Paul Moore <paul@paul-moore.com>,
selinux@vger.kernel.org
Subject: Re: cgroup2 labeling question
Date: Mon, 20 Mar 2023 19:19:47 +0100 [thread overview]
Message-ID: <878rfre14s.fsf@defensec.nl> (raw)
In-Reply-To: <CAEjxPJ4yUhU05ZY2-6RyisBv4CC8_-ahMWCuwB99rHR6vbKUGQ@mail.gmail.com> (Stephen Smalley's message of "Mon, 20 Mar 2023 14:15:40 -0400")
Stephen Smalley <stephen.smalley.work@gmail.com> writes:
> On Mon, Mar 20, 2023 at 1:53 PM Stephen Smalley
> <stephen.smalley.work@gmail.com> wrote:
>>
>> On Mon, Mar 20, 2023 at 1:28 PM Stephen Smalley
>> <stephen.smalley.work@gmail.com> wrote:
>> > Hmm...that's interesting. I just tried in Fedora using one of the
>> > type_transitions already defined in the default policy and although it
>> > appears to use the type_transition to compute the new SID for the
>> > create check, ls -Z of the file after creation showed it labeled
>> > cgroup_t instead. So it doesn't appear to be working or I am doing it
>> > wrong.
>>
>> Reproducer, on F34,
>> $ sudo mkdir /sys/fs/cgroup/system.slice/.snapshots
>> mkdir: cannot create directory
>> ‘/sys/fs/cgroup/system.slice/.snapshots’: Permission denied
>> $ sudo ausearch -m AVC -ts recent -i
>> ----
>> type=AVC msg=audit(03/20/2023 13:00:04.699:47156) : avc: denied {
>> associate } for pid=152325 comm=mkdir name=.snapshots
>> scontext=unconfined_u:object_r:snapperd_data_t:s0
>> tcontext=system_u:object_r:cgroup_t:s0 tclass=filesystem permissive=0
>> $ seinfo --fs_use | grep cgroup
>> $ seinfo --genfscon | grep cgroup
>> genfscon cgroup / system_u:object_r:cgroup_t:s0
>> genfscon cgroup2 / system_u:object_r:cgroup_t:s0
>> $ sesearch -T -s unconfined_t -t cgroup_t -c dir
>> type_transition unconfined_t cgroup_t:dir snapperd_data_t .snapshots
>> $ sudo setenforce 0
>> $ sudo mkdir /sys/fs/cgroup/system.slice/.snapshots
>> $ ls -Zd /sys/fs/cgroup/system.slice/.snapshots
>> system_u:object_r:cgroup_t:s0 /sys/fs/cgroup/system.slice/.snapshots
>
> Unless systemd is coming along after file creation and relabeling it
> to cgroup_t at that time.
That wouldnt make sense to me, but yes i considered that as well. Ruled
it out without actually confirming it. I actually added a rule:
auditallow domain cgroup_t:dir create;
and that also does not show grants for all the dirs in /sys/fs/cgroup
(just some)
voodoo
--
gpg --locate-keys dominick.grift@defensec.nl
Key fingerprint = FCD2 3660 5D6B 9D27 7FC6 E0FF DA7E 521F 10F6 4098
Dominick Grift
next prev parent reply other threads:[~2023-03-20 18:27 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 7:23 cgroup2 labeling question Dominick Grift
2023-03-20 13:35 ` Stephen Smalley
2023-03-20 13:57 ` Dominick Grift
2023-03-20 14:12 ` Ondrej Mosnacek
2023-03-20 14:19 ` Dominick Grift
2023-03-20 14:43 ` Dominick Grift
2023-03-20 14:46 ` Ondrej Mosnacek
2023-03-20 15:16 ` Stephen Smalley
2023-03-20 15:23 ` Dominick Grift
2023-03-20 16:32 ` Stephen Smalley
2023-03-20 16:37 ` Dominick Grift
2023-03-20 17:28 ` Stephen Smalley
2023-03-20 17:53 ` Stephen Smalley
2023-03-20 18:07 ` Dominick Grift
2023-03-20 18:22 ` Christian Göttsche
2023-03-20 20:23 ` Stephen Smalley
2023-03-21 13:40 ` Ondrej Mosnacek
2023-03-21 14:42 ` Dominick Grift
2023-03-22 17:07 ` Matthew Sheets
2023-03-22 17:15 ` Dominick Grift
2023-03-22 17:27 ` Stephen Smalley
2023-03-23 13:55 ` Matthew Sheets
2023-03-23 14:42 ` Matthew Sheets
2023-03-23 14:53 ` Dominick Grift
2023-03-23 16:56 ` Stephen Smalley
2023-03-20 18:15 ` Stephen Smalley
2023-03-20 18:19 ` Dominick Grift [this message]
2023-03-20 18:22 ` Stephen Smalley
2023-03-20 18:26 ` Dominick Grift
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=878rfre14s.fsf@defensec.nl \
--to=dominick.grift@defensec.nl \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
/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.