github.com/kobeld/docker@v1.12.0-rc1/docs/security/trust/trust_key_mng.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Manage keys for content trust"
     4  description = "Manage keys for content trust"
     5  keywords = ["trust, security, root,  keys, repository"]
     6  [menu.main]
     7  parent= "smn_content_trust"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # Manage keys for content trust
    12  
    13  Trust for an image tag is managed through the use of keys. Docker's content
    14  trust makes use of five different types of keys:
    15  
    16  | Key                 | Description                                                                                                                                                                                                                                                                                                                                                                         |
    17  |---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
    18  | root key         | Root of content trust for an image tag. When content trust is enabled, you create the root key once. Also known as the offline key, because it should be kept offline. |
    19  | targets          | This key allows you to sign image tags, to manage delegations including delegated keys or permitted delegation paths. Also known as the repository key, since this key determines what tags can be signed into an image repository. |
    20  | snapshot         | This key signs the current collection of image tags, preventing mix and match attacks.
    21  | timestamp        | This key allows Docker image repositories to have freshness security guarantees without requiring periodic content refreshes on the client's side. |
    22  | delegation       | Delegation keys are optional tagging keys and allow you to delegate signing image tags to other publishers without having to share your targets key. |
    23  
    24  When doing a `docker push` with Content Trust enabled for the first time, the
    25  root, targets, snapshot, and timestamp keys are generated automatically for
    26  the image repository:
    27  
    28  - The root and targets key are generated and stored locally client-side.
    29  
    30  - The timestamp and snapshot keys are safely generated and stored in a signing server
    31  	that is deployed alongside the Docker registry. These keys are generated in a backend
    32  	service that isn't directly exposed to the internet and are encrypted at rest.
    33  
    34  Delegation keys are optional, and not generated as part of the normal `docker`
    35  workflow.  They need to be
    36  [manually generated and added to the repository](trust_delegation.md#generating-delegation-keys).
    37  
    38  Note: Prior to Docker Engine 1.11, the snapshot key was also generated and stored
    39  locally client-side. [Use the Notary CLI to manage your snapshot key locally
    40  again](/notary/advanced_usage.md#rotate-keys) for
    41  repositories created with newer versions of Docker.
    42  
    43  ## Choosing a passphrase
    44  
    45  The passphrases you chose for both the root key and your repository key should
    46  be randomly generated and stored in a password manager.  Having the repository key
    47  allow users to sign image tags on a repository. Passphrases are used to encrypt
    48  your keys at rest and ensures that a lost laptop or an unintended backup doesn't
    49  put the private key material at risk.
    50  
    51  ## Back up your keys
    52  
    53  All the Docker trust keys are stored encrypted using the passphrase you provide
    54  on creation. Even so, you should still take care of the location where you back them up.
    55  Good practice is to create two encrypted USB keys.
    56  
    57  It is very important that you backup your keys to a safe, secure location. Loss
    58  of the repository key is recoverable; loss of the root key is not.
    59  
    60  The Docker client stores the keys in the `~/.docker/trust/private` directory.
    61  Before backing them up, you should `tar` them into an archive:
    62  
    63  ```bash
    64  $ umask 077; tar -zcvf private_keys_backup.tar.gz ~/.docker/trust/private; umask 022
    65  ```
    66  
    67  ## Hardware storage and signing
    68  
    69  Docker Content Trust can store and sign with root keys from a Yubikey 4. The
    70  Yubikey is prioritized over keys stored in the filesystem. When you initialize a
    71  new repository with content trust, Docker Engine looks for a root key locally. If a
    72  key is not found and the Yubikey 4 exists, Docker Engine creates a root key in the
    73  Yubikey 4. Please consult the [Notary documentation](/notary/advanced_usage.md#use-a-yubikey) for more details.
    74  
    75  Prior to Docker Engine 1.11, this feature was only in the experimental branch.
    76  
    77  ## Lost keys
    78  
    79  If a publisher loses keys it means losing the ability to sign trusted content for
    80  your repositories.  If you lose a key, contact [Docker
    81  Support](https://support.docker.com) (support@docker.com) to reset the repository
    82  state.
    83  
    84  This loss also requires **manual intervention** from every consumer that pulled
    85  the tagged image prior to the loss. Image consumers would get an error for
    86  content that they already downloaded:
    87  
    88  ```
    89  Warning: potential malicious behavior - trust data has insufficient signatures for remote repository docker.io/my/image: valid signatures did not meet threshold
    90  ```
    91  
    92  To correct this, they need to download a new image tag with that is signed with
    93  the new key.
    94  
    95  ## Related information
    96  
    97  * [Content trust in Docker](content_trust.md)
    98  * [Automation with content trust](trust_automation.md)
    99  * [Delegations for content trust](trust_delegation.md)
   100  * [Play in a content trust sandbox](trust_sandbox.md)