I am unable to secure my GeoServer installation and grant read and/or write access to different roles. On the most basic level, I would like to have a VIEWER and an EDITOR role that I can apply to different workspaces. Along with this, I would like to control how each role accesses WFS -- readers should be able to view while editors should be able to edit in QGIS.
After a thorough read of the GeoServer manual and this tutorial, I still cannot get multi-user access to work as expected. All users, regardless of data access rules, cannot access WFS layers once the following rules are in place.
Note that I am using a fresh install of GeoServer version 2.10.0 on an Ubuntu Server version 16.04 running Apache2 and Tomcat7.
- Create workspace called "test"
- Create a Postgis store using admin credentials (just for testing, not production)
- Publish a single layer.
- Create two roles: EDITORS and VIEWER
- Create two users: test_editor and test_viewer. Give test_editor the EDITORS role and test_viewer the VIEWER role.
Set up data security as follows:
*.*.r * *.*.w * test.*.r VIEWER,EDITORS test.*.w EDITORS
Create the following service rules:
*.* * wfs.* EDITORS
Launch QGIS 2.16.3 and add the WFS 1.0.0 service capabilities (e.g. http://myserverip:8080/geoserver/ows?service=WFS&version=1.0.0&request=GetCapabilities&) AND the test_viewer or test_editor login credentials.
- With the test_editor credentials, the expected result would be the ability to edit and save the layer, and with the test_viewer credentials the user should be able to simply view the WFS layers in QGIS without the ability to edit. However, trying to get capabilities causes a popup error in QGIS: "Unexpected end of file". QGIS error log reads:
Download of capabilities failed: Error downloading http://myserverip:8080/geoserver/ows?version=1.0.0&&SERVICE=WFS&REQUEST=GetCapabilities&VERSION=1.0.0 - server replied: Forbidden
GeoServer log reads:
2016-11-17 13:59:22,480 WARN [wicket.Localizer] - Tried to retrieve a localized string for a component that has not yet been added to the page. This can sometimes lead to an invalid or no localized resource returned. Make sure you are not calling Component#getString() inside your Component's constructor. Offending component: [XMLUserGroupServicePanel [Component id = dummy]]
2016-11-17 14:04:10,769 INFO [geoserver.wfs] -
2016-11-17 14:07:25,217 INFO [geoserver.wfs] -
2016-11-17 14:08:39,836 INFO [geoserver.wfs] -
BUT... and this is where it gets weird, the credentials work perfectly for WMS. No creds, no access to WMS layers in "test" workspace. Apply creds, and authorized users have access to layers. So, there is something wrong with WFS(-T).
Some further things to note:
- All default GeoServer settings are in place (except for those changes in the above steps)
- WFS Service level is set to Transactional
- Local settings are not being used for the "test" workspace. Global settings are used, which are set to default.
- Apache, Tomcat7 and Ubuntu Server have not been reconfigured. All default settings are in place.
Why are the security settings not working as expected for WFS layers but work fine for WMS? Further, it is this a GeoServer-, QGIS-, Apache-, Tomcat 7-, or Linux-related issue? I suspect that there are some Linux permission issues or something else under the hood preventing GeoServer from working as it should.