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

backup-restore-plugin failing with permissions issues #528

Open
genebobmiller opened this issue May 12, 2023 · 15 comments · Fixed by #565
Open

backup-restore-plugin failing with permissions issues #528

genebobmiller opened this issue May 12, 2023 · 15 comments · Fixed by #565
Labels
bug upstream Packaging issue in base image or GeoServer

Comments

@genebobmiller
Copy link

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

@NyakudyaA
Copy link
Collaborator

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

@genebobmiller
Copy link
Author

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.

@NyakudyaA
Copy link
Collaborator

Will take a look when I am near a PC

@NyakudyaA
Copy link
Collaborator

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

@genebobmiller
Copy link
Author

Thanks NyakudyaA!

@genebobmiller
Copy link
Author

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

@NyakudyaA
Copy link
Collaborator

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

@genebobmiller
Copy link
Author

Any movement on this NyakudyaA?

@NyakudyaA
Copy link
Collaborator

@genebobmiller Have you tried with image 2.23.1

@genebobmiller
Copy link
Author

@NyakudyaA There is no such image on dockerhub.

@NyakudyaA
Copy link
Collaborator

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

@genebobmiller
Copy link
Author

Issue still exists in 2.23.1

@genebobmiller
Copy link
Author

genebobmiller commented Jul 13, 2023

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

@hbruch
Copy link

hbruch commented Nov 22, 2023

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...

@NyakudyaA
Copy link
Collaborator

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

@NyakudyaA NyakudyaA reopened this Nov 22, 2023
@NyakudyaA NyakudyaA added bug upstream Packaging issue in base image or GeoServer labels Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug upstream Packaging issue in base image or GeoServer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants