This tutorial provides a brief introduction to security and permissions in Geoserver. For more in-depth discussion, consult the Geoserver official documentation here.

1. Users, roles, and groups in Geoserver

Geoserver has a granular, role-based permission system to secure workspaces, data, and services. Users, roles, and groups are defined as follows:

IMPORTANT: Setting up users, roles, and groups does not secure data assets on its own. These permissions must then be used to secure data and services with specific policies. See Sections 5.2 and 5.3 for details.

2. Possible User/Role/Group Configurations

The following outlines a few possible scenarios for user/role/group management from a simple read-only setup to more complex, multi-role and multi-group setups. 

Scenario 1: Read-Only Roles for all users Except Administrators

In this scenario, a small organization has 5 aerial photos that need to be shared within the organization. There will be no access to data assets from outside the organization. 

Scenario 2: Department-Based Roles

In this scenario, an organization has multiple departments that each require access to specific data and services.There is also a need to grant all staff access to common layers. 

Scenario 3: Project-Based Roles

In this scenario, a mining company runs eight projects concurrently but staff should only be able to see data within specific projects (e.g. Jeff only works on Project_1 and Project_2, so he should not be able to see Project_3). There is also a need to grant all staff access to common layers.

Geoserver has a number of default OGC-compliant service capabilities, including WFS, WMS, WMTS, TMS, etc. Permissions can be set for each service individually or all services can have the same security policy. For example, a very common policy is to only allow named roles to access all services. To create this policy, follow the instructions below:

  1. In Geoserver, click on Security > Services
  2. By default, Geoserver is set up with all services open. This means that anyone can access any service and any published data on the service. To change this, click on the rule path called *.* (meaning all services and all methods). This will open the Edit existing service access rule screen.
  3. In the Edit existing service access rule screen, deselect “Grant access to any role” if selected. 
  4. In the Edit existing service access rule screen, add GROUP_ADMIN, ADMIN, and any other roles to the Selected Roles section. 
  5. Click Save and the rules list will be updated showing that only the specified roles have access to all services. 

3. Service level security in Geoserver

Geoserver has a number of default OGC-compliant service capabilities, including WFS, WMS, WMTS, TMS, etc. Permissions can be set for each service individually or all services can have the same security policy. For example, a very common policy is to only allow named roles to access all services. To create this policy, follow the instructions below:

  1. In Geoserver, click on Security > Services
  2. By default, Geoserver is set up with all services open. This means that anyone can access any service and any published data on the service. To change this, click on the rule path called *.* (meaning all services and all methods). This will open the Edit existing service access rule screen.
  3. In the Edit existing service access rule screen, deselect “Grant access to any role” if selected. 
  4. In the Edit existing service access rule screen, add GROUP_ADMIN, ADMIN, and any other roles to the Selected Roles section. 
  5. Click Save and the rules list will be updated showing that only the specified roles have access to all services. 

4. Data level security

Data level security allows administrators to restrict access to specific workspaces, layers, and layer groups by creating multiple access rules. Each rule is also defined by the access mode, which can be set to the following:

A basic configuration is to have two rules, one to allow read access for all roles and another rule to restructure write access. Note that by default there may be some rules created in Geoserver, which can be modified or deleted to create this basic configuration. 

  1. In Geoserver, click on Security > Data.
  2. Remove or modify any existing rules so you can create new ones. Geoserver will throw specific error messages if rules conflict. Read the error messages carefully. 
  3. Click Add new rule
  4. On the New data access rule page, set the following:
    • Workspace variable to *
    • Layer and groups variable to *
    • Set Access mode to READ (this will create the read-only access rule). 
    • Under Roles, deselect “Grant access to any role” if selected, and then slide Admin, GROUP_ADMIN, and any other roles you created previously into the Selected Roles section. 
    • Click Save. This will create the READ access rule. 
  5. Click Add new rule. 
  6. On the New data access rule page, set the following:
    • Workspace variable to *
    • Layer and groups variable to *
    • Set Access mode to WRITE (this will create the read-only access rule). 
    • Under Roles, deselect “Grant access to any role” if selected, and then slide Admin and GROUP_ADMIN to the Selected Roles section. Do not add any roles that should not have WRITE access to all data. 
    • Click Save. This will create the WRITE access rule. 
  7. Note that in the examples below, the STAFF_READ role was only added to the read-only data access rule. 

5. Security Setup Best Practices in Geoserver

The following are some best practices to follow when setting up security rules and policies in Geoserver.