From: Russell Coker <russell@coker.com.au>
To: Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: SELinux on btrfs
Date: Wed, 30 Apr 2014 18:01:07 +1000 [thread overview]
Message-ID: <3219639.10M590kytU@russell.coker.com.au> (raw)
In-Reply-To: <4DB89922-7B01-405A-9E63-0CCBBB6481B3@colorremedies.com>
On Sat, 12 Apr 2014 10:15:25 Chris Murphy wrote:
> > I'm already aware that SELinux's automatic labelling of files is not
> > aware of subvolumes[*].>
> > [*] https://wiki.debian.org/SELinux/Setup#btrfs
>
> I'm not sure exactly what it means since there is always a subvolume (ID 5),
> and I don't understand why autorelabel behavior would differ from manually
> running fixfiles or restorecon.
When you initially setup SE Linux on Debian you run the command "selinux-
activate" which configures GRUB and creates a 0 byte file named /.autorelabel .
On boot if /.autorelabel is detected (as it will on a first install of SE Linux
or any time you have a serious labelling problem you want to fix) then a script
will run that labels all files and reboots the system (to make daemons run with
the correct context). The script in question is not aware of subvolumes, so
if you have writable subvolumes they won't be labelled. So you just run
"restorecon -R /subvol" to fix it.
I'm not sure whether fixfiles stops at "mount points" which includes subvols,
restorecon -R shouldn't.
Note that I gave the full explanation for the lurkers.
> > I already have quite a few read-only snapshots that I don't want to
> > forfeit, however, I'm not at all sure how SELinux would interact with
> > them.
> If the default policy mismatches with the file context, the relabel or
> restorecon will want to change the context to the default, but won't be
> able to because it's a read-only subvolume. I merely get a non-fatal:
>
> restorecon set context /boot/.bootsnap/grub2->system_u:object_r:boot_t:s0
> failed:'Read-only file system'
>
> And it proceeds to the next file.
Those read-only files should have the type file_t and be readable by the
sysadmin. If you want a read-only filesystem that is correctly labelled you
can make a read-write snapshot, label it, and then make a read-only snapshot
of the new snapshot.
As an aside, BTRFS and SE Linux work really well together for me. Much better
than ZFS and SE Linux.
--
My Main Blog http://etbe.coker.com.au/
My Documents Blog http://doc.coker.com.au/
next prev parent reply other threads:[~2014-04-30 8:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-12 16:15 SELinux on btrfs Chris Murphy
2014-04-30 8:01 ` Russell Coker [this message]
2014-04-30 16:04 ` Chris Murphy
2014-05-02 1:51 ` Russell Coker
-- strict thread matches above, loose matches on Subject: below --
2014-04-01 14:50 Michael Schuerig
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=3219639.10M590kytU@russell.coker.com.au \
--to=russell@coker.com.au \
--cc=linux-btrfs@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