-
Notifications
You must be signed in to change notification settings - Fork 107
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
feat: set GEOSERVER_REQUIRE_FILE to currently used $GEOSERVER_DATA_DIR in startup.sh #62
base: master
Are you sure you want to change the base?
Conversation
Hint: I do not see GEOSERVER_REQUIRE_FILE in here: https://docs.geoserver.org/stable/en/user/configuration/properties/index.html |
edit: I found this: https://docs.geoserver.org/stable/en/user/datadirectory/setting.html#require-files-to-exist |
I agree. Seems like For now, I'd like to merge this MR as it fixes the problem. We could target the proposed solution to fully drop the |
Maybe @jodygarnett knows more about Main question: Do we need Current understanding on my side is: We don't need it here as we have |
GEOSERVER_REQUIRE_FILE was specifically introduced to mitigate some kind of security vulnerability with Docker images being started up against an empty GEOSERVER_DATA_DIR. It was reported before we did CVEs and I did not use Docker at the time so I do not remember the exact attack. But this is used to confirm the location has a global.xml or some other file and thus we are sure it contains a data directory. The use is optional because some people start up GeoServer with an empty data directory and then use the REST API to configure. The workflow we have, where the startup script unpacks the default data directory, so we are sure there is a data directory in place by the time GeoServer runs, should be compatible with and safe when combined with GEOSERVER_REQUIRE_FILE. I guess it would be smarter if the default value for GEOSERVER_REQUIRE_FILE was “global.xml”, and one had to go out of there way to say provide an empty string when starting up with an empty data directory on purpose. |
@simonseyock for this statement:
Is my answer sufficient? The setting should always be provided and indicates a file GeoServer checks when it starts up. If the file is not present GeoServer will refuse to start up to avoid writing files into "the wrong" location. |
There exists a problem where the default settings are copied over the existing geoserver data dir if a custom data dir is used.
If only GEOSERVER_DATA_DIR and neither SKIP_DEMO_DATA nor GEOSERVER_REQUIRE_FILE are set to any values. The GEOSERVER_REQUIRE_FILE will still be set to the default location because it is set in the Dockerfile and not in the startup script.
I assume that GEOSERVER_REQUIRE_FILE is not used outside the startup script is that correct?
The proposed solution here is one way to solve the issue without dropping the environment variable, but honestly as it is only used for checking if the demo data should be copied, I would suggest to drop the variable all together and rather do something like this:
instead of