You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

signing.en-us.md 5.1 kB

Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631) This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however. ## Features - [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.) - [x] Verify commits signed with the default gpg as valid - [x] Signer, Committer and Author can all be different - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon. - [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg - [x] Try to match the default key with a user on gitea - this is done at verification time - [x] Make things configurable? - app.ini configuration done - [x] when checking commits are signed need to check if they're actually verifiable too - [x] Add documentation I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
6 years ago
Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631) This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however. ## Features - [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.) - [x] Verify commits signed with the default gpg as valid - [x] Signer, Committer and Author can all be different - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon. - [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg - [x] Try to match the default key with a user on gitea - this is done at verification time - [x] Make things configurable? - app.ini configuration done - [x] when checking commits are signed need to check if they're actually verifiable too - [x] Add documentation I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
6 years ago
Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631) This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however. ## Features - [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.) - [x] Verify commits signed with the default gpg as valid - [x] Signer, Committer and Author can all be different - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon. - [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg - [x] Try to match the default key with a user on gitea - this is done at verification time - [x] Make things configurable? - app.ini configuration done - [x] when checking commits are signed need to check if they're actually verifiable too - [x] Add documentation I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
6 years ago
Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631) This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however. ## Features - [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.) - [x] Verify commits signed with the default gpg as valid - [x] Signer, Committer and Author can all be different - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon. - [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg - [x] Try to match the default key with a user on gitea - this is done at verification time - [x] Make things configurable? - app.ini configuration done - [x] when checking commits are signed need to check if they're actually verifiable too - [x] Add documentation I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
6 years ago
Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631) This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however. ## Features - [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.) - [x] Verify commits signed with the default gpg as valid - [x] Signer, Committer and Author can all be different - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon. - [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg - [x] Try to match the default key with a user on gitea - this is done at verification time - [x] Make things configurable? - app.ini configuration done - [x] when checking commits are signed need to check if they're actually verifiable too - [x] Add documentation I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. ---
  2. date: "2019-08-17T10:20:00+01:00"
  3. title: "GPG Commit Signatures"
  4. slug: "signing"
  5. weight: 20
  6. toc: false
  7. draft: false
  8. menu:
  9. sidebar:
  10. parent: "advanced"
  11. name: "GPG Commit Signatures"
  12. weight: 20
  13. identifier: "signing"
  14. ---
  15. # GPG Commit Signatures
  16. Gitea will verify GPG commit signatures in the provided tree by
  17. checking if the commits are signed by a key within the gitea database,
  18. or if the commit matches the default key for git.
  19. Keys are not checked to determine if they have expired or revoked.
  20. Keys are also not checked with keyservers.
  21. A commit will be marked with a grey unlocked icon if no key can be
  22. found to verify it. If a commit is marked with a red unlocked icon,
  23. it is reported to be signed with a key with an id.
  24. Please note: The signer of a commit does not have to be an author or
  25. committer of a commit.
  26. This functionality requires git >= 1.7.9 but for full functionality
  27. this requires git >= 2.0.0.
  28. ## Automatic Signing
  29. There are a number of places where Gitea will generate commits itself:
  30. * Repository Initialisation
  31. * Wiki Changes
  32. * CRUD actions using the editor or the API
  33. * Merges from Pull Requests
  34. Depending on configuration and server trust you may want Gitea to
  35. sign these commits.
  36. ## Installing and generating a GPG key for Gitea
  37. It is up to a server administrator to determine how best to install
  38. a signing key. Gitea generates all its commits using the server `git`
  39. command at present - and therefore the server `gpg` will be used for
  40. signing (if configured.) Administrators should review best-practices
  41. for gpg - in particular it is probably advisable to only install a
  42. signing secret subkey without the master signing and certifying secret
  43. key.
  44. ## General Configuration
  45. Gitea's configuration for signing can be found with the
  46. `[repository.signing]` section of `app.ini`:
  47. ```ini
  48. ...
  49. [repository.signing]
  50. SIGNING_KEY = default
  51. SIGNING_NAME =
  52. SIGNING_EMAIL =
  53. INITIAL_COMMIT = always
  54. CRUD_ACTIONS = pubkey, twofa, parentsigned
  55. WIKI = never
  56. MERGES = pubkey, twofa, basesigned, commitssigned
  57. ...
  58. ```
  59. ### `SIGNING_KEY`
  60. The first option to discuss is the `SIGNING_KEY`. There are three main
  61. options:
  62. * `none` - this prevents Gitea from signing any commits
  63. * `default` - Gitea will default to the key configured within
  64. `git config`
  65. * `KEYID` - Gitea will sign commits with the gpg key with the ID
  66. `KEYID`. In this case you should provide a `SIGNING_NAME` and
  67. `SIGNING_EMAIL` to be displayed for this key.
  68. The `default` option will interrogate `git config` for
  69. `commit.gpgsign` option - if this is set, then it will use the results
  70. of the `user.signingkey`, `user.name` and `user.email` as appropriate.
  71. Please note: by adjusting git's `config` file within Gitea's
  72. repositories, `SIGNING_KEY=default` could be used to provide different
  73. signing keys on a per-repository basis. However, this is clearly not an
  74. ideal UI and therefore subject to change.
  75. ### `INITIAL_COMMIT`
  76. This option determines whether Gitea should sign the initial commit
  77. when creating a repository. The possible values are:
  78. * `never`: Never sign
  79. * `pubkey`: Only sign if the user has a public key
  80. * `twofa`: Only sign if the user logs in with two factor authentication
  81. * `always`: Always sign
  82. Options other than `never` and `always` can be combined as a comma
  83. separated list.
  84. ### `WIKI`
  85. This options determines if Gitea should sign commits to the Wiki.
  86. The possible values are:
  87. * `never`: Never sign
  88. * `pubkey`: Only sign if the user has a public key
  89. * `twofa`: Only sign if the user logs in with two factor authentication
  90. * `parentsigned`: Only sign if the parent commit is signed.
  91. * `always`: Always sign
  92. Options other than `never` and `always` can be combined as a comma
  93. separated list.
  94. ### `CRUD_ACTIONS`
  95. This option determines if Gitea should sign commits from the web
  96. editor or API CRUD actions. The possible values are:
  97. * `never`: Never sign
  98. * `pubkey`: Only sign if the user has a public key
  99. * `twofa`: Only sign if the user logs in with two factor authentication
  100. * `parentsigned`: Only sign if the parent commit is signed.
  101. * `always`: Always sign
  102. Options other than `never` and `always` can be combined as a comma
  103. separated list.
  104. ### `MERGES`
  105. This option determines if Gitea should sign merge commits from PRs.
  106. The possible options are:
  107. * `never`: Never sign
  108. * `pubkey`: Only sign if the user has a public key
  109. * `twofa`: Only sign if the user logs in with two factor authentication
  110. * `basesigned`: Only sign if the parent commit in the base repo is signed.
  111. * `headsigned`: Only sign if the head commit in the head branch is signed.
  112. * `commitssigned`: Only sign if all the commits in the head branch to the merge point are signed.
  113. * `approved`: Only sign approved merges to a protected branch.
  114. * `always`: Always sign
  115. Options other than `never` and `always` can be combined as a comma
  116. separated list.
  117. ## Obtaining the Public Key of the Signing Key
  118. The public key used to sign Gitea's commits can be obtained from the API at:
  119. ```
  120. /api/v1/signing-key.gpg
  121. ```
  122. In cases where there is a repository specific key this can be obtained from:
  123. ```
  124. /api/v1/repos/:username/:reponame/signing-key.gpg
  125. ```