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

101 lines
4.0 KiB

  1. Gitea LDAP Authentication Module
  2. ===============================
  3. ## About
  4. This authentication module attempts to authorize and authenticate a user
  5. against an LDAP server. It provides two methods of authentication: LDAP via
  6. BindDN, and LDAP simple authentication.
  7. LDAP via BindDN functions like most LDAP authentication systems. First, it
  8. queries the LDAP server using a Bind DN and searches for the user that is
  9. attempting to sign in. If the user is found, the module attempts to bind to the
  10. server using the user's supplied credentials. If this succeeds, the user has
  11. been authenticated, and his account information is retrieved and passed to the
  12. Gogs login infrastructure.
  13. LDAP simple authentication does not utilize a Bind DN. Instead, it binds
  14. directly with the LDAP server using the user's supplied credentials. If the bind
  15. succeeds and no filter rules out the user, the user is authenticated.
  16. LDAP via BindDN is recommended for most users. By using a Bind DN, the server
  17. can perform authorization by restricting which entries the Bind DN account can
  18. read. Further, using a Bind DN with reduced permissions can reduce security risk
  19. in the face of application bugs.
  20. ## Usage
  21. To use this module, add an LDAP authentication source via the Authentications
  22. section in the admin panel. Both the LDAP via BindDN and the simple auth LDAP
  23. share the following fields:
  24. * Authorization Name **(required)**
  25. * A name to assign to the new method of authorization.
  26. * Host **(required)**
  27. * The address where the LDAP server can be reached.
  28. * Example: mydomain.com
  29. * Port **(required)**
  30. * The port to use when connecting to the server.
  31. * Example: 636
  32. * Enable TLS Encryption (optional)
  33. * Whether to use TLS when connecting to the LDAP server.
  34. * Admin Filter (optional)
  35. * An LDAP filter specifying if a user should be given administrator
  36. privileges. If a user accounts passes the filter, the user will be
  37. privileged as an administrator.
  38. * Example: (objectClass=adminAccount)
  39. * First name attribute (optional)
  40. * The attribute of the user's LDAP record containing the user's first name.
  41. This will be used to populate their account information.
  42. * Example: givenName
  43. * Surname attribute (optional)
  44. * The attribute of the user's LDAP record containing the user's surname This
  45. will be used to populate their account information.
  46. * Example: sn
  47. * E-mail attribute **(required)**
  48. * The attribute of the user's LDAP record containing the user's email
  49. address. This will be used to populate their account information.
  50. * Example: mail
  51. **LDAP via BindDN** adds the following fields:
  52. * Bind DN (optional)
  53. * The DN to bind to the LDAP server with when searching for the user. This
  54. may be left blank to perform an anonymous search.
  55. * Example: cn=Search,dc=mydomain,dc=com
  56. * Bind Password (optional)
  57. * The password for the Bind DN specified above, if any. _Note: The password
  58. is stored in plaintext at the server. As such, ensure that your Bind DN
  59. has as few privileges as possible._
  60. * User Search Base **(required)**
  61. * The LDAP base at which user accounts will be searched for.
  62. * Example: ou=Users,dc=mydomain,dc=com
  63. * User Filter **(required)**
  64. * An LDAP filter declaring how to find the user record that is attempting to
  65. authenticate. The '%s' matching parameter will be substituted with the
  66. user's username.
  67. * Example: (&(objectClass=posixAccount)(uid=%s))
  68. **LDAP using simple auth** adds the following fields:
  69. * User DN **(required)**
  70. * A template to use as the user's DN. The `%s` matching parameter will be
  71. substituted with the user's username.
  72. * Example: cn=%s,ou=Users,dc=mydomain,dc=com
  73. * Example: uid=%s,ou=Users,dc=mydomain,dc=com
  74. * User Filter **(required)**
  75. * An LDAP filter declaring when a user should be allowed to log in. The `%s`
  76. matching parameter will be substituted with the user's username.
  77. * Example: (&(objectClass=posixAccount)(cn=%s))
  78. * Example: (&(objectClass=posixAccount)(uid=%s))