Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recurring User 'None' Error Geofence/Geoserver #3984

Closed
afabiani opened this issue Oct 15, 2018 · 8 comments
Closed

Recurring User 'None' Error Geofence/Geoserver #3984

afabiani opened this issue Oct 15, 2018 · 8 comments
Assignees
Labels
blocker Critical issue blocking next major release and/or (People are badly blocked with no workaround) regression Issues related to regressions.
Milestone

Comments

@afabiani
Copy link
Member

I am using the latest 2.8.x branch with Geoserver 2.12.2 and I keep receiving the following error when attempting to run the updatelayers command (Below).

I am also having trouble with users not being sync'd with geoserver. I have gone through the documentation for security configuration, and checked that the geonode role/user apis are accessible to geoserver. As far as I can tell, nothing is blocking either geonode from reaching geofence or vice-versa.

Traceback (most recent call last):
File "manage.py", line 29, in
execute_from_command_line(sys.argv)
File "/home/gnode/gndev/local/lib/python2.7/site-packages/django/core/management/init.py", line 354, in execute_from_command_line
utility.execute()
File "/home/gnode/gndev/local/lib/python2.7/site-packages/django/core/management/init.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/gnode/gndev/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/gnode/gndev/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/home/gnode/geonode_dev/geonode/geonode/geoserver/management/commands/updatelayers.py", line 124, in handle
execute_signals=True)
File "/home/gnode/geonode_dev/geonode/geonode/geoserver/helpers.py", line 636, in gs_slurp
layer.set_permissions(perm_spec)
File "/home/gnode/geonode_dev/geonode/geonode/security/models.py", line 216, in set_permissions
sync_geofence_with_guardian(self.layer, perms, group=group)
File "/home/gnode/geonode_dev/geonode/geonode/decorators.py", line 44, in wrapper
return func(*args, **kwargs)
File "/home/gnode/geonode_dev/geonode/geonode/security/utils.py", line 393, in sync_geofence_with_guardian
_update_geofence_rule(layer.name, layer.workspace, service)
File "/home/gnode/geonode_dev/geonode/geonode/security/utils.py", line 564, in _update_geofence_rule
raise RuntimeError(msg)
Exception: ('Failed to process lprca_ws_boundarywgs84', RuntimeError("Could not ADD GeoServer User None Rule for Layer u'lprca_ws_boundarywgs84'",))


And also getting an error (Error updating permissions) when trying to add groups to layer permissions; although the permission change is still successful.


And finally, document uploads throws an error but the upload is still successful.

