From: Jeff Layton <jlayton@kernel.org>
To: battery dude <jyf007@gmail.com>
Cc: Chuck Lever III <chuck.lever@oracle.com>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
"linux-security-module@vger.kernel.org"
<linux-security-module@vger.kernel.org>,
"selinux@vger.kernel.org" <selinux@vger.kernel.org>
Subject: Re: Does NFS support Linux Capabilities
Date: Thu, 08 Sep 2022 18:21:18 -0400 [thread overview]
Message-ID: <c57f48d346156b2ca1ac5e81ac3a9ec5e53fd7fd.camel@kernel.org> (raw)
In-Reply-To: <CAMBbDaEYWfcuf0bZkCFxaK=9zFVCuvMn1rtHcoP+axcF6BGtcA@mail.gmail.com>
Sorry if I wasn't clear, but my suggestion was very hypothetical. File
capabilities are not supported today and won't be for the for forseeable
future. Adding support for them would be a (non-trivial) project and I'm
not aware of anyone working on it.
-- Jeff
On Thu, 2022-09-08 at 16:43 -0500, battery dude wrote:
> According to this configure file
> CONFIG_NFSD_V4_SECURITY_LABEL=y
> is enabled
>
> Jeff Layton <jlayton@kernel.org> 于2022年9月8日周四 16:28写道:
> >
> > On Thu, 2022-09-08 at 21:17 +0000, Chuck Lever III wrote:
> > >
> > > > On Sep 8, 2022, at 5:03 PM, Jeff Layton <jlayton@kernel.org> wrote:
> > > >
> > > > On Thu, 2022-09-08 at 20:24 +0000, Chuck Lever III wrote:
> > > > > [ This question comes up on occasion, so I've added a few interested
> > > > > parties to the Cc: list ]
> > > > >
> > > > > > On Sep 8, 2022, at 8:27 AM, battery dude <jyf007@gmail.com> wrote:
> > > > > >
> > > > > > According to https://access.redhat.com/solutions/2117321 this article,
> > > > > > I want to ask, how to make NFS support the penetration of Linux
> > > > > > Capabilities
> > > > >
> > > > > That link is access-limited, so I was able to view only the top
> > > > > few paragraphs of it. Not very open, Red Hat.
> > > > >
> > > > > TL;DR: I looked into this while trying to figure out how to enable
> > > > > IMA on NFS files. It's difficult for many reasons.
> > > > >
> > > > >
> > > > > A few of these reasons include:
> > > > >
> > > > > The NFS protocol is a standard, and is implemented on a wide variety
> > > > > of OS platforms. Each OS implements its own flavor of capabilities.
> > > > > There's no way to translate amongst the variations to ensure
> > > > > interoperation. On Linux, capabilities(7) says:
> > > > >
> > > > > > No standards govern capabilities, but the Linux capability implementation is based on the withdrawn POSIX.1e draft standard; see ⟨https://archive.org/details/posix_1003.1e-990310⟩.
> > > > >
> > > > > I'm not sure how closely other implementations come to implementing
> > > > > POSIX.1e, but there are enough differences that interoperability
> > > > > could be a nightmare. Anything Linux has done differently than
> > > > > POSIX.1e would be encumbered by GPL, making it nearly impossible to
> > > > > standardize those differences. (Let alone the possible problems
> > > > > trying to cite a withdrawn POSIX standard in an Internet RFC!)
> > > > >
> > > > > The NFSv4 WG could invent our own capabilities scheme, just as was
> > > > > done with NFSv4 ACLs. I'm not sure everyone would agree that effort
> > > > > was 100% successful.
> > > > >
> > > > >
> > > > > Currently, an NFS server bases its access control choices on the
> > > > > RPC user that makes each request. We'd have to figure out a way to
> > > > > enable NFS clients and servers to communicate more than just user
> > > > > identity to enable access control via capabilities.
> > > > >
> > > > > When sending an NFS request, a client would have to provide a set
> > > > > of capabilities to the server so the server can make appropriate
> > > > > access control choices for that request.
> > > > >
> > > > > The server would have to report the updated capset when a client
> > > > > accesses and executes a file with capabilities, and the server
> > > > > would have to trust that its clients all respect those capsets
> > > > > correctly.
> > > > >
> > > > >
> > > > > Because capabilities are security-related, setting and retrieving
> > > > > capabilities should be done only over networks that ensure
> > > > > integrity of communication. So, protection via RPC-with-TLS or
> > > > > RPCSEC GSS with an integrity service ought to be a requirement
> > > > > both for setting and updating capabilities and for transmitting
> > > > > any protected file content. We have implementations, but there
> > > > > is always an option of not deploying this kind of protection
> > > > > when NFS is actually in use, making capabilities just a bit of
> > > > > security theater in those cases.
> > > > >
> > > > >
> > > > > Given these enormous challenges, who would be willing to pay for
> > > > > standardization and implementation? I'm not saying it can't or
> > > > > shouldn't be done, just that it would be a mighty heavy lift.
> > > > > But maybe other folks on the Cc: list have ideas that could
> > > > > make this easier than I believe it to be.
> > > > >
> > > > >
> > > >
> > > > I'm not disputing anything you wrote above, and I clearly haven't
> > > > thought through the security implications, but I wonder if we could
> > > > piggyback this info onto security label support somehow? That already
> > > > requires a (semi-opaque) per-inode attribute, which is mostly what's
> > > > required for file capabilities.
> > >
> > > That was the starting idea for accessing IMA metadata on NFS until
> > > we discovered that NFSv4 security labels are intended to enable only
> > > a single label per file. Capabilities are often present with SELinux
> > > labels.
> > >
> > > It would work for a proof of concept, though.
> > >
> >
> > Yeah, that why I was saying "piggyback".
> >
> > You'd need a combined SELinux+capabilities label (potentially with other
> > stuff in it as well). When you got one from the server, you'd have to
> > extract each piece and put in the right places in the inode.
> >
> > But, like I said...I haven't thought through the implications here at
> > all (and am not looking for a project at the moment). ;)
> > --
> > Jeff Layton <jlayton@kernel.org>
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2022-09-08 22:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAMBbDaF2Ni0gMRKNeFTQwgAOPPYy7RLXYwDJyZ1edq=tfATFzw@mail.gmail.com>
2022-09-08 20:24 ` Does NFS support Linux Capabilities Chuck Lever III
2022-09-08 21:03 ` Jeff Layton
2022-09-08 21:17 ` Chuck Lever III
2022-09-08 21:28 ` Jeff Layton
[not found] ` <CAMBbDaEYWfcuf0bZkCFxaK=9zFVCuvMn1rtHcoP+axcF6BGtcA@mail.gmail.com>
2022-09-08 22:21 ` Jeff Layton [this message]
2022-09-09 9:23 ` Theodore Ts'o
2022-09-09 13:13 ` J. Bruce Fields
2022-09-09 14:53 ` Chuck Lever III
2022-09-09 15:59 ` Casey Schaufler
2022-09-10 22:15 ` battery dude
2022-09-11 10:00 ` Theodore Ts'o
2022-09-12 4:03 ` Casey Schaufler
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=c57f48d346156b2ca1ac5e81ac3a9ec5e53fd7fd.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=jyf007@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).