index.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. GeoServer Access Control List authorization
  2. ===========================================
  3. `GeoServer ACL <https://github.com/geoserver/geoserver-acl>`__ is an advanced authorization system for GeoServer.
  4. The source code for this plugin resides on the `geoserver-acl <https://github.com/geoserver/geoserver-acl/tree/main/src/plugin>`__ project code base,
  5. where it's `tested <https://github.com/geoserver/geoserver-acl/actions/workflows/build-plugin.yaml>`__ against the stable, development, and maintenance
  6. versions of GeoServer.
  7. This community module hence only runs a `Testcontainers <https://testcontainers.com/>`__ based integration test suite, using the
  8. `geoservercloud/geoserver-acl <https://hub.docker.com/r/geoservercloud/geoserver-acl/tags>`__ Docker image for the dependency version defined in
  9. this project's `pom.xml`.
  10. Installation
  11. ------------
  12. The plugin `.zip` file is to be installed as usual, un-zipping it inside the GeoServer `WEB-INF/lib` folder.
  13. The GeoServer ACL service is distributed as a Docker image in dockerhub: `geoservercloud/geoserver-acl <https://hub.docker.com/r/geoservercloud/geoserver-acl/tags>`__
  14. For the plugin to work in GeoServer, you need a running GeoServer ACL service.
  15. Please check the accompanying `compose.yml <./compose.yml>`__ example docker composition for a complete set up.
  16. Plugin Configuration
  17. --------------------
  18. The GeoServer ACL plugin requires GeoServer to be run with some System properties or environment variables to
  19. set up the ACL API client target URL and credentials.
  20. System Properties
  21. ~~~~~~~~~~~~~~~~~
  22. If you choose to use Java System properties, add the following ones to the GeoServer JVM parameters,
  23. with the appropriate values:
  24. .. code-block:: shell
  25. -Dgeoserver.acl.client.basePath=https://example.com/acl/api
  26. -Dgeoserver.acl.client.username=geoserver
  27. -Dgeoserver.acl.client.password=ch4ng3m3
  28. Disabling the plugin
  29. ~~~~~~~~~~~~~~~~~~~~
  30. The `geoserver.acl.enabled` config property defaults to `true` so it's not required for the plugin to run.
  31. In order to completely disable the plugin, set it to `false`:
  32. .. code-block:: shell
  33. -Dgeoserver.acl.enabled=false
  34. Environment variables
  35. ~~~~~~~~~~~~~~~~~~~~~
  36. In production environments it's usually more convenient to control configuration options through
  37. environment variables, where sensitive values can be obtained from docker/kubernetes secrets.
  38. All the system properties mentioned above can be mapped to environment variables by changing their
  39. names to upper case and replacing dots by underscores:
  40. For example:
  41. .. code-block:: shell
  42. export GEOSERVER_ACL_ENABLED=false
  43. export GEOSERVER_ACL_CLIENT_BASEPATH=https://example.com/acl/api
  44. export GEOSERVER_ACL_CLIENT_USERNAME=geoserver
  45. export GEOSERVER_ACL_CLIENT_PASSWORD=ch4ng3m3
  46. And so on.
  47. Setting the plugin's authorization cache expiration time
  48. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49. The GeoServer ACL API plugin implements a local cache for authorization requests/responses, that has
  50. a default `30` seconds expiration time.
  51. The cache "expiration time", or "time to live", can be changed through the `Dgeoserver.acl.client.cache.ttl`
  52. configuration property, which accepts a `java.time.Duration` string. For example:
  53. .. code-block:: shell
  54. -Dgeoserver.acl.client.cache.ttl=PT5S
  55. or
  56. .. code-block:: shell
  57. export GEOSERVER_ACL_CLIENT_CACHE_TTL=PT5S
  58. will set the cache TTL to `5` seconds.
  59. Examples:
  60. .. code-block:: text
  61. "PT20.345S" -- parses as "20.345 seconds"
  62. "PT15M" -- parses as "15 minutes" (where a minute is 60 seconds)
  63. "PT10H" -- parses as "10 hours" (where an hour is 3600 seconds)
  64. "P2D" -- parses as "2 days" (where a day is 24 hours or 86400 seconds)
  65. "P2DT3H4M" -- parses as "2 days, 3 hours and 4 minutes"
  66. This is **important** because the cache TTL will impact the latency for GeoServer to respond to data access
  67. or workspace admin access rules modified or deleted directly through the ACL REST API that happen outside GeoServer.
  68. If you're implementing a workflow where you're managing ACL rules directly through the ACL service API,
  69. you might want to set a shorter cache TTL.
  70. Alternatively, you can introduce a direct call to the GeoServer REST API to force clearing the cache using
  71. the `/rest/reset` endpoint. For example:
  72. .. code-block:: shell
  73. curl -u admin:geoserver -X POST "http://localhost:8080/geoserver/rest/reset"
  74. The web user interface can also be used to clear out the caches through the "Server Status" page, clicking
  75. the `Resource Cache -> Clear` button.
  76. In either case, you'd see a message like the following in the GeoServer logs, provided the logging configuration
  77. enables the info level for the `org.geoserver.acl.authorization.cache` topic:
  78. .. code-block:: text
  79. INFO [org.geoserver.acl.authorization.cache] - evicted 56 cached ACL authorizations
  80. .. note::
  81. The cache time to live is not a problem when the plugin runs in `GeoServer Cloud <https://github.com/geoserver/geoserver-cloud>`__,
  82. because the ACL Service integrates with the *GeoServer Cloud* event bus, and notifies all the running pods when a data access
  83. or admin access rule is changed, and the GeoServer microservices react immediately clearing out the authorization cache.