Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3354228imc; Wed, 13 Mar 2019 16:00:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOmU+xKf8vCVRUNjVoCgyB4OiXNQwLGZitamyI48fonlrJR88nzLi7hjq/U8BXcjuuaPLS X-Received: by 2002:a17:902:1621:: with SMTP id g30mr48040678plg.116.1552518013607; Wed, 13 Mar 2019 16:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552518013; cv=none; d=google.com; s=arc-20160816; b=BxXe0kUSHaCFjeAv8mkhaCmN4TmQEfsYUHgL6MnKIGtaaj9RRIYR5h6CRgbI5cZozL zl3e3rHqV3KE9pP90SvDM0eHRx+Zv3oCtVQJ3q8hm6rwza6aMoOpQCX4I6yvHSw/gr3j D6qLbHtnGbqpvGk7ZbJlUER3CGO3u6+fKgovqYVy8cLtcSeftQvZ6zU2PrgnybN2Gf0u vm5B0CO74wGojPPBGi5MCN3GxUVLUKwogoouryxY/FOnrXto39WiyGtilBsUF4gut/GR P6pU+m9WB/MrYTH/ep23SZI8aEDHEGgcyap3uA88fix2L01jmR84MTJRnQVoFOwSQy02 X5tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xbfyZUOydUrqr1xRHSnpwzHE4YcV6KizLFytu/aEMgk=; b=LHDuAyvhluafIl6f8NS9tvNMFO2e717k0kRN7+bcsf9cZMaMPazeGtNfFmgxpqm/ct tMVpYtw9OkPu6nb8TWLOd4t5ikXedsYmC4Ao1I1M72dE9aFVFN3Z/LDL2D+6EHeN17mD 1jINg2bpcykuUi9zbK6Iwck091okmkqn4lf/1oc8amr8Cmp6p6iOWs1AHaBkauq537YD vozM2MaJHD3YZ9p6uRI2HYENrdjJkvmvb5jzAgs/Ms1x7d9N0VFQM5BKyUOPfsAJxcPp 9BtcTP32jwlt7DEWBN7nj3ARR0mbjbx8nyvL64RZq8di/9Q0LT6iEUvplA0jT+y7BBdy mrnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="lt9XB/wJ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c24si11285003pgj.502.2019.03.13.15.59.57; Wed, 13 Mar 2019 16:00:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="lt9XB/wJ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbfCMW6U (ORCPT + 99 others); Wed, 13 Mar 2019 18:58:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:41264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725883AbfCMW6U (ORCPT ); Wed, 13 Mar 2019 18:58:20 -0400 Received: from gmail.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7CACE21019; Wed, 13 Mar 2019 22:58:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552517898; bh=2ahqxAgvfZGqlCeryB/iuAaGlSF0aUs1b7MGXuNWKyg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lt9XB/wJKnFDwzyJHNljLPkyXxWz8LkXF96MbFZG/gZ6x32ToTzb8GypgszUxGLbs +QInpBgBqyS0KkbXy23D6JpSs9dejuX7QCEFBNLMLCPc5DZO9nQ/l4091JqB0P1J9s DwKnFZTZT9xJysxOp/wRmx0HZo2GOVz/9cKuEQuY= Date: Wed, 13 Mar 2019 15:58:17 -0700 From: Eric Biggers To: James Bottomley Cc: Theodore Ts'o , Amir Goldstein , Richard Weinberger , Miklos Szeredi , linux-fsdevel , linux-fscrypt@vger.kernel.org, overlayfs , linux-kernel , Paul Lawrence Subject: Re: overlayfs vs. fscrypt Message-ID: <20190313225816.GG10169@gmail.com> References: <20190313164439.GF672@mit.edu> <1552499104.3022.44.camel@HansenPartnership.com> <20190313185826.GA4685@mit.edu> <1552504672.3022.59.camel@HansenPartnership.com> <20190313195713.GC10169@gmail.com> <1552507566.3022.65.camel@HansenPartnership.com> <20190313202519.GD10169@gmail.com> <1552511069.3022.77.camel@HansenPartnership.com> <20190313221325.GE10169@gmail.com> <1552516183.2808.14.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1552516183.2808.14.camel@HansenPartnership.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 13, 2019 at 03:29:43PM -0700, James Bottomley wrote: > On Wed, 2019-03-13 at 15:13 -0700, Eric Biggers wrote: > > On Wed, Mar 13, 2019 at 02:04:29PM -0700, James Bottomley wrote: > > > On Wed, 2019-03-13 at 13:25 -0700, Eric Biggers wrote: > > > > On Wed, Mar 13, 2019 at 01:06:06PM -0700, James Bottomley wrote: > > > > > On Wed, 2019-03-13 at 12:57 -0700, Eric Biggers wrote: > > > > > > [...] > > > > > > fscrypt would allow the data to be stored encrypted on the > > > > > > local disk, so it's protected against offline compromise of > > > > > > the disk. > > > > > > > > > > Container images are essentially tars of the overlays. They > > > > > only become actual filesystems when instantiated at > > > > > runtime. The current encrypted container image is an overlay > > > > > or set of overlays which is tarred then encrypted. So to > > > > > instantiate it is decrypted then untarred. > > > > > > > > > > The thing I was wondering about was whether instead of a tar > > > > > encrypt we could instead produce an encrypted image from a > > > > > fscrypt filesystem. > > > > > > > > > > > > > Why do you care whether the container image is encrypted on the > > > > local disk, when you're extracting it in plaintext onto the local > > > > disk anyway each time it runs? Even after the runtime files are > > > > "deleted", they may still be recoverable from the disk. Are you > > > > using shred and BLKSECDISCARD, and a non-COW filesystem? > > > > > > > > Now, if you wanted to avoid writing the plaintext to disk > > > > entirely (and thereby use encryption to actually achieve a useful > > > > security property that can't be achieved through file > > > > permissions), fscrypt is a good solution for that. > > > > > > OK let's start with a cloud and container 101: A container is an > > > exactly transportable IaaS environment containing an > > > application. The format for the exact transport is the "container > > > image" I've been describing (layered tar file set deployed with > > > overlays). These images are usually stored in cloud based > > > registries which may or may not have useful access controls. I > > > take it the reason for image encryption to protect confidentiality > > > within the registry is obvious. > > > > > > Because of the exact transport, the deployment may be on my laptop, > > > on my test system or in some type of public or private cloud. In > > > all cases bar the laptop, I won't actually own the physical system > > > which ends up deploying the container. So in exchange for security > > > guarantees from the physical system owner, I agree to turn over my > > > decryption key and possibly a cash payment. One of these > > > guarantees is usually that they shred the key after use and that > > > they deploy a useful key escrow system like vault or keyprotect to > > > guard it even while the decryption is being done. > > > > > > > Another is that all traces of the container be shredded after the > > > execution is finished. > > > > Well, sounds like that's not the case currently even with an > > encrypted container image, because the actual runtime files are not > > encrypted on disk. > > Shredding means destroying all trace including in the on-disk image. > However, one problem with the current implementation is there's a > window between container run and container stop where the unencrypted > files are in memory and on local disk. Access or cockup in that window > can leak confidential data. Well, another problem is that it almost certainly doesn't actually work, because some plaintext will still be recoverable from disk or the raw flash. Actually erasing data on modern filesystems and storage devices is extremely difficult. To start, you'd have to run BLKSECDISCARD on every single block ever written to disk to prepare the container, or written by the container during its execution. That's one reason to use storage encryption: it reduces the secure deletion problem to just erasing the encryption key. > > > Encrypting the runtime files using fscrypt with an ephemeral key > > would be useful here. IOW, randomly generate an encryption key when > > the container starts, never store it anywhere, and wipe it when the > > container stops. > > > > Note that this is separate from the container *image* encryption. > > Actually, that was my original thought: it needn't be. If fscrypt can > usefully add runtime security, then we could have the encrypted layer > be simply an fscrypt image ... I presume without the key we can create > a tar image of an fscrypt that is encrypted and would still be visible > on untar if we did have the key? So the encrypted layer would be a tar > of the fscrypt filesystem without the key. > fscrypt doesn't support backup and restore without the key, so no you can't do that. But there wouldn't be much benefit for doing it that way anyway, since you'd still have to untar the container image each time the container is started, then re-tar it each time the container is stopped. The container image could be an ext4 filesystem image containing an encrypted directory, in which case the container could be run directly from the image. But in that case, dm-crypt would be a better choice. > > > considering is could I be protected against either cloud provider > > > cockups that might leak the image (the misconfigured backup > > > scenario I suggested) or malicious actions of other tenants. > > > > If the container image is encrypted with a key not on the system, > > then its confidentiality is protected from anything that may happen > > on that system. > > > > But if the container image encryption key *is* on the system, your > > container image may be leaked either accidentally or maliciously. > > Well, yes, but that's like saying if you don't want to pick up a virus > from your network unplug it. We have to look at ways of deploying the > filesystem and the key such that it's hard to exfiltrate ... which > seems to be similar to your android fscrypt use case. > I am just stating the facts. Storage encryption only solves a specific set of problems, not every problem. There has already been a huge amount of effort into developing OS-level access control mechanisms in Linux, so fscrypt does not duplicate that; it just does storage encryption. - Eric