Answers: <p>I think that the statment "to store the Vault's data in TPM" is <em>not</em> valid.  The TPM is generally not for storage.  There are some slots for storing some values and likely some persitent keys, but it is only a handful. I think TPM 2.0 maybe has more storage than 1.2, which I'm more familiar with, but it is <em>not</em> a storage device.  It really depends on what and how much of it you need to store.</p>
  
  <p>So while there might be a solution using "on-chip" TPM memory, it is scarce and really slow. The more common pattern is the use the TPM to wrap the keys or data, such that it can be stored in an encrypted blob on actual storage, like disk or network, and only safely unwrapped on THAT MACHINE.</p>
  
  <p>The TPM is not really a "crypto co-processor" nor is it a storage device. It's slow and has minimal resources, for cost.</p>
  
  <p>Having clarified that, it probably is valid to use the TPM, in the proper way, to help securely store the application data, it just depends on how much work it is for you.</p>
  
  <p>Also, if the data doesn't need to be specifically tied to that specific machine, or that specific container, or the installation is on a VM, and the VM might spin up on different hardware, then using the TPM doesn't really make sense because it is a root-of-trust for a specific platform, a specific board or machine.</p>
  
  <p>So to be semantically picky:</p>
  
  <ol>
  <li>Storing the Vault data <strong><em>in</em></strong> the TPM: not valid </li>
  <li>Storing the Vault data <strong><em>with</em></strong> the TPM: valid (potentially)</li>
  </ol>
  
  <p>Disclaimer:  I don't know anything about Vault or the data you want to store.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-11-25T18:30:00.680Z
Answers: 2019-11-25T18:53:33.403Z
Answers: 2019-11-25T18:53:33.403Z
Answers: Wilbur Whateley
Body: <p>I want to implement Vault as part of the DevOps build pipeline to store all the secrets like passwords and certificates. I understand that Vault keeps the data encrypted but <strong>I have been asked to look for a way to store the Vault's data in TPM as &quot;it would be more secure and temper-protected&quot;. First off, is this argument valid?</strong> Vault already stores the encrypted data so is this additional layer of encryption really needed?</p>
  <p>I read the Hashicorp's <a href="https://www.vaultproject.io/docs/configuration/storage/index.html" rel="nofollow noreferrer">Vault Storage Documentation</a> and it does not directly support any storage over TPM but if I could mount TPM on the container then I could probably use <code>filesystem</code> storage to store data inside it.</p>
  <p>So, is it possible to mount the host system's Trusted Platform Module (TPM) onto a docker container?</p>
  
Comments: CC BY-SA 4.0
Comments: 2019-11-25T18:32:10.690Z
Comments: I think you have two questions: 1) is this usage of the TPM valid and 2) how to access it from Docker.  I posted an answer for the first.  I landed here looking for the answer to #2.
Comments: Wilbur Whateley
Comments: CC BY-SA 4.0
Comments: 2019-11-25T18:57:47.147Z
Comments: Found some comments here https://lwn.net/Articles/768419/.  Not an answer, but relevant to TPM on Linux:  "One of the many issues (James) Bottomley has with this is that the daemon is a natural point of attack for anyone looking to run off with TPM secrets. For his day job, which is running containers in the cloud, the design is completely unacceptable: cloud tenants will not tolerate "anything daft in security terms", and a single daemon through which the secrets of all the system's tenants pass is certainly that." This is mostly a TPM 1.2 comment.
Comments: Wilbur Whateley
Tags: <docker><containers><security>
Title: Accessing TPM from inside a Docker Container
UserDisplayName: 7_R3X
ThreadText: # Accessing TPM from inside a Docker Container
  
  (Asked by: username_0 on 2019-07-01)
  
  I want to implement Vault as part of the DevOps build pipeline to store all the secrets like passwords and certificates. I understand that Vault keeps the data encrypted but **I have been asked to look for a way to store the Vault's data in TPM as "it would be more secure and temper-protected". First off, is this argument valid?** Vault already stores the encrypted data so is this additional layer of encryption really needed?
  
  I read the Hashicorp's [Vault Storage Documentation](https://www.vaultproject.io/docs/configuration/storage/index.html) and it does not directly support any storage over TPM but if I could mount TPM on the container then I could probably use `filesystem` storage to store data inside it.
  
  So, is it possible to mount the host system's Trusted Platform Module (TPM) onto a docker container?
  
  **Tags:** docker, containers, security
  
  > **Comments:**
  > **username_1**: I think you have two questions: 1) is this usage of the TPM valid and 2) how to access it from Docker.  I posted an answer for the first.  I landed here looking for the answer to #2.  
  > **username_1**: Found some comments here https://lwn.net/Articles/768419/.  Not an answer, but relevant to TPM on Linux:  "One of the many issues (James) Bottomley has with this is that the daemon is a natural point of attack for anyone looking to run off with TPM secrets. For his day job, which is running containers in the cloud, the design is completely unacceptable: cloud tenants will not tolerate "anything daft in security terms", and a single daemon through which the secrets of all the system's tenants pass is certainly that." This is mostly a TPM 1.2 comment.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-11-25. Score: 3
  
  I think that the statment "to store the Vault's data in TPM" is *not* valid. The TPM is generally not for storage. There are some slots for storing some values and likely some persitent keys, but it is only a handful. I think TPM 2.0 maybe has more storage than 1.2, which I'm more familiar with, but it is *not* a storage device. It really depends on what and how much of it you need to store.
  
  So while there might be a solution using "on-chip" TPM memory, it is scarce and really slow. The more common pattern is the use the TPM to wrap the keys or data, such that it can be stored in an encrypted blob on actual storage, like disk or network, and only safely unwrapped on THAT MACHINE.
  
  The TPM is not really a "crypto co-processor" nor is it a storage device. It's slow and has minimal resources, for cost.
  
  Having clarified that, it probably is valid to use the TPM, in the proper way, to help securely store the application data, it just depends on how much work it is for you.
  
  Also, if the data doesn't need to be specifically tied to that specific machine, or that specific container, or the installation is on a VM, and the VM might spin up on different hardware, then using the TPM doesn't really make sense because it is a root-of-trust for a specific platform, a specific board or machine.
  
  So to be semantically picky:
  
  1. Storing the Vault data ***in*** the TPM: not valid
  2. Storing the Vault data ***with*** the TPM: valid (potentially)
  
  Disclaimer: I don't know anything about Vault or the data you want to store.
  
  
  ---
  
  