Debian Codegraph @

doc/sources/admin/applications/gerrit.rst

raw
1 Gerrit
2 ======
3
4 |image0|
5
6 Presentation
7 ------------
8
9 `Gerrit <https://www.gerritcodereview.com/>`__ allows to review commits before they are integrated into a target branch.
10
11 With the `OAuth2 provider plugin <https://gerrit.googlesource.com/plugins/oauth/>`__ Gerrit can use OAuth2 protocol for authentication.
12
13 Configuration
14 -------------
15
16 Gerrit
17 ------
18
19 `Install <https://gerrit-review.googlesource.com/Documentation/config-plugins.html#installation>`__ the OAuth Provider plugin. A prebuilt package of the plugin can be found on the `Gerrit CI <https://gerrit-ci.gerritforge.com/job/plugin-oauth-bazel-master-master/lastSuccessfulBuild/artifact/bazel-bin/plugins/oauth/oauth.jar>`__.
20
21 Then, configure Gerrit:
22
23 In ``/var/gerrit/etc/gerrit.config``
24
25 ::
26
27 ...
28 [auth]
29 type = OAUTH
30 gitBasicAuthPolicy = HTTP
31 ...
32 [plugin "gerrit-oauth-provider-lemonldap-oauth"]
33 root-url = https://auth.<LLNG_SERVER>
34 client-id = <GERRIT_CLIENT_ID>
35
36 In ``/var/gerrit/etc/secret.config``
37
38 ::
39
40 ...
41 [plugin "gerrit-oauth-provider-lemonldap-oauth"]
42 client-secret = <GERRIT_CLIENT_SECRET>
43
44 LL::NG
45 ------
46
47 Add an Open ID Connect Relying Party for Gerrit
48
49 .. code-block:: bash
50
51 # Exported attributes (the values must fit your LDAP schema)
52 lemonldap-ng-cli -yes 1 \
53 addKey \
54 oidcRPMetaDataExportedVars/gerrit preferred_username uid \
55 oidcRPMetaDataExportedVars/gerrit name cn \
56 oidcRPMetaDataExportedVars/gerrit email mail \
57 oidcRPMetaDataExportedVars/gerrit sub email
58
59 # Options > Basic > Allowed redirection addresses for login
60 # > Logout > Allowed redirection addresses for logout
61 lemonldap-ng-cli -yes 1 \
62 addKey \
63 oidcRPMetaDataOptions/gerrit oidcRPMetaDataOptionsRedirectUris 'http://<GERRIT_SERVER>/oauth' \
64 oidcRPMetaDataOptions/gerrit oidcRPMetaDataOptionsPostLogoutRedirectUris 'https://<GERRIT_SERVER>/'
65
66 # Options > Basic > Client ID
67 # > Basic > Client Secret
68 lemonldap-ng-cli -yes 1 \
69 addKey \
70 oidcRPMetaDataOptions/gerrit oidcRPMetaDataOptionsClientID '<GERRIT_OAUTH_ID>' \
71 oidcRPMetaDataOptions/gerrit oidcRPMetaDataOptionsClientSecret '<GERRIT_OAUTH_SECRET>'
72
73 # Timeout > ID Token expiration
74 # > Access Token expiration
75 # Security > ID Token signature algorithm
76 lemonldap-ng-cli -yes 1 \
77 addKey \
78 oidcRPMetaDataOptions/gerrit oidcRPMetaDataOptionsIDTokenExpiration 3600 \
79 oidcRPMetaDataOptions/gerrit oidcRPMetaDataOptionsAccessTokenExpiration 3600 \
80 oidcRPMetaDataOptions/gerrit oidcRPMetaDataOptionsIDTokenSignAlg RS512
81
82
83 .. |image0| image:: /applications/gerrit_logo.png
84 :class: align-center