linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: lsf-pc@lists.linux-foundation.org,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [LSF/MM TOPIC] fs-verity: file system-level integrity protection
Date: Fri, 26 Jan 2018 09:58:56 -0500	[thread overview]
Message-ID: <20180126145856.GA2841@thunk.org> (raw)
In-Reply-To: <1516942235.4082.52.camel@HansenPartnership.com>

On Thu, Jan 25, 2018 at 08:50:35PM -0800, James Bottomley wrote:
> > Sorry, I meant PKCS7.��It would be a restricted PKCS7 mode, using a
> > detached signature.��My plan was to reuse the existing code we
> > already have written for signed kernel modules.
> 
> OK, so presumably the signature would be over the part of the tree at
> the end of the file (so the tree is already reduced to a hashable
> binary representation) and this is verified upon write, after which the
> hash tree is trusted.

The signature would cover the fs-verity header including the "root
hash" of the merkle tree (e.g., the hash of the first block of the
merkle tree), yes.

> 
> Currently container images are simple tar files and one of the main
> value adds of docker as a tool is the simplicity of the image creation
> process. �That process depends on standard tools like tar to create the
> image, so I was trying to fit this proposal into that process.

The goal of fs-verity is protect arbitrary files without breaking the
backwards compatibility of those that *read* the file.  So for
example, an APK file is downloaded and verified at the intial download
--- and never verified again.  It is *used* many times after the
initial download (and hence, potentially after an evil maid attack),
and this is done by many different tools, including by code inside the
APK itself.  So it is not feasible to change the tools that read the
APK, which means we can't make any backwards-incompatible changes to
the file itself.

However, changing the tools that *establish* the locally verified copy
is considered completely fair game.  I'll note that this is true no
matter what system you use.  If you are using IMA, after the file is
downloaded, you still have to set the magic "trusted xattr" (which, I
will note, requires root access since it is a trusted root access).
So you have to make at least *some* changes to the code path which
writes the file that you want to be integrity protected.  In the case
of IMA, this includes code that has to run as root.

For fs-verity, there would be a userspace library that would append
the fs-verity information, and then call the fs-verity ioctl to set up
the protection.  Since the data is self-verifying, due to the digital
signature, using setting the verity bit does not require root
privileges.  The kernel will check and make sure it is signed by a
trusted key, of course, but it will simply reject the attempt to
enable fs-verity if the cert is not present on a trusted keyring.

> OK, so that worries me a bit more. �I assume we could use this ioctl to
> recreate the file by extracting the tree and thence do a conversion to
> tar format so that the untarred file has the signed hash, but just
> doing a tar of the directory won't work, so docker save is going to
> have to be seriously altered to work with this.

Docker save was going to have to be altered to use IMA, anyway.  So I
don't see that as being any more difficult.  Whether you have to have
root to set the magic IMA trusted xattr, or you call a userspace
library, there isn't much difference between those two.

							- Ted

  reply	other threads:[~2018-01-26 14:59 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25 19:11 [LSF/MM TOPIC] fs-verity: file system-level integrity protection Theodore Ts'o
2018-01-25 21:49 ` Chuck Lever
2018-01-25 23:39   ` Theodore Ts'o
2018-01-26  0:47 ` James Bottomley
2018-01-26  2:30   ` Theodore Ts'o
2018-01-26  4:50     ` James Bottomley
2018-01-26 14:58       ` Theodore Ts'o [this message]
2018-01-26 16:44         ` [Lsf-pc] " James Bottomley
2018-01-26 21:55           ` Theodore Ts'o
2018-01-27  7:58             ` Andreas Dilger
2018-01-27 16:19               ` James Bottomley
2018-01-27 17:08                 ` James Bottomley
2018-01-28  2:46                 ` Theodore Ts'o
2018-01-28 17:19                   ` James Bottomley
2018-01-28 18:03                   ` James Bottomley
2018-01-28 18:19                     ` Chuck Lever
2018-01-29  6:39                       ` James Bottomley
2018-01-29 15:22                         ` Chuck Lever
2018-01-30  6:47                           ` James Bottomley
2018-01-28 21:49                     ` Theodore Ts'o
2018-01-28 22:49                       ` Theodore Ts'o
2018-01-28 23:04                       ` Mimi Zohar
2018-01-29  0:38                         ` Theodore Ts'o
2018-01-29  1:53                           ` Mimi Zohar
2018-01-29  2:38                             ` Theodore Ts'o
2018-01-29  3:39                               ` Mimi Zohar
2018-01-29  4:40                                 ` Theodore Ts'o
2018-01-29  4:50                                 ` Theodore Ts'o
2018-01-29 12:09                                   ` Mimi Zohar
2018-01-29 13:58                                     ` Mimi Zohar
2018-01-29 23:02                                     ` Theodore Ts'o
2018-01-30 23:25                                       ` Mimi Zohar
2018-01-31 16:05                                         ` Theodore Ts'o
2018-01-31 17:12                                           ` James Bottomley
2018-01-31 18:46                                             ` Theodore Ts'o
2018-01-31 20:41                                               ` James Bottomley
2018-02-01  0:03                                                 ` Theodore Ts'o
2018-02-01 23:04                                                   ` Dave Chinner
2018-02-01 23:43                                                     ` Andreas Dilger
2018-02-02  0:13                                                       ` Dave Chinner
2018-02-02  5:34                                                       ` James Bottomley
2018-02-02  2:40                                                     ` Theodore Ts'o
2018-02-02  9:05                                                       ` Dave Chinner
2018-01-31 20:40                                           ` Mimi Zohar
2018-01-31 22:00                                             ` Theodore Ts'o
2018-02-01 15:17                                               ` Mimi Zohar
2018-01-29  0:21                       ` James Bottomley
2018-01-29  1:03                         ` Theodore Ts'o
2018-01-29 21:21                           ` Andreas Dilger
2018-01-26 18:13         ` Mimi Zohar
2018-01-29 18:54   ` Michael Halcrow
2018-01-26  7:58 ` Colin Walters
2018-01-26 15:29   ` Theodore Ts'o
2018-01-26 16:40     ` Colin Walters
2018-01-26 16:49       ` [Lsf-pc] " James Bottomley
2018-01-26 17:05         ` Colin Walters
2018-01-26 17:54 ` Mimi Zohar
2018-02-02  0:02 ` Steve French
2018-02-07 13:04 ` David Gstir

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=20180126145856.GA2841@thunk.org \
    --to=tytso@mit.edu \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lsf-pc@lists.linux-foundation.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).