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.

authentication.en-us.md 14KB

пре 5 година
пре 5 година
Add single sign-on support via SSPI on Windows (#8463) * Add single sign-on support via SSPI on Windows * Ensure plugins implement interface * Ensure plugins implement interface * Move functions used only by the SSPI auth method to sspi_windows.go * Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected * Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links. * Update documentation for the new 'SPNEGO with SSPI' login source * Mention in documentation that ROOT_URL should contain the FQDN of the server * Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing) * Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources) * Add option in SSPIConfig for removing of domains from logon names * Update helper text for StripDomainNames option * Make sure handleSignIn() is called after a new user object is created by SSPI auth method * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates * Remove code duplication * Log errors in ActiveLoginSources Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert suffix of randomly generated E-mails for Reverse proxy authentication Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert unneeded white-space change in template Co-Authored-By: Lauris BH <lauris@nix.lv> * Add copyright comments at the top of new files * Use loopback name for randomly generated emails * Add locale tag for the SSPISeparatorReplacement field with proper casing * Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields * Update docs/content/doc/features/authentication.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Remove Priority() method and define the order in which SSO auth methods should be executed in one place * Log authenticated username only if it's not empty * Rephrase helper text for automatic creation of users * Return error if more than one active SSPI auth source is found * Change newUser() function to return error, letting caller log/handle the error * Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed * Refactor initialization of the list containing SSO auth methods * Validate SSPI settings on POST * Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page * Make 'Default language' in SSPI config empty, unless changed by admin * Show error if admin tries to add a second authentication source of type SSPI * Simplify declaration of global variable * Rebuild gitgraph.js on Linux * Make sure config values containing only whitespace are not accepted
пре 4 година
Add single sign-on support via SSPI on Windows (#8463) * Add single sign-on support via SSPI on Windows * Ensure plugins implement interface * Ensure plugins implement interface * Move functions used only by the SSPI auth method to sspi_windows.go * Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected * Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links. * Update documentation for the new 'SPNEGO with SSPI' login source * Mention in documentation that ROOT_URL should contain the FQDN of the server * Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing) * Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources) * Add option in SSPIConfig for removing of domains from logon names * Update helper text for StripDomainNames option * Make sure handleSignIn() is called after a new user object is created by SSPI auth method * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates * Remove code duplication * Log errors in ActiveLoginSources Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert suffix of randomly generated E-mails for Reverse proxy authentication Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert unneeded white-space change in template Co-Authored-By: Lauris BH <lauris@nix.lv> * Add copyright comments at the top of new files * Use loopback name for randomly generated emails * Add locale tag for the SSPISeparatorReplacement field with proper casing * Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields * Update docs/content/doc/features/authentication.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Remove Priority() method and define the order in which SSO auth methods should be executed in one place * Log authenticated username only if it's not empty * Rephrase helper text for automatic creation of users * Return error if more than one active SSPI auth source is found * Change newUser() function to return error, letting caller log/handle the error * Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed * Refactor initialization of the list containing SSO auth methods * Validate SSPI settings on POST * Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page * Make 'Default language' in SSPI config empty, unless changed by admin * Show error if admin tries to add a second authentication source of type SSPI * Simplify declaration of global variable * Rebuild gitgraph.js on Linux * Make sure config values containing only whitespace are not accepted
пре 4 година
Add single sign-on support via SSPI on Windows (#8463) * Add single sign-on support via SSPI on Windows * Ensure plugins implement interface * Ensure plugins implement interface * Move functions used only by the SSPI auth method to sspi_windows.go * Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected * Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links. * Update documentation for the new 'SPNEGO with SSPI' login source * Mention in documentation that ROOT_URL should contain the FQDN of the server * Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing) * Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources) * Add option in SSPIConfig for removing of domains from logon names * Update helper text for StripDomainNames option * Make sure handleSignIn() is called after a new user object is created by SSPI auth method * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates * Remove code duplication * Log errors in ActiveLoginSources Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert suffix of randomly generated E-mails for Reverse proxy authentication Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert unneeded white-space change in template Co-Authored-By: Lauris BH <lauris@nix.lv> * Add copyright comments at the top of new files * Use loopback name for randomly generated emails * Add locale tag for the SSPISeparatorReplacement field with proper casing * Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields * Update docs/content/doc/features/authentication.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Remove Priority() method and define the order in which SSO auth methods should be executed in one place * Log authenticated username only if it's not empty * Rephrase helper text for automatic creation of users * Return error if more than one active SSPI auth source is found * Change newUser() function to return error, letting caller log/handle the error * Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed * Refactor initialization of the list containing SSO auth methods * Validate SSPI settings on POST * Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page * Make 'Default language' in SSPI config empty, unless changed by admin * Show error if admin tries to add a second authentication source of type SSPI * Simplify declaration of global variable * Rebuild gitgraph.js on Linux * Make sure config values containing only whitespace are not accepted
пре 4 година
Add single sign-on support via SSPI on Windows (#8463) * Add single sign-on support via SSPI on Windows * Ensure plugins implement interface * Ensure plugins implement interface * Move functions used only by the SSPI auth method to sspi_windows.go * Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected * Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links. * Update documentation for the new 'SPNEGO with SSPI' login source * Mention in documentation that ROOT_URL should contain the FQDN of the server * Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing) * Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources) * Add option in SSPIConfig for removing of domains from logon names * Update helper text for StripDomainNames option * Make sure handleSignIn() is called after a new user object is created by SSPI auth method * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates * Remove code duplication * Log errors in ActiveLoginSources Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert suffix of randomly generated E-mails for Reverse proxy authentication Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert unneeded white-space change in template Co-Authored-By: Lauris BH <lauris@nix.lv> * Add copyright comments at the top of new files * Use loopback name for randomly generated emails * Add locale tag for the SSPISeparatorReplacement field with proper casing * Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields * Update docs/content/doc/features/authentication.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Remove Priority() method and define the order in which SSO auth methods should be executed in one place * Log authenticated username only if it's not empty * Rephrase helper text for automatic creation of users * Return error if more than one active SSPI auth source is found * Change newUser() function to return error, letting caller log/handle the error * Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed * Refactor initialization of the list containing SSO auth methods * Validate SSPI settings on POST * Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page * Make 'Default language' in SSPI config empty, unless changed by admin * Show error if admin tries to add a second authentication source of type SSPI * Simplify declaration of global variable * Rebuild gitgraph.js on Linux * Make sure config values containing only whitespace are not accepted
пре 4 година
Add single sign-on support via SSPI on Windows (#8463) * Add single sign-on support via SSPI on Windows * Ensure plugins implement interface * Ensure plugins implement interface * Move functions used only by the SSPI auth method to sspi_windows.go * Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected * Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links. * Update documentation for the new 'SPNEGO with SSPI' login source * Mention in documentation that ROOT_URL should contain the FQDN of the server * Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing) * Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources) * Add option in SSPIConfig for removing of domains from logon names * Update helper text for StripDomainNames option * Make sure handleSignIn() is called after a new user object is created by SSPI auth method * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates * Remove code duplication * Log errors in ActiveLoginSources Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert suffix of randomly generated E-mails for Reverse proxy authentication Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert unneeded white-space change in template Co-Authored-By: Lauris BH <lauris@nix.lv> * Add copyright comments at the top of new files * Use loopback name for randomly generated emails * Add locale tag for the SSPISeparatorReplacement field with proper casing * Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields * Update docs/content/doc/features/authentication.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Remove Priority() method and define the order in which SSO auth methods should be executed in one place * Log authenticated username only if it's not empty * Rephrase helper text for automatic creation of users * Return error if more than one active SSPI auth source is found * Change newUser() function to return error, letting caller log/handle the error * Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed * Refactor initialization of the list containing SSO auth methods * Validate SSPI settings on POST * Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page * Make 'Default language' in SSPI config empty, unless changed by admin * Show error if admin tries to add a second authentication source of type SSPI * Simplify declaration of global variable * Rebuild gitgraph.js on Linux * Make sure config values containing only whitespace are not accepted
пре 4 година
Add single sign-on support via SSPI on Windows (#8463) * Add single sign-on support via SSPI on Windows * Ensure plugins implement interface * Ensure plugins implement interface * Move functions used only by the SSPI auth method to sspi_windows.go * Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected * Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links. * Update documentation for the new 'SPNEGO with SSPI' login source * Mention in documentation that ROOT_URL should contain the FQDN of the server * Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing) * Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources) * Add option in SSPIConfig for removing of domains from logon names * Update helper text for StripDomainNames option * Make sure handleSignIn() is called after a new user object is created by SSPI auth method * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates * Remove code duplication * Log errors in ActiveLoginSources Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert suffix of randomly generated E-mails for Reverse proxy authentication Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert unneeded white-space change in template Co-Authored-By: Lauris BH <lauris@nix.lv> * Add copyright comments at the top of new files * Use loopback name for randomly generated emails * Add locale tag for the SSPISeparatorReplacement field with proper casing * Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields * Update docs/content/doc/features/authentication.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Remove Priority() method and define the order in which SSO auth methods should be executed in one place * Log authenticated username only if it's not empty * Rephrase helper text for automatic creation of users * Return error if more than one active SSPI auth source is found * Change newUser() function to return error, letting caller log/handle the error * Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed * Refactor initialization of the list containing SSO auth methods * Validate SSPI settings on POST * Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page * Make 'Default language' in SSPI config empty, unless changed by admin * Show error if admin tries to add a second authentication source of type SSPI * Simplify declaration of global variable * Rebuild gitgraph.js on Linux * Make sure config values containing only whitespace are not accepted
пре 4 година
Add single sign-on support via SSPI on Windows (#8463) * Add single sign-on support via SSPI on Windows * Ensure plugins implement interface * Ensure plugins implement interface * Move functions used only by the SSPI auth method to sspi_windows.go * Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected * Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links. * Update documentation for the new 'SPNEGO with SSPI' login source * Mention in documentation that ROOT_URL should contain the FQDN of the server * Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing) * Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources) * Add option in SSPIConfig for removing of domains from logon names * Update helper text for StripDomainNames option * Make sure handleSignIn() is called after a new user object is created by SSPI auth method * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates * Remove code duplication * Log errors in ActiveLoginSources Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert suffix of randomly generated E-mails for Reverse proxy authentication Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert unneeded white-space change in template Co-Authored-By: Lauris BH <lauris@nix.lv> * Add copyright comments at the top of new files * Use loopback name for randomly generated emails * Add locale tag for the SSPISeparatorReplacement field with proper casing * Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields * Update docs/content/doc/features/authentication.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Remove Priority() method and define the order in which SSO auth methods should be executed in one place * Log authenticated username only if it's not empty * Rephrase helper text for automatic creation of users * Return error if more than one active SSPI auth source is found * Change newUser() function to return error, letting caller log/handle the error * Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed * Refactor initialization of the list containing SSO auth methods * Validate SSPI settings on POST * Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page * Make 'Default language' in SSPI config empty, unless changed by admin * Show error if admin tries to add a second authentication source of type SSPI * Simplify declaration of global variable * Rebuild gitgraph.js on Linux * Make sure config values containing only whitespace are not accepted
пре 4 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. ---
  2. date: "2016-12-01T16:00:00+02:00"
  3. title: "Authentication"
  4. slug: "authentication"
  5. sidebar_position: 10
  6. toc: false
  7. draft: false
  8. aliases:
  9. - /en-us/authentication
  10. menu:
  11. sidebar:
  12. parent: "usage"
  13. name: "Authentication"
  14. sidebar_position: 10
  15. identifier: "authentication"
  16. ---
  17. # Authentication
  18. ## LDAP (Lightweight Directory Access Protocol)
  19. Both the LDAP via BindDN and the simple auth LDAP share the following fields:
  20. - Authorization Name **(required)**
  21. - A name to assign to the new method of authorization.
  22. - Host **(required)**
  23. - The address where the LDAP server can be reached.
  24. - Example: `mydomain.com`
  25. - Port **(required)**
  26. - The port to use when connecting to the server.
  27. - Example: `389` for LDAP or `636` for LDAP SSL
  28. - Enable TLS Encryption (optional)
  29. - Whether to use TLS when connecting to the LDAP server.
  30. - Admin Filter (optional)
  31. - An LDAP filter specifying if a user should be given administrator
  32. privileges. If a user account passes the filter, the user will be
  33. privileged as an administrator.
  34. - Example: `(objectClass=adminAccount)`
  35. - Example for Microsoft Active Directory (AD): `(memberOf=CN=admin-group,OU=example,DC=example,DC=org)`
  36. - Username attribute (optional)
  37. - The attribute of the user's LDAP record containing the user name. Given
  38. attribute value will be used for new Gitea account user name after first
  39. successful sign-in. Leave empty to use login name given on sign-in form.
  40. - This is useful when supplied login name is matched against multiple
  41. attributes, but only single specific attribute should be used for Gitea
  42. account name, see "User Filter".
  43. - Example: `uid`
  44. - Example for Microsoft Active Directory (AD): `sAMAccountName`
  45. - First name attribute (optional)
  46. - The attribute of the user's LDAP record containing the user's first name.
  47. This will be used to populate their account information.
  48. - Example: `givenName`
  49. - Surname attribute (optional)
  50. - The attribute of the user's LDAP record containing the user's surname.
  51. This will be used to populate their account information.
  52. - Example: `sn`
  53. - E-mail attribute **(required)**
  54. - The attribute of the user's LDAP record containing the user's email
  55. address. This will be used to populate their account information.
  56. - Example: `mail`
  57. ### LDAP via BindDN
  58. Adds the following fields:
  59. - Bind DN (optional)
  60. - The DN to bind to the LDAP server with when searching for the user. This
  61. may be left blank to perform an anonymous search.
  62. - Example: `cn=Search,dc=mydomain,dc=com`
  63. - Bind Password (optional)
  64. - The password for the Bind DN specified above, if any. _Note: The password
  65. is stored encrypted with the SECRET_KEY on the server. It is still recommended
  66. to ensure that the Bind DN has as few privileges as possible._
  67. - User Search Base **(required)**
  68. - The LDAP base at which user accounts will be searched for.
  69. - Example: `ou=Users,dc=mydomain,dc=com`
  70. - User Filter **(required)**
  71. - An LDAP filter declaring how to find the user record that is attempting to
  72. authenticate. The `%[1]s` matching parameter will be substituted with login
  73. name given on sign-in form.
  74. - Example: `(&(objectClass=posixAccount)(|(uid=%[1]s)(mail=%[1]s)))`
  75. - Example for Microsoft Active Directory (AD): `(&(objectCategory=Person)(memberOf=CN=user-group,OU=example,DC=example,DC=org)(sAMAccountName=%s)(!(UserAccountControl:1.2.840.113556.1.4.803:=2)))`
  76. - To substitute more than once, `%[1]s` should be used instead, e.g. when
  77. matching supplied login name against multiple attributes such as user
  78. identifier, email or even phone number.
  79. - Example: `(&(objectClass=Person)(|(uid=%[1]s)(mail=%[1]s)(mobile=%[1]s)))`
  80. - Enable user synchronization
  81. - This option enables a periodic task that synchronizes the Gitea users with
  82. the LDAP server. The default period is every 24 hours but that can be
  83. changed in the app.ini file. See the _cron.sync_external_users_ section in
  84. the [sample
  85. app.ini](https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini)
  86. for detailed comments about that section. The _User Search Base_ and _User
  87. Filter_ settings described above will limit which users can use Gitea and
  88. which users will be synchronized. When initially run the task will create
  89. all LDAP users that match the given settings so take care if working with
  90. large Enterprise LDAP directories.
  91. ### LDAP using simple auth
  92. Adds the following fields:
  93. - User DN **(required)**
  94. - A template to use as the user's DN. The `%s` matching parameter will be
  95. substituted with login name given on sign-in form.
  96. - Example: `cn=%s,ou=Users,dc=mydomain,dc=com`
  97. - Example: `uid=%s,ou=Users,dc=mydomain,dc=com`
  98. - User Search Base (optional)
  99. - The LDAP base at which user accounts will be searched for.
  100. - Example: `ou=Users,dc=mydomain,dc=com`
  101. - User Filter **(required)**
  102. - An LDAP filter declaring when a user should be allowed to log in. The `%[1]s`
  103. matching parameter will be substituted with login name given on sign-in
  104. form.
  105. - Example: `(&(objectClass=posixAccount)(|(cn=%[1]s)(mail=%[1]s)))`
  106. - Example: `(&(objectClass=posixAccount)(|(uid=%[1]s)(mail=%[1]s)))`
  107. ### Verify group membership in LDAP
  108. Uses the following fields:
  109. - Group Search Base (optional)
  110. - The LDAP DN used for groups.
  111. - Example: `ou=group,dc=mydomain,dc=com`
  112. - Group Name Filter (optional)
  113. - An LDAP filter declaring how to find valid groups in the above DN.
  114. - Example: `(|(cn=gitea_users)(cn=admins))`
  115. - User Attribute in Group (optional)
  116. - Which user LDAP attribute is listed in the group.
  117. - Example: `uid`
  118. - Group Attribute for User (optional)
  119. - Which group LDAP attribute contains an array above user attribute names.
  120. - Example: `memberUid`
  121. ## PAM (Pluggable Authentication Module)
  122. This procedure enables PAM authentication. Users may still be added to the
  123. system manually using the user administration. PAM provides a mechanism to
  124. automatically add users to the current database by testing them against PAM
  125. authentication. To work with normal Linux passwords, the user running Gitea
  126. must also have read access to `/etc/shadow` in order to check the validity of
  127. the account when logging in using a public key.
  128. **Note**: If a user has added SSH public keys into Gitea, the use of these
  129. keys _may_ bypass the login check system. Therefore, if you wish to disable a user who
  130. authenticates with PAM, you _should_ also manually disable the account in Gitea using the
  131. built-in user manager.
  132. 1. Configure and prepare the installation.
  133. - It is recommended that you create an administrative user.
  134. - Deselecting automatic sign-up may also be desired.
  135. 1. Once the database has been initialized, log in as the newly created
  136. administrative user.
  137. 1. Navigate to the user setting (icon in top-right corner), and select
  138. `Site Administration` -> `Authentication Sources`, and select
  139. `Add Authentication Source`.
  140. 1. Fill out the field as follows:
  141. - `Authentication Type` : `PAM`
  142. - `Name` : Any value should be valid here, use "System Authentication" if
  143. you'd like.
  144. - `PAM Service Name` : Select the appropriate file listed under `/etc/pam.d/`
  145. that performs the authentication desired.[^1]
  146. - `PAM Email Domain` : The e-mail suffix to append to user authentication.
  147. For example, if the login system expects a user called `gituser`, and this
  148. field is set to `mail.com`, then Gitea will expect the `user email` field
  149. for an authenticated GIT instance to be `gituser@mail.com`.[^2]
  150. **Note**: PAM support is added via [build-time flags](installation/install-from-source.md#build),
  151. and the official binaries provided do not have this enabled. PAM requires that
  152. the necessary libpam dynamic library be available and the necessary PAM
  153. development headers be accessible to the compiler.
  154. [^1]: For example, using standard Linux log-in on Debian "Bullseye" use
  155. `common-session-noninteractive` - this value may be valid for other flavors of
  156. Debian including Ubuntu and Mint, consult your distribution's documentation.
  157. [^2]: **This is a required field for PAM**. Be aware: In the above example, the
  158. user will log into the Gitea web interface as `gituser` and not `gituser@mail.com`
  159. ## SMTP (Simple Mail Transfer Protocol)
  160. This option allows Gitea to log in to an SMTP host as a Gitea user. To
  161. configure this, set the fields below:
  162. - Authentication Name **(required)**
  163. - A name to assign to the new method of authorization.
  164. - SMTP Authentication Type **(required)**
  165. - Type of authentication to use to connect to SMTP host, PLAIN or LOGIN.
  166. - Host **(required)**
  167. - The address where the SMTP host can be reached.
  168. - Example: `smtp.mydomain.com`
  169. - Port **(required)**
  170. - The port to use when connecting to the server.
  171. - Example: `587`
  172. - Allowed Domains
  173. - Restrict what domains can log in if using a public SMTP host or SMTP host
  174. with multiple domains.
  175. - Example: `gitea.io,mydomain.com,mydomain2.com`
  176. - Force SMTPS
  177. - SMTPS will be used by default for connections to port 465, if you wish to use SMTPS
  178. for other ports. Set this value.
  179. - Otherwise if the server provides the `STARTTLS` extension this will be used.
  180. - Skip TLS Verify
  181. - Disable TLS verify on authentication.
  182. - This Authentication Source is Activated
  183. - Enable or disable this authentication source.
  184. ## FreeIPA
  185. - In order to log in to Gitea using FreeIPA credentials, a bind account needs to
  186. be created for Gitea:
  187. - On the FreeIPA server, create a `gitea.ldif` file, replacing `dc=example,dc=com`
  188. with your DN, and provide an appropriately secure password:
  189. ```sh
  190. dn: uid=gitea,cn=sysaccounts,cn=etc,dc=example,dc=com
  191. changetype: add
  192. objectclass: account
  193. objectclass: simplesecurityobject
  194. uid: gitea
  195. userPassword: secure password
  196. passwordExpirationTime: 20380119031407Z
  197. nsIdleTimeout: 0
  198. ```
  199. - Import the LDIF (change localhost to an IPA server if needed). A prompt for
  200. Directory Manager password will be presented:
  201. ```sh
  202. ldapmodify -h localhost -p 389 -x -D \
  203. "cn=Directory Manager" -W -f gitea.ldif
  204. ```
  205. - Add an IPA group for gitea_users :
  206. ```sh
  207. ipa group-add --desc="Gitea Users" gitea_users
  208. ```
  209. - Note: For errors about IPA credentials, run `kinit admin` and provide the
  210. domain admin account password.
  211. - Log in to Gitea as an Administrator and click on "Authentication" under Admin Panel.
  212. Then click `Add New Source` and fill in the details, changing all where appropriate.
  213. ## SPNEGO with SSPI (Kerberos/NTLM, for Windows only)
  214. Gitea supports SPNEGO single sign-on authentication (the scheme defined by RFC4559) for the web part of the server via the Security Support Provider Interface (SSPI) built in Windows. SSPI works only in Windows environments - when both the server and the clients are running Windows.
  215. Before activating SSPI single sign-on authentication (SSO) you have to prepare your environment:
  216. - Create a separate user account in active directory, under which the `gitea.exe` process will be running (eg. `user` under domain `domain.local`):
  217. - Create a service principal name for the host where `gitea.exe` is running with class `HTTP`:
  218. - Start `Command Prompt` or `PowerShell` as a privileged domain user (eg. Domain Administrator)
  219. - Run the command below, replacing `host.domain.local` with the fully qualified domain name (FQDN) of the server where the web application will be running, and `domain\user` with the name of the account created in the previous step:
  220. ```sh
  221. setspn -A HTTP/host.domain.local domain\user
  222. ```
  223. - Sign in (_sign out if you were already signed in_) with the user created
  224. - Make sure that `ROOT_URL` in the `[server]` section of `custom/conf/app.ini` is the fully qualified domain name of the server where the web application will be running - the same you used when creating the service principal name (eg. `host.domain.local`)
  225. - Start the web server (`gitea.exe web`)
  226. - Enable SSPI authentication by adding an `SPNEGO with SSPI` authentication source in `Site Administration -> Authentication Sources`
  227. - Sign in to a client computer in the same domain with any domain user (client computer, different from the server running `gitea.exe`)
  228. - If you are using Chrome or Edge, add the URL of the web app to the Local intranet sites (`Internet Options -> Security -> Local intranet -> Sites`)
  229. - Start Chrome or Edge and navigate to the FQDN URL of Gitea (eg. `http://host.domain.local:3000`)
  230. - Click the `Sign In` button on the dashboard and choose SSPI to be automatically logged in with the same user that is currently logged on to the computer
  231. - If it does not work, make sure that:
  232. - You are not running the web browser on the same server where Gitea is running. You should be running the web browser on a domain joined computer (client) that is different from the server. If both the client and server are running on the same computer NTLM will be preferred over Kerberos.
  233. - There is only one `HTTP/...` SPN for the host
  234. - The SPN contains only the hostname, without the port
  235. - You have added the URL of the web app to the `Local intranet zone`
  236. - The clocks of the server and client should not differ with more than 5 minutes (depends on group policy)
  237. - `Integrated Windows Authentication` should be enabled in Internet Explorer (under `Advanced settings`)
  238. ## Reverse Proxy
  239. Gitea supports Reverse Proxy Header authentication, it will read headers as a trusted login user name or user email address. This hasn't been enabled by default, you can enable it with
  240. ```ini
  241. [service]
  242. ENABLE_REVERSE_PROXY_AUTHENTICATION = true
  243. ```
  244. The default login user name is in the `X-WEBAUTH-USER` header, you can change it via changing `REVERSE_PROXY_AUTHENTICATION_USER` in app.ini. If the user doesn't exist, you can enable automatic registration with `ENABLE_REVERSE_PROXY_AUTO_REGISTRATION=true`.
  245. The default login user email is `X-WEBAUTH-EMAIL`, you can change it via changing `REVERSE_PROXY_AUTHENTICATION_EMAIL` in app.ini, this could also be disabled with `ENABLE_REVERSE_PROXY_EMAIL`
  246. If set `ENABLE_REVERSE_PROXY_FULL_NAME=true`, a user full name expected in `X-WEBAUTH-FULLNAME` will be assigned to the user when auto creating the user. You can also change the header name with `REVERSE_PROXY_AUTHENTICATION_FULL_NAME`.
  247. You can also limit the reverse proxy's IP address range with `REVERSE_PROXY_TRUSTED_PROXIES` which default value is `127.0.0.0/8,::1/128`. By `REVERSE_PROXY_LIMIT`, you can limit trusted proxies level.
  248. Notice: Reverse Proxy Auth doesn't support the API. You still need an access token or basic auth to make API requests.