Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
9 лет назад
9 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. ## Built-in Authentication
  2. By default, Gitblit stores and authenticates all users against `users.conf`. However, you may wish to integrate Gitblit into an existing user account infrastructure.
  3. Gitblit supports additional authentication mechanisms aside from it's internal one.
  4. * LDAP authentication
  5. * Windows authentication
  6. * PAM authentication
  7. * Htpasswd authentication
  8. * HTTP header authentication
  9. * Redmine auhentication
  10. * Salesforce.com authentication
  11. * Servlet container authentication
  12. ### LDAP Authentication
  13. *SINCE 1.0.0*
  14. LDAP can be used to authenticate Users and optionally control Team memberships. When properly configured, Gitblit will delegate authentication to your LDAP server and will cache some user information in the usual users.conf file.
  15. When using the LDAP User Service, new user accounts can not be manually created from Gitblit. Gitblit user accounts are automatically created for new users on their first succesful authentication through Gitblit against the LDAP server. It is also important to note that the LDAP User Service does not retrieve or store user passwords nor does it implement any LDAP-write functionality.
  16. To use the *LdapUserService* set *realm.authenticationProviders=ldap* in your `gitblit.properties` file and then configure the *realm.ldap* settings appropriately for your LDAP environment.
  17. #### Example LDAP Layout
  18. ![block diagram](ldapSample.png "LDAP Sample")
  19. Please see [ldapUserServiceSampleData.ldif](https://github.com/gitblit-org/gitblit/blob/master/src/test/resources/ldap/sampledata.ldif) to see the data in LDAP that reflects the above picture.
  20. #### Gitblit Settings for Example LDAP Layout
  21. The following are the settings required to configure Gitblit to authenticate against the example LDAP server with LDAP-controlled team memberships.
  22. <table class="table">
  23. <thead>
  24. <tr><th>parameter</th><th>value</th><th>description</th></tr>
  25. </thead>
  26. <tbody>
  27. <tr>
  28. <th>realm.ldap.server</th><td>ldap://localhost:389</td>
  29. <td>Tells Gitblit to connect to the LDAP server on localhost port 389. The URL Must be of form ldap(s)://&lt;server&gt;:&lt;port&gt; with port being optional (389 for ldap, 636 for ldaps).</td>
  30. </tr>
  31. <tr>
  32. <th>realm.ldap.username</th><td>cn=Directory Manager</td>
  33. <td>The credentials that will log into the LDAP server</td>
  34. </tr>
  35. <tr>
  36. <th>realm.ldap.password</th><td>password</td>
  37. <td>The credentials that will log into the LDAP server</td>
  38. </tr>
  39. <tr>
  40. <th>realm.ldap.maintainTeams</th><td>true</td>
  41. <td>Are team memberships maintained in LDAP (<em>true</em>) or manually in Gitblit (<em>false</em>).</td>
  42. </tr>
  43. <tr>
  44. <th>realm.ldap.accountBase</th><td>OU=Users,OU=UserControl,OU=MyOrganization,DC=MyDomain</td>
  45. <td>What is the root node for all users in this LDAP system. Subtree searches will start from this node.</td>
  46. </tr>
  47. <tr>
  48. <th>realm.ldap.accountPattern</th><td>(&(objectClass=person)(sAMAccountName=${username}))</td><td>The LDAP search filter that will match a particular user in LDAP. ${username} will be replaced with whatever the user enters as their username in the Gitblit login panel.</td>
  49. </tr>
  50. <tr>
  51. <th>realm.ldap.groupBase</th><td>OU=Groups,OU=UserControl,OU=MyOrganization,DC=MyDomain</td>
  52. <td>What is the root node for all teams in this LDAP system. Subtree searches will start from this node.</td>
  53. </tr>
  54. <tr>
  55. <th>realm.ldap.groupMemberPattern</th><td>(&(objectClass=group)(member=${dn}))</td><td>The LDAP search filter that will match all teams for the authenticating user. ${username} will be replaced with whatever the user enters as their username in the Gitblit login panel. Anything else in ${} will be replaced by Attributes from the User node.</td>
  56. </tr>
  57. <tr>
  58. <th>realm.ldap.admins</th><td>@Git_Admins</td><td>A space-delimited list of usernames and/or teams that indicate admin status in Gitblit. Teams are referenced with a leading <em>@</em> character.</td>
  59. </tr>
  60. </tbody>
  61. </table>
  62. #### LDAP In-Memory Server
  63. You can start Gitblit GO with an in-memory LDAP server by specifying the *--ldapLdifFile* command-line argument. The LDAP server will listen on localhost of the port specified in *realm.ldap.url* of `gitblit.properties`. Additionally, a root user record is automatically created for *realm.ldap.username* and *realm.ldap.password*. Please note that the ldaps:// protocol is not supported for the in-memory server.
  64. ### Windows Authentication
  65. Windows authentication is based on the use of Waffle and JNA. It is known to work properly for authenticating against the local Windows machine, but it is unclear if it works properly with a domain controller and Active Directory. To use this service, your Gitblit server must be installed on a Windows machine.
  66. realm.authenticationProviders = windows
  67. realm.windows.defaultDomain =
  68. ### PAM Authentication
  69. PAM authentication is based on the use of libpam4j and JNA. To use this service, your Gitblit server must be installed on a Linux/Unix/MacOSX machine.
  70. realm.authenticationProviders = pam
  71. realm.pam.serviceName = gitblit
  72. Then define a gitblit authentication policy in `/etc/pam.d/gitblit`
  73. # PAM configuration for the gitblit service
  74. # Standard Un*x authentication.
  75. @include common-auth
  76. ### Htpasswd Authentication
  77. Htpasswd authentication allows you to maintain your user credentials in an Apache htpasswd file thay may be shared with other htpasswd-capable servers.
  78. realm.authenticationProviders = htpasswd
  79. realm.htpasswd.userFile = /path/to/htpasswd
  80. ### HTTP Header Authentication
  81. HTTP header authentication allows you to use existing authentication performed by a trusted frontend, such as a reverse proxy. Ensure that when used, gitblit is ONLY availabe via the trusted frontend, otherwise it is vulnerable to a user adding the header explicitly.
  82. By default, no user or team header is defined, which results in all authentication failing this mechanism. The user header can also be defined while leaving the team header undefined, which causes users to be authenticated from the headers, but team memberships to be maintained locally.
  83. realm.httpheader.userheader = REMOTE_USER
  84. realm.httpheader.teamheader = X-GitblitExample-GroupNames
  85. realm.httpheader.teamseparator = ,
  86. realm.httpheader.autoCreateAccounts = false
  87. ### Redmine Authentication
  88. You may authenticate your users against a Redmine installation as long as your Redmine install has properly enabled [API authentication](http://www.redmine.org/projects/redmine/wiki/Rest_Api#Authentication). This user service only supports user authentication; it does not support team creation based on Redmine groups. Redmine administrators will also be Gitblit administrators.
  89. realm.authenticationProviders = redmine
  90. realm.redmine.url = http://example.com/redmine
  91. ### Salesforce.com Authentication
  92. You may authenticate your users against Salesforce.com. You can require that user's belong to a particular organization by specifying a non-zero organization id.
  93. realm.authenticationProviders = salesforce
  94. realm.salesforce.orgId = 0
  95. ### Container Authentication
  96. If you are using the WAR variant and deploying into your own servlet container which has a pre-defined authentication mechanism protecting the Gitblit webapp, then you may instruct Gitblit to automatically create Gitblit accounts for container-authenticated user principals.
  97. realm.container.autoCreateAccounts = true
  98. ## Custom Authentication
  99. This is the simplest choice where you implement custom authentication and delegate all other standard user and team operations to one of Gitblit's user service implementations. This choice insulates your customization from changes in User and Team model classes and additional API that may be added to IUserService.
  100. Please subclass [com.gitblit.auth.AuthenticationProvider.UsernamePasswordAuthenticationProvider](https://github.com/gitblit-org/gitblit/blob/master/src/main/java/com/gitblit/auth/AuthenticationProvider.java).
  101. You may use your subclass by specifying its fully qualified classname in the *realm.authenticationProviders* setting.
  102. Your subclass must be on Gitblit's classpath and must have a public default constructor.
  103. ### Custom Everything
  104. Instead of maintaining a `users.conf` file, you may want to integrate Gitblit into an existing environment.
  105. You may use your own custom *com.gitblit.IUserService* implementation by specifying its fully qualified classname in the *realm.userService* setting.
  106. Your user service class must be on Gitblit's classpath and must have a public default constructor.
  107. Please see the following interface definition [com.gitblit.IUserService](https://github.com/gitblit-org/gitblit/blob/master/src/main/java/com/gitblit/IUserService.java).