Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 1 | Gerrit2 - Single Sign-On Security |
| 2 | ================================= |
| 3 | |
| 4 | Gerrit2 supports integration with some types of single sign-on |
| 5 | security solutions, making it possible for end-users to setup |
| 6 | and manage accounts, without administrator involvement. |
| 7 | |
| 8 | OpenID |
| 9 | ------ |
| 10 | |
| 11 | By default a new Gerrit installation relies upon OpenID to perform |
Shawn O. Pearce | 0d3ecff | 2009-06-01 08:34:17 -0700 | [diff] [blame] | 12 | user authentication services. To enable OpenID, the auth.type |
| 13 | setting should be `OpenID`: |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 14 | |
| 15 | ==== |
Shawn O. Pearce | 1523bd3 | 2009-06-05 07:01:39 -0700 | [diff] [blame] | 16 | git config --file $site_path/gerrit.config auth.type OpenID |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 17 | ==== |
| 18 | |
Shawn O. Pearce | 0d3ecff | 2009-06-01 08:34:17 -0700 | [diff] [blame] | 19 | As this is the default setting there is nothing required from the |
| 20 | site administrator to make use of the OpenID authentication services. |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 21 | |
| 22 | * http://openid.net/[openid.net] |
| 23 | |
Shawn O. Pearce | ab583db | 2009-03-03 17:28:04 -0800 | [diff] [blame] | 24 | If Jetty is being used, you may need to increase the header |
| 25 | buffer size parameter, due to very long header lines. |
| 26 | Add the following to `$JETTY_HOME/etc/jetty.xml` under |
| 27 | `org.mortbay.jetty.nio.SelectChannelConnector`: |
| 28 | |
| 29 | ==== |
| 30 | <Set name="headerBufferSize">16384</Set> |
| 31 | ==== |
| 32 | |
Shawn O. Pearce | a229966 | 2009-02-25 14:34:40 -0800 | [diff] [blame] | 33 | In order to use permissions beyond those granted to the |
| 34 | `Anonymous Users` and `Registered Users` groups, an account |
| 35 | must only have OpenIDs which match at least one pattern from the |
Shawn O. Pearce | d7c026d | 2009-08-05 20:11:22 -0700 | [diff] [blame] | 36 | `auth.trustedOpenID` list in `gerrit.config`. Patterns may be |
| 37 | either a regular expression (must start with `^` and end with `$`) |
| 38 | or be a simple prefix (any other string). |
Shawn O. Pearce | a229966 | 2009-02-25 14:34:40 -0800 | [diff] [blame] | 39 | |
Shawn O. Pearce | d7c026d | 2009-08-05 20:11:22 -0700 | [diff] [blame] | 40 | Out of the box Gerrit is configured to trust two patterns, which |
| 41 | will match any OpenID provider on the Internet: |
Shawn O. Pearce | a229966 | 2009-02-25 14:34:40 -0800 | [diff] [blame] | 42 | |
| 43 | * `http://` -- trust all OpenID providers using the HTTP protocol |
| 44 | * `https://` -- trust all OpenID providers using the HTTPS protocol |
Shawn O. Pearce | a229966 | 2009-02-25 14:34:40 -0800 | [diff] [blame] | 45 | |
Shawn O. Pearce | d7c026d | 2009-08-05 20:11:22 -0700 | [diff] [blame] | 46 | To trust only Google Accounts: |
Shawn O. Pearce | a229966 | 2009-02-25 14:34:40 -0800 | [diff] [blame] | 47 | ==== |
Shawn O. Pearce | d7c026d | 2009-08-05 20:11:22 -0700 | [diff] [blame] | 48 | git config --file $site_path/gerrit.config auth.trustedOpenID 'https://www.google.com/accounts/o8/id?id=' |
Shawn O. Pearce | a229966 | 2009-02-25 14:34:40 -0800 | [diff] [blame] | 49 | ==== |
| 50 | |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 51 | Database Schema |
| 52 | ~~~~~~~~~~~~~~~ |
| 53 | |
| 54 | User identities obtained from OpenID providers are stored into the |
| 55 | `account_external_ids` table. Users may link more than one OpenID |
| 56 | identity to the same Gerrit account (use Settings, Web Identities |
| 57 | to manage this linking), making it easier for their browser to sign |
| 58 | in to Gerrit if they are frequently switching between different |
| 59 | unique OpenID accounts. |
| 60 | |
| 61 | |
| 62 | HTTP Basic/Digest Authentication |
| 63 | -------------------------------- |
| 64 | |
| 65 | When using HTTP authentication, Gerrit assumes that the servlet |
| 66 | container or the frontend web server has performed all user |
| 67 | authentication prior to handing the request off to Gerrit. |
| 68 | |
| 69 | As a result of this assumption, Gerrit can assume that any and |
| 70 | all requests have already been authenticated. The "Sign In" and |
| 71 | "Sign Out" links are therefore not displayed in the web UI. |
| 72 | |
Shawn O. Pearce | 0d3ecff | 2009-06-01 08:34:17 -0700 | [diff] [blame] | 73 | To enable this form of authentication: |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 74 | |
| 75 | ==== |
Shawn O. Pearce | 1523bd3 | 2009-06-05 07:01:39 -0700 | [diff] [blame] | 76 | git config --file $site_path/gerrit.config auth.type HTTP |
| 77 | git config --file $site_path/gerrit.config --unset auth.httpHeader |
| 78 | git config --file $site_path/gerrit.config auth.emailFormat '{0}@example.com' |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 79 | ==== |
| 80 | |
Shawn O. Pearce | 0d3ecff | 2009-06-01 08:34:17 -0700 | [diff] [blame] | 81 | The auth.type must always be HTTP, indicating the user identity |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 82 | will be obtained from the HTTP authorization data. |
| 83 | |
Shawn O. Pearce | 0d3ecff | 2009-06-01 08:34:17 -0700 | [diff] [blame] | 84 | The auth.httpHeader must always be unset. If set to any value |
| 85 | (including `Authorization`) then Gerrit won't correctly honor the |
| 86 | standard `Authorization` HTTP header. |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 87 | |
Shawn O. Pearce | 0d3ecff | 2009-06-01 08:34:17 -0700 | [diff] [blame] | 88 | The auth.emailFormat field ('optional') sets the preferred email |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 89 | address during first login. Gerrit will replace `\{0\}` with the |
| 90 | username, as obtained from the Authorization header. A format such |
| 91 | as shown in the example would be typical, to add the domain name |
| 92 | of the organization. |
| 93 | |
Shawn O. Pearce | 818fa75 | 2009-08-15 14:44:44 -0700 | [diff] [blame^] | 94 | If Apache HTTPd is being used as the primary web server and the |
| 95 | Apache server will be handling user authentication, a configuration |
| 96 | such as the following is recommended to ensure Apache performs the |
| 97 | authentication at the proper time: |
Shawn O. Pearce | 9520f98 | 2009-02-06 10:25:11 -0800 | [diff] [blame] | 98 | |
| 99 | ==== |
Shawn O. Pearce | 818fa75 | 2009-08-15 14:44:44 -0700 | [diff] [blame^] | 100 | <Location "/login/"> |
Shawn O. Pearce | 9520f98 | 2009-02-06 10:25:11 -0800 | [diff] [blame] | 101 | AuthType Basic |
Shawn O. Pearce | 818fa75 | 2009-08-15 14:44:44 -0700 | [diff] [blame^] | 102 | AuthName "Gerrit Code Review" |
Shawn O. Pearce | 9520f98 | 2009-02-06 10:25:11 -0800 | [diff] [blame] | 103 | Require valid-user |
| 104 | ... |
| 105 | </Location> |
| 106 | ==== |
| 107 | |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 108 | Database Schema |
| 109 | ~~~~~~~~~~~~~~~ |
| 110 | |
| 111 | User identities are stored in the `account_external_ids` table. |
| 112 | The user string obtained from the authorization header has the prefix |
| 113 | "gerrit:" and is stored in the `external_id` field. For example, |
| 114 | if a username was "foo" then the external_id field would be populated |
| 115 | with "gerrit:foo". |
| 116 | |
| 117 | |
| 118 | Computer Associates Siteminder |
| 119 | ------------------------------ |
| 120 | |
| 121 | Siteminder is a commercial single sign on solution marketed by |
| 122 | Computer Associates. It is very common in larger enterprise |
| 123 | environments. |
| 124 | |
| 125 | When using Siteminder, Gerrit assumes it has been installed in a |
| 126 | servlet container which is running behind an Apache web server, |
| 127 | and that the Siteminder authentication module has been configured |
| 128 | within Apache to protect the entire Gerrit application. In this |
| 129 | configuration all users must authenticate with Siteminder before |
| 130 | they can access any resource on Gerrit. |
| 131 | |
| 132 | As a result of this assumption, Gerrit can assume that any and |
| 133 | all requests have already been authenticated. The "Sign In" and |
| 134 | "Sign Out" links are therefore not displayed in the web UI. |
| 135 | |
Shawn O. Pearce | 0d3ecff | 2009-06-01 08:34:17 -0700 | [diff] [blame] | 136 | To enable this form of authentication: |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 137 | |
| 138 | ==== |
Shawn O. Pearce | 1523bd3 | 2009-06-05 07:01:39 -0700 | [diff] [blame] | 139 | git config --file $site_path/gerrit.config auth.type HTTP |
| 140 | git config --file $site_path/gerrit.config auth.httpHeader SM_USER |
| 141 | git config --file $site_path/gerrit.config auth.emailFormat '{0}@example.com' |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 142 | ==== |
| 143 | |
Shawn O. Pearce | 0d3ecff | 2009-06-01 08:34:17 -0700 | [diff] [blame] | 144 | The auth.type must always be HTTP, indicating the user identity |
| 145 | will be obtained from the HTTP authorization data. |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 146 | |
Shawn O. Pearce | 0d3ecff | 2009-06-01 08:34:17 -0700 | [diff] [blame] | 147 | The auth.httpHeader indicates which HTTP header field the Siteminder |
| 148 | product has stored the username. Usually this is "SM_USER", but |
| 149 | may differ in your environment. Please refer to your organization's |
| 150 | single sign-on or security group to ensure the setting is correct. |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 151 | |
Shawn O. Pearce | 0d3ecff | 2009-06-01 08:34:17 -0700 | [diff] [blame] | 152 | The auth.emailFormat field ('optional') sets the user's preferred |
| 153 | email address when they first login. Gerrit will replace `\{0\}` |
| 154 | with the username, as supplied by Siteminder. A format such as |
| 155 | shown in the example would be typical, to add the domain name of |
| 156 | the organization. |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 157 | |
Shawn O. Pearce | ab583db | 2009-03-03 17:28:04 -0800 | [diff] [blame] | 158 | If Jetty is being used, you may need to increase the header |
| 159 | buffer size parameter, due to very long header lines. |
| 160 | Add the following to `$JETTY_HOME/etc/jetty.xml` under |
| 161 | `org.mortbay.jetty.nio.SelectChannelConnector`: |
Shawn O. Pearce | 4246f38 | 2009-02-20 18:38:14 -0800 | [diff] [blame] | 162 | |
| 163 | ==== |
| 164 | <Set name="headerBufferSize">16384</Set> |
| 165 | ==== |
| 166 | |
Shawn O. Pearce | 9520f98 | 2009-02-06 10:25:11 -0800 | [diff] [blame] | 167 | |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 168 | Database Schema |
| 169 | ~~~~~~~~~~~~~~~ |
| 170 | |
| 171 | User identities are stored in the `account_external_ids` table. |
| 172 | The user string obtained from Siteminder (e.g. the value in the |
| 173 | "SM_USER" HTTP header) has the prefix "gerrit:" and is stored in the |
| 174 | `external_id` field. For example, if a Siteminder username was "foo" |
| 175 | then the external_id field would be populated with "gerrit:foo". |
| 176 | |
Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 177 | GERRIT |
| 178 | ------ |
| 179 | Part of link:index.html[Gerrit Code Review] |