README.rst 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. =================
  2. git-remote-gcrypt
  3. =================
  4. --------------------------------------
  5. GNU Privacy Guard-encrypted git remote
  6. --------------------------------------
  7. :Manual section: 1
  8. Description
  9. ===========
  10. Remote helper programs are invoked by git to handle network transport.
  11. This helper handles `gcrypt::` URLs that will access a remote repository
  12. encrypted with GPG, using our custom format.
  13. Supported locations are `local`, `rsync://` and `sftp://`, where the
  14. repository is stored as a set of files, or instead any `<giturl>` where
  15. gcrypt will store the same representation in a git repository, bridged
  16. over arbitrary git transport.
  17. The aim is to provide confidential, authenticated git storage and
  18. collaboration using typical untrusted file hosts or services.
  19. PLEASE help us evaluate how well we meet this design goal!
  20. .. NOTE:: This is a development version -- Repository format MAY CHANGE.
  21. Quickstart
  22. ..........
  23. * Install ``git-remote-gcrypt`` by running the supplied ``install.sh`` script.
  24. * Create an encrypted remote by pushing to it::
  25. git remote add cryptremote gcrypt::rsync://example.com:repo
  26. git push cryptremote master
  27. > gcrypt: Setting up new repository
  28. > gcrypt: Remote ID is :id:7VigUnLVYVtZx8oir34R
  29. > [ more lines .. ]
  30. > To gcrypt::[...]
  31. > * [new branch] master -> master
  32. Configuration
  33. =============
  34. The following ``git-config(1)`` variables are supported:
  35. ``remote.<name>.gcrypt-participants``
  36. ..
  37. ``gcrypt.participants``
  38. Space-separated list of GPG key identifiers. The remote is encrypted
  39. to these participants and only signatures from these are accepted.
  40. ``gpg -k`` lists all public keys you know.
  41. If this option is not set, we encrypt to your default key and accept
  42. any valid signature. This behavior can also be requested explicitly
  43. by setting participants to ``simple``.
  44. The ``gcrypt-participants`` setting on the remote takes precedence
  45. over the repository variable ``gcrypt.participants``.
  46. ``remote.<name>.gcrypt-publish-participants``
  47. ..
  48. ``gcrypt.publish-participants``
  49. By default, the gpg key ids of the participants are obscured by
  50. encrypting using `gpg -R`. Setting this option to `true` disables
  51. that security measure.
  52. The problem with using `gpg -R` is that to decrypt, gpg tries each
  53. available secret key in turn until it finds a usable key.
  54. This can result in unncessary passphrase prompts.
  55. ``remote.<name>.gcrypt-signingkey``
  56. ..
  57. ``user.signingkey``
  58. (The latter from regular git configuration) The key to use for signing.
  59. You should set ``user.signingkey`` if your default signing key is not
  60. part of the participant list. You may use the per-remote version
  61. to sign different remotes using different keys.
  62. Environment Variables
  63. =====================
  64. *GCRYPT_FULL_REPACK*
  65. This environment variable forces full repack when pushing.
  66. Examples
  67. ========
  68. How to set up a remote for two participants::
  69. git remote add cryptremote gcrypt::rsync://example.com:repo
  70. git config remote.cryptremote.gcrypt-participants "KEY1 KEY2"
  71. git push cryptremote master
  72. How to use a git backend::
  73. # notice that the target git repo must already exist and its
  74. # `next` branch will be overwritten!
  75. git remote add gitcrypt gcrypt::git@example.com:repo#next
  76. git push gitcrypt master
  77. The URL fragment (`#next` here) indicates which backend branch is used.
  78. Notes
  79. =====
  80. Collaboration
  81. The encryption of the manifest is updated for each push to match the
  82. participant configuration. Each pushing user must have the public
  83. keys of all collaborators and correct participant config.
  84. Dependencies
  85. ``rsync`` and ``curl`` for remotes ``rsync:`` and ``sftp:``
  86. respectively. The main executable requires a POSIX-compliant shell
  87. that supports ``local``.
  88. GNU Privacy Guard
  89. Both GPG 1.4 and 2 are supported. You need a personal GPG key. GPG
  90. configuration applies to algorithm choices for public-key
  91. encryption, symmetric encryption, and signing. See ``man gpg`` for
  92. more information.
  93. Remote ID
  94. The Remote ID is not secret; it only ensures that two repositories
  95. signed by the same user can be distinguished. You will see
  96. a warning if the Remote ID changes, which should only happen if the
  97. remote was re-created.
  98. Repository Format
  99. .................
  100. | `EncSign(X):` Sign and Encrypt to GPG key holder
  101. | `Encrypt(K,X):` Encrypt using symmetric-key algorithm
  102. | `Hash(X):` SHA-2/256
  103. |
  104. | `B:` branch list
  105. | `L:` list of the hash (`Hi`) and key (`Ki`) for each packfile
  106. | `R:` Remote ID
  107. |
  108. | To write the repository:
  109. |
  110. | Store each packfile `P` as `Encrypt(Ki, P)` → `P'` in filename `Hi`
  111. | where `Ki` is a new random string and `Hash(P')` → `Hi`
  112. | Store `EncSign(B || L || R)` in the manifest
  113. |
  114. | To read the repository:
  115. |
  116. | Get manifest, decrypt and verify using GPG keyring → `(B, L, R)`
  117. | Warn if `R` does not match previously seen Remote ID
  118. | for each `Hi, Ki` in `L`:
  119. | Get file `Hi` from the server → `P'`
  120. | Verify `Hash(P')` matches `Hi`
  121. | Decrypt `P'` using `Ki` → `P` then open `P` with git
  122. Manifest file
  123. .............
  124. Example manifest file (with ellipsis for brevity)::
  125. $ gpg -d 91bd0c092128cf2e60e1a608c31e92caf1f9c1595f83f2890ef17c0e4881aa0a
  126. 542051c7cd152644e4995bda63cc3ddffd635958 refs/heads/next
  127. 3c9e76484c7596eff70b21cbe58408b2774bedad refs/heads/master
  128. pack :SHA256:f2ad50316...cd4ba67092dc4 z8YoAnFpMlW...3PkI2mND49P1qm
  129. pack :SHA256:a6e17bb4c...426492f379584 82+k2cbiUn7...dgXfyX6wXGpvVa
  130. keep :SHA256:f2ad50316...cd4ba67092dc4 1
  131. repo :id:OYiSleGirtLubEVqJpFF
  132. Each item extends until newline, and matches one of the following:
  133. ``<sha-1> <gitref>``
  134. Git object id and its ref
  135. ``pack :<hashtype>:<hash> <key>``
  136. Packfile hash (`Hi`) and corresponding symmetric key (`Ki`).
  137. ``keep :<hashtype>:<hash> <generation>``
  138. Packfile hash and its repack generation
  139. ``repo <id>``
  140. The remote id
  141. ``extn <name> ...``
  142. Extension field, preserved but unused.
  143. Detecting gcrypt repos
  144. ======================
  145. To detect if a git url is a gcrypt repo, use: git-remote-gcrypt --check url
  146. Exit status if 0 if the repo exists and can be decrypted, 1 if the repo
  147. uses gcrypt but could not be decrypted, and 100 if the repo is not
  148. encrypted with gcrypt (or could not be accessed).
  149. Note that this has to fetch the repo contents into the local git
  150. repository, the same as is done when using a gcrypt repo.
  151. See Also
  152. ========
  153. git-remote-helpers(1), gpg(1)
  154. License
  155. =======
  156. This document and git-remote-gcrypt are licensed under identical terms,
  157. GPL-3 (or 2+), see the git-remote-gcrypt file.
  158. .. this document generates a man page with rst2man
  159. .. vim: ft=rst tw=72 sts=4