@afabiani afabiani added regression Issues related to regressions. blocker Critical issue blocking next major release and/or (People are badly blocked with no workaround) labels Oct 15, 2018
@afabiani afabiani self-assigned this Oct 15, 2018
afabiani pushed a commit that referenced this issue Oct 15, 2018
[Fixes #3984] Recurring User 'None' Error Geofence/Geoserver
afabiani pushed a commit that referenced this issue Oct 15, 2018
[Fixes #3984] Recurring User 'None' Error Geofence/Geoserver
@mikefedak
Copy link
Contributor

mikefedak commented Oct 15, 2018

Thanks Alessio, this fixes the issue with documents, however; I am still experiencing the same errors with updatelayers and with sync_geofence.

updatelayers throws the following:

Traceback (most recent call last):
File "manage.py", line 29, in
execute_from_command_line(sys.argv)
File "/home/gnode/gndev/local/lib/python2.7/site-packages/django/core/management/init.py", line 354, in execute_from_command_line
utility.execute()
File "/home/gnode/gndev/local/lib/python2.7/site-packages/django/core/management/init.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/gnode/gndev/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/gnode/gndev/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/home/gnode/geonode_dev/geonode/geonode/geoserver/management/commands/updatelayers.py", line 124, in handle
execute_signals=True)
File "/home/gnode/geonode_dev/geonode/geonode/geoserver/helpers.py", line 636, in gs_slurp
layer.set_permissions(perm_spec)
File "/home/gnode/geonode_dev/geonode/geonode/security/models.py", line 218, in set_permissions
sync_geofence_with_guardian(self.layer, perms, group=group)
File "/home/gnode/geonode_dev/geonode/geonode/decorators.py", line 44, in wrapper
return func(*args, **kwargs)
File "/home/gnode/geonode_dev/geonode/geonode/security/utils.py", line 393, in sync_geofence_with_guardian
_update_geofence_rule(layer.name, layer.workspace, service)
File "/home/gnode/geonode_dev/geonode/geonode/security/utils.py", line 566, in _update_geofence_rule
raise RuntimeError(msg)
Exception: ('Failed to process lprca_ws_boundarywgs84', RuntimeError("Could not ADD GeoServer User None Rule for Layer u'lprca_ws_boundarywgs84'",))

sync_geofence throws the following:

('Unexpected error:', <type 'exceptions.RuntimeError'>)
perm_spec is {u'users': {u'AnonymousUser': [u'view_resourcebase', u'download_resourcebase'], u'lprca': [u'view_resourcebase', u'download_resourcebase', u'change_resourcebase_metadata', u'change_resourcebase', u'delete_resourcebase', u'change_resourcebase_permissions', u'publish_resourcebase', u'change_layer_data', u'change_layer_style']}, u'groups': {u'anonymous': [u'view_resourcebase', u'download_resourcebase']}}

@afabiani
Copy link
Member Author

@mikefedak I've just run another test by adding first some layers manually to GeoServer and then launching "updatelayers". This time I also have got an error, but it is related to another cause.

Duplicate Rule Rule[id:null pri:150 srv:WPS ws:geonode l:relief_san_andres acc:ALLOW]

I'll open a separate issue for that. I'm also assuming this might happen only with management commands since there isn't such check on the logic.

In order to avoid introducing more overhead, my idea is just to relax the check by just skipping duplicated rules.

I'm going to push a tentative fix and ask you to make another try.

@mikefedak
Copy link
Contributor

Yes, I see that error in my geoserver log. I also receive an error when i try and change user permissions via the geonode GUI (but the change is still registered).

@jgrocha
Copy link

jgrocha commented Nov 7, 2018

I still have problems uploading documents. Is it possible to reopen this issue?

DoesNotExist at /documents/upload

Layer matching query does not exist.

Request Method: 	POST
Request URL: 	https://geocolabora.sig.cm-agueda.pt/documents/upload
Django Version: 	1.11.15
Exception Type: 	DoesNotExist

@afabiani
Copy link
Member Author

afabiani commented Nov 8, 2018

Hi, please take a look at this commit to fix the issue

4bc434c

@afabiani afabiani added this to the 2.10 milestone Jun 24, 2019
@kabredramany
Copy link

I want to configure on my ubuntu server 18.04:
pip
paver setup
pave sync
But its not working!

@Mibrahim333
Copy link

@afabiani how did you resolve this error . when i upload a shapefile having records more than one 1k hundred (100000) ,geonode throw this error "
Unexpected error! - 502 Bad Gateway. This error is usually due to improperly configured proxy servers. The first step in resolving the issue is to clear the client's cache.
"
Upon checking the geoserver log file . the error shows there is the same as urs "Duplicate Rule Rule[id:null pri:150 srv:WPS ws:geonode l:relief_san_andres acc:Deny]"
My error is "2022-06-02 07:32:11,539 WARN [impl.RuleDAOImpl] - ORIG: Rule[id:2167 pri:2518 srv:WFS req:LOCKFEATURE ws:geonode l:Geonames88k acc:DENY]
2022-06-02 07:32:11,539 WARN [impl.RuleDAOImpl] - DUP : Rule[id:null pri:2522 srv:WFS req:LOCKFEATURE ws:geonode l:Geonames88k acc:DENY]
2022-06-02 07:32:11,540 ERROR [geoserver.rest] - Duplicate Rule Rule[id:null pri:2522 srv:WFS req:LOCKFEATURE ws:geonode l:Geonames88k acc:DENY]
org.geoserver.geofence.core.dao.DuplicateKeyException: Duplicate Rule Rule[id:null pri:2522 srv:WFS req:LOCKFEATURE ws:geonode l:Geonames88k acc:DENY]"
Kindly look into this and give me the solution

@pierreyvesturquin
Copy link

pierreyvesturquin commented Oct 2, 2023

Hi, please take a look at this commit to fix the issue

4bc434c

I'm using Geoserver 2.20.6 and I have this error message, how to fix it ?
Something I notice: when i'm looking for the duplicated rule, I can't find it. It doesn't exists in database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Critical issue blocking next major release and/or (People are badly blocked with no workaround) regression Issues related to regressions.
Projects
None yet
Development

No branches or pull requests

6 participants