rcreate.rst.inc 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. .. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!
  2. .. _borg_rcreate:
  3. borg rcreate
  4. ------------
  5. .. code-block:: none
  6. borg [common options] rcreate [options]
  7. .. only:: html
  8. .. class:: borg-options-table
  9. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  10. | **optional arguments** |
  11. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  12. | | ``--other-repo SRC_REPOSITORY`` | reuse the key material from the other repository |
  13. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | | ``-e MODE``, ``--encryption MODE`` | select encryption key mode **(required)** |
  15. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | | ``--append-only`` | create an append-only mode repository. Note that this only affects the low level structure of the repository, and running `delete` or `prune` will still be allowed. See :ref:`append_only_mode` in Additional Notes for more details. |
  17. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | | ``--storage-quota QUOTA`` | Set storage quota of the new repository (e.g. 5G, 1.5T). Default: no quota. |
  19. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | | ``--make-parent-dirs`` | create the parent directories of the repository directory, if they are missing. |
  21. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | | ``--key-algorithm`` | the algorithm we use to derive a key encryption key from your passphrase. Default: argon2 |
  23. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | .. class:: borg-common-opt-ref |
  25. | |
  26. | :ref:`common_options` |
  27. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. .. raw:: html
  29. <script type='text/javascript'>
  30. $(document).ready(function () {
  31. $('.borg-options-table colgroup').remove();
  32. })
  33. </script>
  34. .. only:: latex
  35. optional arguments
  36. --other-repo SRC_REPOSITORY reuse the key material from the other repository
  37. -e MODE, --encryption MODE select encryption key mode **(required)**
  38. --append-only create an append-only mode repository. Note that this only affects the low level structure of the repository, and running `delete` or `prune` will still be allowed. See :ref:`append_only_mode` in Additional Notes for more details.
  39. --storage-quota QUOTA Set storage quota of the new repository (e.g. 5G, 1.5T). Default: no quota.
  40. --make-parent-dirs create the parent directories of the repository directory, if they are missing.
  41. --key-algorithm the algorithm we use to derive a key encryption key from your passphrase. Default: argon2
  42. :ref:`common_options`
  43. |
  44. Description
  45. ~~~~~~~~~~~
  46. This command creates a new, empty repository. A repository is a filesystem
  47. directory containing the deduplicated data from zero or more archives.
  48. Encryption mode TLDR
  49. ++++++++++++++++++++
  50. The encryption mode can only be configured when creating a new repository - you can
  51. neither configure it on a per-archive basis nor change the mode of an existing repository.
  52. This example will likely NOT give optimum performance on your machine (performance
  53. tips will come below):
  54. ::
  55. borg rcreate --encryption repokey-aes-ocb
  56. Borg will:
  57. 1. Ask you to come up with a passphrase.
  58. 2. Create a borg key (which contains some random secrets. See :ref:`key_files`).
  59. 3. Derive a "key encryption key" from your passphrase
  60. 4. Encrypt and sign the key with the key encryption key
  61. 5. Store the encrypted borg key inside the repository directory (in the repo config).
  62. This is why it is essential to use a secure passphrase.
  63. 6. Encrypt and sign your backups to prevent anyone from reading or forging them unless they
  64. have the key and know the passphrase. Make sure to keep a backup of
  65. your key **outside** the repository - do not lock yourself out by
  66. "leaving your keys inside your car" (see :ref:`borg_key_export`).
  67. For remote backups the encryption is done locally - the remote machine
  68. never sees your passphrase, your unencrypted key or your unencrypted files.
  69. Chunking and id generation are also based on your key to improve
  70. your privacy.
  71. 7. Use the key when extracting files to decrypt them and to verify that the contents of
  72. the backups have not been accidentally or maliciously altered.
  73. Picking a passphrase
  74. ++++++++++++++++++++
  75. Make sure you use a good passphrase. Not too short, not too simple. The real
  76. encryption / decryption key is encrypted with / locked by your passphrase.
  77. If an attacker gets your key, he can't unlock and use it without knowing the
  78. passphrase.
  79. Be careful with special or non-ascii characters in your passphrase:
  80. - Borg processes the passphrase as unicode (and encodes it as utf-8),
  81. so it does not have problems dealing with even the strangest characters.
  82. - BUT: that does not necessarily apply to your OS / VM / keyboard configuration.
  83. So better use a long passphrase made from simple ascii chars than one that
  84. includes non-ascii stuff or characters that are hard/impossible to enter on
  85. a different keyboard layout.
  86. You can change your passphrase for existing repos at any time, it won't affect
  87. the encryption/decryption key or other secrets.
  88. Choosing an encryption mode
  89. +++++++++++++++++++++++++++
  90. Depending on your hardware, hashing and crypto performance may vary widely.
  91. The easiest way to find out about what's fastest is to run ``borg benchmark cpu``.
  92. `repokey` modes: if you want ease-of-use and "passphrase" security is good enough -
  93. the key will be stored in the repository (in ``repo_dir/config``).
  94. `keyfile` modes: if you rather want "passphrase and having-the-key" security -
  95. the key will be stored in your home directory (in ``~/.config/borg/keys``).
  96. The following table is roughly sorted in order of preference, the better ones are
  97. in the upper part of the table, in the lower part is the old and/or unsafe(r) stuff:
  98. .. nanorst: inline-fill
  99. +-----------------------------------+--------------+----------------+--------------------+---------+
  100. | Mode (K = keyfile or repokey) | ID-Hash | Encryption | Authentication | V >= |
  101. +-----------------------------------+--------------+----------------+--------------------+---------+
  102. | K-blake2-chacha20-poly1305 | BLAKE2b | CHACHA20 | POLY1305 | 2.0 |
  103. +-----------------------------------+--------------+----------------+--------------------+---------+
  104. | K-chacha20-poly1305 | HMAC-SHA-256 | CHACHA20 | POLY1305 | 2.0 |
  105. +-----------------------------------+--------------+----------------+--------------------+---------+
  106. | K-blake2-aes-ocb | BLAKE2b | AES256-OCB | AES256-OCB | 2.0 |
  107. +-----------------------------------+--------------+----------------+--------------------+---------+
  108. | K-aes-ocb | HMAC-SHA-256 | AES256-OCB | AES256-OCB | 2.0 |
  109. +-----------------------------------+--------------+----------------+--------------------+---------+
  110. | K-blake2 | BLAKE2b | AES256-CTR | BLAKE2b | 1.1 |
  111. +-----------------------------------+--------------+----------------+--------------------+---------+
  112. | K | HMAC-SHA-256 | AES256-CTR | HMAC-SHA256 | any |
  113. +-----------------------------------+--------------+----------------+--------------------+---------+
  114. | authenticated-blake2 | BLAKE2b | none | BLAKE2b | 1.1 |
  115. +-----------------------------------+--------------+----------------+--------------------+---------+
  116. | authenticated | HMAC-SHA-256 | none | HMAC-SHA256 | 1.1 |
  117. +-----------------------------------+--------------+----------------+--------------------+---------+
  118. | none | SHA-256 | none | none | any |
  119. +-----------------------------------+--------------+----------------+--------------------+---------+
  120. .. nanorst: inline-replace
  121. `none` mode uses no encryption and no authentication. You're advised to NOT use this mode
  122. as it would expose you to all sorts of issues (DoS, confidentiality, tampering, ...) in
  123. case of malicious activity in the repository.
  124. If you do **not** want to encrypt the contents of your backups, but still want to detect
  125. malicious tampering use an `authenticated` mode. It's like `repokey` minus encryption.
  126. Key derivation functions
  127. ++++++++++++++++++++++++
  128. - ``--key-algorithm argon2`` is the default and is recommended.
  129. The key encryption key is derived from your passphrase via argon2-id.
  130. Argon2 is considered more modern and secure than pbkdf2.
  131. Our implementation of argon2-based key algorithm follows the cryptographic best practices:
  132. - It derives two separate keys from your passphrase: one to encrypt your key and another one
  133. to sign it. ``--key-algorithm pbkdf2`` uses the same key for both.
  134. - It uses encrypt-then-mac instead of encrypt-and-mac used by ``--key-algorithm pbkdf2``
  135. Neither is inherently linked to the key derivation function, but since we were going
  136. to break backwards compatibility anyway we took the opportunity to fix all 3 issues at once.