qgis / qgis-docker

Official Docker image for QGIS Server and Desktop
GNU Affero General Public License v3.0
67 stars 21 forks source link

Run as non root user #67

Open timlinux opened 2 years ago

timlinux commented 2 years ago

It would be nice if the container ran as e.g. apache or other non-priveledged user....

mbernasocchi commented 2 years ago

@timlinux part of it is already done, https://github.com/gem/oq-qgis-server/blob/master/start-xvfb-nginx.sh#L55 we'd need to add the USER directive to the dockerfile as well.

mbernasocchi commented 2 years ago

@daniviga what do you think?

daniviga commented 2 years ago

You can run the FCGI process as different user, but not the entire container (e.g. passing -u). It should not be complex to make it user-friendly. At least I see that:

However, does it worth the effort when the container runs perfectly fine in rootless mode? (Podman is your friend!) @vot4anto may have opinions here

daniviga commented 2 years ago

If someone (@timlinux?) wants to test it: https://github.com/daniviga/oq-qgis-server/tree/usermode

Please note that nginx is now exposed on 8080:

podman run --user 1000 --rm -ti -v $(pwd)/conf/qgis-server-nginx.conf:/etc/nginx/nginx.conf -v $(pwd)/test/data:/io/data -p 8010:8080 qgis
vot4anto commented 2 years ago

Rootless is also available from docker: https://docs.docker.com/engine/security/rootless/ We can avoid to do modification if the container runs perfectly fine in rootless mode either with docker and podman. It is necessary to add the USER directive to Dockerfile? Because at gem we always use the container with docker-compose and set on the yaml file of the compose all the necessary environment

mbernasocchi commented 2 years ago

@timlinux did you get the chance to try @daniviga's work?

JakobMiksch commented 2 months ago

is this issue still relevant?