From: David Howells <dhowells@redhat.com>
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
raven@themaw.net, keyrings@vger.kernel.org,
linux-security-module@vger.kernel.org
Subject: Re: LSM hook for mount, superblock and keys watch notifications
Date: Wed, 01 Aug 2018 23:50:53 +0100 [thread overview]
Message-ID: <19025.1533163853@warthog.procyon.org.uk> (raw)
In-Reply-To: <83894922-c126-3648-d2f5-191256111718@schaufler-ca.com>
Casey Schaufler <casey@schaufler-ca.com> wrote:
> This looks like it will solve the problem for security modules.
> I still think there should be some sort of default controls.
The control for keyrings is that you have to have View permission on the thing
you want to set a watchpoint on.
For mount topology changes, everyone can see everything in their namespace
anyway just by repeatedly parsing /proc/mounts or similar. Whether or not
this is a good idea...
Superblocks - some of the things generated here *shouldn't* be hidden - EIO
for example.
> The idea that the default is that anyone can listen for everyone's
> events, and there's no way to control it does not sit well.
> You could implement that as a security module with the one hook
> that does UID based controls, but I don't see a lot of advantages
> to doing it that way. At the least a process should be able to hide
> the events it would generate from everyone.
That's tricky. Some of the events aren't actually generated directly by a
process stepping on a trigger - EIO for example. Further, none of the
interfaces available have a "don't notify" button. Now I can add one to
move_mount() and fsmount(), but not write() (which might cause EDQUOT or
ENOSPC errors that we might want to know about irrespective of what the user
wants).
> Better would be to have a specification (e.g. mod bits, an ACL) for who
> should receive them.
How does one attach this, and to where? It doesn't belong to the watch queue,
it belongs to the watched object. It would also need attaching before the
object gets published.
If you're using fsopen(), you could attach it before doing fsmount() to set an
ACL on a superblock, I suppose:
fd = fsopen("ext4", 0);
fsconfig(fd, FSCONFIG_SET_NAMESPACE, "user", NULL, userns_fd);
fsconfig(fd, FSCONFIG_SET_SB_ACL, NULL, "0:pw,1000:w", 0);
fsconfig(fd, FSCONFIG_SET_PATH, "source", "/dev/sda1", AT_FDCWD);
fsconfig(fd, FSCONFIG_SET_FLAG, "acl", NULL, 0);
mfd = fsmount(0, 0);
where 0 and 1000 are uids and [pw] indicate pickability and watchability, with
the former allowing the use of fspick() with it:
fd = fspick(AT_FDCWD, "/mnt", 0);
or, even:
fd = fspick(0, "6f9553ab-7329-4998-bd5b-a5b4add9ad79",
FSPICK_OPEN_BY_UUID);
I'm not sure how you'd attach an ACL to mount objects, though. I guess
move_mount() would have to take a 6th parameter that's the ACL. You wouldn't
necessarily be able to use the same ACL for both mount and superblock because
of namespaces - it should be possible to have a superblock that's in multiple
user namespace (though it currently isn't).
David
prev parent reply other threads:[~2018-08-02 0:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-23 15:25 [RFC][PATCH 0/5] Mount, Filesystem and Keyrings notifications David Howells
2018-07-23 15:25 ` [PATCH 1/5] General notification queue with user mmap()'able ring buffer David Howells
2018-07-23 15:25 ` [PATCH 2/5] KEYS: Add a notification facility David Howells
2018-07-23 15:26 ` [PATCH 3/5] vfs: Add a mount-notification facility David Howells
2018-07-23 15:26 ` [PATCH 4/5] vfs: Add superblock notifications David Howells
2018-07-23 15:26 ` [PATCH 5/5] Add sample notification program David Howells
2018-07-23 16:31 ` [RFC][PATCH 0/5] Mount, Filesystem and Keyrings notifications Casey Schaufler
2018-07-24 0:37 ` Ian Kent
2018-07-24 16:00 ` David Howells
2018-07-24 18:57 ` Casey Schaufler
2018-07-25 5:39 ` Ian Kent
2018-07-25 15:48 ` Casey Schaufler
2018-07-26 1:18 ` Ian Kent
2018-07-26 16:09 ` Casey Schaufler
2018-07-24 19:22 ` David Howells
2018-08-01 21:04 ` LSM hook for mount, superblock and keys watch notifications David Howells
2018-08-01 21:49 ` Casey Schaufler
2018-08-01 22:50 ` David Howells [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=19025.1533163853@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=casey@schaufler-ca.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=raven@themaw.net \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).