docker-geoserver icon indicating copy to clipboard operation
docker-geoserver copied to clipboard

backup-restore-plugin failing with permissions issues

Open genebobmiller opened this issue 1 year ago • 15 comments

What is the bug or the crash?

Permissions issues are causing the backup-restore-plugin to fail.

This issue is not present in 2.17 so I assume it's caused by the permissions change made in 2.18 when we moved away from root ownership.

Steps to reproduce the issue

Enable the backup-restore-plugin via ENV var:

    environment:
             - COMMUNITY_EXTENSIONS=backup-restore-plugin

Click on Data->Backup & Restore. Creating a backup shows warnings:

NO Exceptions Detected.

WARNING:Could not create directory.
WARNING:Could not create directory.
WARNING:Could not create directory.

and restoring the backup fails with errors:

 Error occurred while trying to move a Resource!
java.lang.IllegalStateException: Could not create directory.

Versions

2.23.0

Additional context

Not present in 2.17

genebobmiller avatar May 12 '23 05:05 genebobmiller

You haven't specified where you are trying to create the backup in. You can try to place it in temp and also what user owns the files there

NyakudyaA avatar May 12 '23 05:05 NyakudyaA

Thanks NyakudyaA,

Yes I've tried in /tmp, /opt/geoserver/data_dir and also creating a folder /backups in the root. None work correctly. I'm not doing any volume mounts for this test so the ownership is the default.

genebobmiller avatar May 12 '23 05:05 genebobmiller

Will take a look when I am near a PC

NyakudyaA avatar May 12 '23 05:05 NyakudyaA

Will report this upstream and see if they have a fix.

NyakudyaA avatar May 21 '23 10:05 NyakudyaA

Thanks NyakudyaA!

genebobmiller avatar May 23 '23 06:05 genebobmiller

Any progress with this NyakudyaA? Did you have an upstream issue we can follow?

genebobmiller avatar Jun 02 '23 02:06 genebobmiller

Opened an issue upstream but they closed it saying they don't investigate things that are running in docker, will check this over the weekend

NyakudyaA avatar Jun 02 '23 22:06 NyakudyaA

Any movement on this NyakudyaA?

genebobmiller avatar Jun 15 '23 02:06 genebobmiller

@genebobmiller Have you tried with image 2.23.1

NyakudyaA avatar Jun 15 '23 07:06 NyakudyaA

@NyakudyaA There is no such image on dockerhub.

genebobmiller avatar Jun 15 '23 23:06 genebobmiller

There must be something wrong with the github action. I will investigate and also test the plugin with the new version

NyakudyaA avatar Jun 16 '23 13:06 NyakudyaA

Issue still exists in 2.23.1

genebobmiller avatar Jul 13 '23 04:07 genebobmiller

Seems to be having trouble writing to a temporary folder...

[backuprestore.tasklet] - Error occurred while trying to move a Resource!
java.lang.IllegalStateException: Could not create directory.
	at org.geoserver.platform.resource.Files$ResourceAdaptor.dir(Files.java:185)
	at org.geoserver.platform.resource.Resources.directory(Resources.java:189)
	at org.geoserver.backuprestore.utils.BackupUtils.dir(BackupUtils.java:253)

In kartoza/geoserver:2.17.0 the backup process successfully created these folders:

/opt/geoserver/data_dir/temp/tmp3ec2c7c3-dd2a-465d-a417-110c1de301df/monitoring
/opt/geoserver/data_dir/temp/tmp3ec2c7c3-dd2a-465d-a417-110c1de301df/printing
/opt/geoserver/data_dir/temp/tmp3ec2c7c3-dd2a-465d-a417-110c1de301df/inspire

But in kartoza/geoserver:2.23.1 the backup process fails because it's attempting to create these folders in the root of the file system and getting permission denied:

/monitoring
/printing
/inspire

genebobmiller avatar Jul 13 '23 04:07 genebobmiller

Opened an issue upstream but they closed it saying they don't investigate things that are running in docker, will check this over the weekend

The issue referred to is GEOS-10990.

Is it really necessary to run as root (which is discouraged for security reasons) for backup-restore? It looks like the plugin might be misconfigured if it tries to write monitoring, printing and inspire directly within /, so #565 looks more like a work-around than a fix of the root cause...

hbruch avatar Nov 22 '23 16:11 hbruch

Yes, @hbruch That's a workaround, unfortunately, I am not a Java developer and to debug what is happening during runtime configuration.

NyakudyaA avatar Nov 22 '23 19:11 NyakudyaA