auth.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. .. _security_webadmin_auth:
  2. Authentication
  3. ==============
  4. This page manages the authentication options, including authentication providers and the authentication chain.
  5. Brute force attack prevention
  6. -----------------------------
  7. GeoServer ships with a delay based brute force attack prevention system.
  8. .. figure:: images/auth_brute_force.png
  9. :align: center
  10. *Brute force attack prevention settings*
  11. .. list-table::
  12. :widths: 40 60
  13. :header-rows: 1
  14. * - Option
  15. - Description
  16. * - Enabled
  17. - Whether the brute force attack prevention is enabled. Defaults to true.
  18. * - Minimum delay on failed authentication (seconds)
  19. - Minimum number of seconds a failed login request will be made to wait before getting a response
  20. * - Maximum delay on failed authentication (seconds)
  21. - Maximum number of seconds a failed login request will be made to wait before getting a response
  22. * - Excluded network masks
  23. - Network masks identifying hosts that are excluded from brute force attack prevention. Can be empty, include specific IPs, or a list of network masks.
  24. Defaults to 127.0.0.1, the localhost.
  25. * - Maximum number of threads blocked on failed login delay
  26. - Limits the number of threads that get delayed on failed login, should be set to a value less than the container's available response threads.
  27. The mechanism works as follows:
  28. * Each failed authentication request is made to wait between min and max seconds before getting an actual response back.
  29. * Each attempt to authenticate the same username in parallel fails immediately, regardless of whether the credentials were valid or not, with a message stating concurrent login attempts are not allowed.
  30. The first item slows down a single threaded attack to the point of making it ineffective (each failed attempt is logged
  31. along with the IP attempting access), the second item breaks multi-threaded attacks ability to scale.
  32. Login attempts are slowed down/blocked on all protocols, be either a OGC request, a REST call, or the UI.
  33. A user trying to login from the user interface while another request is blocked waiting for the cool-down period to
  34. expire will see a message like the following:
  35. .. figure:: images/auth_brute_force_message.png
  36. :align: center
  37. *Error message for parallel user interface login*
  38. A HTTP request (REST or OGC) will instead get an immediate 401 with a message like:
  39. HTTP/1.1 401 User foo, 5896 concurrent login attempt(s) denied during the quiet period
  40. A blessed set of IPs that can dodge the mechanism allows legit administrators to take control of the server even during
  41. an attack. The system only trusts the actual requestor IP, ignoring "X-Forwarded-For" headers, as they can be easily spoofed
  42. (this in turn requires the admin to access the system from a local network, without proxies in the middle, for the blessed
  43. IP to be recognized).
  44. The maximum number of threads blocked configuration allows to setup the system so that an attacker can misuse the
  45. system to simply block all service threads, by issuing requests with random usernames (the system cannot determine
  46. if a username is valid or not, none of the authentication mechanisms provides this information for security reasons).
  47. Considerations on how to setup the system:
  48. * A small delay is normally more than enough to stop a brute force attack, resist the temptation of setting high delay values
  49. as they might end up blocking too many legitimate accounts and trigger the max blocked threads mechanism.
  50. * Ensure that the excluded networks are well protected by other means.
  51. * Set the maximum number of blocked threads to a value large allow peak hour legit logins (e.g., early morning when
  52. all the users start working) while still leaving room for successful authentication requests.
  53. * A clustered/load balanced setup will not share the state of blocked logins, each host tracks its local login failures.
  54. Authentication filters
  55. ----------------------
  56. This section manages the Authentication Filters (adding, removing, and editing). Several authentication filters are configured by default (anonymous, basic, form, rememberme), but others can be added to the list.
  57. .. figure:: images/auth_filters.png
  58. :align: center
  59. *List of authentication filters*
  60. Anonymous access
  61. ~~~~~~~~~~~~~~~~
  62. By default, GeoServer will allow anonymous access to the :ref:`web_admin`. Without authentication, users will still be able to view the :ref:`layerpreview`, capabilities documents, and basic GeoServer details. Anonymous access can by removing the :guilabel:`anonymous` authentication filter. If removed, anonymous users navigating to the GeoServer page will get an HTTP 401 status code, which typically results in a browser-based request for credentials.
  63. Credentials from Headers filter
  64. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  65. This filter allows gathering user credentials (username and password) from request headers in a flexible and configurable way.
  66. .. figure:: images/auth_filter_credentials_from_header.png
  67. :align: center
  68. *Creating a new authentication filter fetching credentials from request headers*
  69. .. list-table::
  70. :widths: 40 60
  71. :header-rows: 1
  72. * - Option
  73. - Description
  74. * - Name
  75. - Name of the filter
  76. * - Username Header
  77. - Name of the Request Header containing the username
  78. * - Regular Expression for Username
  79. - Regular Expression used to extract the username from the related Header. Must define a group that will match the username.
  80. * - Password Header
  81. - Name of the Request Header containing the password
  82. * - Regular Expression for Password
  83. - Regular Expression used to extract the password from the related Header. Must define a group that will match the password.
  84. * - Parse Arguments as Uri Components
  85. - If checked username and password are URI decoded before being used as credentials
  86. Authentication providers
  87. ------------------------
  88. This section manages the :ref:`security_auth_providers` (adding, removing, and editing). The default authentication provider uses basic :ref:`username/password authentication <security_auth_provider_userpasswd>`. :ref:`JDBC <security_auth_provider_jdbc>` and :ref:`LDAP <security_auth_provider_ldap>` authentication can also be used.
  89. Click :guilabel:`Add new` to create a new provider. Click an existing provider to edit its parameters.
  90. .. figure:: images/auth_providers.png
  91. :align: center
  92. *List of authentication providers*
  93. Username/password provider
  94. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  95. The default new authentication provider uses a user/group service for authentication.
  96. .. figure:: images/auth_userpass.png
  97. :align: center
  98. *Creating a new authentication provider with a username and password*
  99. .. list-table::
  100. :widths: 40 60
  101. :header-rows: 1
  102. * - Option
  103. - Description
  104. * - Name
  105. - Name of the provider
  106. * - User Group Service
  107. - Name of the user/group service associated with this provider. Can be any one of the active user/group services.
  108. JDBC provider
  109. ~~~~~~~~~~~~~
  110. The configuration options for the JDBC authentication provider are illustrated below.
  111. .. figure:: images/auth_jdbc.png
  112. :align: center
  113. *Configuring the JDBC authentication provider*
  114. .. list-table::
  115. :widths: 40 60
  116. :header-rows: 1
  117. * - Option
  118. - Description
  119. * - Name
  120. - Name of the JDBC connection in GeoServer
  121. * - User Group Service
  122. - Name of the user/group service to use to load user information after the user is authenticated
  123. * - Driver class name
  124. - JDBC driver to use for the database connection
  125. * - Connection URL
  126. - JDBC URL to use when creating the database connection
  127. LDAP provider
  128. ~~~~~~~~~~~~~
  129. The following illustration shows the configuration options for the LDAP authentication provider. The default option is to use LDAP groups for role assignment, but there is also an option to use a user/group service for role assignment. Depending on whether this option is selected, the page itself will have different options.
  130. .. figure:: images/auth_ldap1.png
  131. :align: center
  132. *Configuring the LDAP authentication provider using LDAP groups for role assignment*
  133. .. figure:: images/auth_ldap2.png
  134. :align: center
  135. *Configuring the LDAP authentication provider using user/group service for authentication*
  136. .. list-table::
  137. :widths: 40 60
  138. :header-rows: 1
  139. * - Option
  140. - Description
  141. * - Name
  142. - Name of the LDAP connection in GeoServer
  143. * - Server URL
  144. - URL for the LDAP server connection. It must include the protocol, host, and port, as well as the "distinguished name" (DN) for the root of the LDAP tree.
  145. * - TLS
  146. - Enables a STARTTLS connection. (See the section on :ref:`security_auth_provider_ldap_secure`.)
  147. * - User DN pattern
  148. - Search pattern to use to match the DN of the user in the LDAP database. The pattern should contain the placeholder ``{0}`` which is injected with the ``uid`` of the user. Example: ``uid={0},ou=people``. The root DN specified as port of the *Server URL* is automatically appended.
  149. * - User Filter
  150. - LDAP Filter used to extract User data from LDAP database. Used alternatively to User DN pattern and combined with User Format to separate bind and user data extraction handling. Example: ``(userPrincipalName={0})``. Gets user data searching for a single record matching the filter. This may contain two placeholder values:
  151. ``{0}``, the full DN of the user, for example ``uid=bob,ou=people,dc=acme,dc=com``
  152. ``{1}``, the ``uid`` portion of the full DN, for example ``bob``.
  153. * - User Format
  154. - String formatter used to build username used for binding. Used alternatively to User DN pattern and combined with User Filter to separate bind and user data extraction handling. Example: ``{0}@domain``. Binds user with the username built applying the format. This may contain one placeholder:
  155. ``{0}``, the username, for example ``bob``
  156. * - Use LDAP groups for authorization
  157. - Specifies whether to use LDAP groups for role assignment
  158. * - Bind before group search
  159. - Specifies whether to bind to LDAP server with the user credentials before doing group search
  160. * - Group search base
  161. - Relative name of the node in the tree to use as the base for LDAP groups. Example: ``ou=groups``. The root DN specified as port of the *Server URL* is automatically appended. Only applicable when the *Use LDAP groups for authorization( parameter is **checked**.
  162. * - Group search filter
  163. - Search pattern for locating the LDAP groups a user belongs to. This may contain two placeholder values:
  164. ``{0}``, the full DN of the user, for example ``uid=bob,ou=people,dc=acme,dc=com``
  165. ``{1}``, the ``uid`` portion of the full DN, for example ``bob``.
  166. Only applicable when the *Use LDAP groups for authorization( parameter is **checked**.
  167. * - Admin Group
  168. - Name of the group to be mapped to Administrator role (defaults to ADMINISTRATOR). Example: ``ADMIN``. Adds the role ROLE_ADMINISTRATOR if the user belongs to a group named ADMIN (case insensitive)
  169. * - Group Admin Group
  170. - Name of the group to be mapped to Group Administrator role (defaults to GROUP_ADMIN). Example: ``GROUPADMIN``. Adds the role ROLE_GROUP_ADMIN if the user belongs to a group named GROUPADMIN (case insensitive)
  171. * - User Group Service
  172. - The user/group service to use for role assignment. Only applicable when the *Use LDAP groups for authorization* parameter is **cleared**.
  173. * - Enable Hierarchical groups search
  174. - Specifies whether to use Hierarchical LDAP groups search for role assignment
  175. * - Max depth for hierarchical groups search
  176. - Specifies the max group search depth level to use with Hierarchical LDAP groups search. Use ``-1`` for no limit. Only applicable when the *Enable Hierarchical groups search( parameter is **checked**.
  177. * - Nested group search filter
  178. - Search pattern for locating parent LDAP groups a group belongs to. This may contain two placeholder values:
  179. ``{0}``, the full DN of the user, for example ``cn=it,ou=groups,dc=acme,dc=com``
  180. ``{1}``, the ``cn`` portion of the full DN, for example ``it``.
  181. Only applicable when the *Enable Hierarchical groups search( parameter is **checked**.
  182. Authentication chain
  183. --------------------
  184. This section selects the authentication chain. Currently, only one default authentication chain is available. For further information about the default chain, please refer to :ref:`security_auth_chain`.
  185. .. figure:: images/auth_chain.png
  186. :align: center
  187. *Selecting the authentication chain*