Repository navigation
feat: improve security - configure container uid and gid - #157
Conversation
|
|
||
| collaboration: | ||
| image: ${OC_DOCKER_IMAGE:-opencloudeu/opencloud-rolling}:${OC_DOCKER_TAG:-latest} | ||
| user: ${OC_CONTAINER_UID_GID:-1000:1000} |
There was a problem hiding this comment.
I do not know how collabora reacts with that change. I think we can omit that, because collabora is not accessing opencloud volumes.
There was a problem hiding this comment.
Hi @micbar,
the collaboration container uses the opencloud image and has OC_CONFIG_DIR mounted as volume which is why there is the need to adopt the user.
The collabora image configuration starts at line 49 and for the collabora container there is no change of the user exactly for the reason you mentioned (no mounted volumes).
There was a problem hiding this comment.
Ok, then i misread the change. Fine.
|
Hi @micbar, As an external contributor I would very much appreciate slightly more transparency on the progress or handling or any further thoughts of this PR because from an outside perspective there are other things ongoing and other PRs are created and merged quite fast. 🙂 Cheers |
|
Is this merged now? I'm also very interested in this, i cannot use opencloud with my current setup without being able to set the UID and GID :/ |
|
I already approve that last week. Will merge it now. |
Hi!
I had difficulties to achieve strict data access separation on a multi purpose server.
This is caused by not being able to change UID and GID of the users used in the containers. Using 1000:1000 as the default is quite common for a lot of containers on e.g. docker hub. On the host, I need to provide access for user 1000 to directories that are mounted into containers as volumes. From a security perspective, I don't want different containers belonging to completely separated apps or services in principle having access to data or config directories of each other but I'm forced to do so if I'm not able to change the users used in the containers. This is independent of using docker daemon default configuration and still stays the same when utilizing user namespace because the same UID in containers gets translated to the same (transformed) UID in the host in both scenarios which prevents being able to define fine granular access rights and access separation for different containers and applications.
Ideally, I want to have a strict separation of access to application data for each application. For Opencloud it would even be better to have separate access rights for Opencloud and Traefik container because Opencloud container needs access to data but not e.g. the private key from the domain certificate or docker.sock whereas Traefik only needs access to docker.sock, the certificate and some configuration but not the data stored by Opencloud.
In addition, Traefik runs in privileged mode, so using root inside the container which is not best practice from a security perspective. Currently I don't have a chance to configure Traefik to run in non-privileged mode and therfore I'm not able to follow best practice and security recommendations.
This PR introduces two variables
OC_CONTAINER_UID_GIDandTRAEFIK_CONTAINER_UID_GID. They can be used to alter the UID and GID for Opencloud and related containers on one hand and Traefik on the other hand. Those two variables offer freedom of choice to implement high security standards by separating data access, running Traefik in non-privileged mode or use Opencloud the same as before if security doesn't concern me a lot.If those variables are not used, the defaults correspond to the UID and GID used up to now silently.
I would very much appreciate having the option to increase the security of my deployment. This PR is one way to do it, there might also be other ways of implementing it. If you feel this is not the way to do it, please feel free to let me know and deny this PR and propose a different way but as said, in general it would be very beneficial to offer increased security options.
Any questions and other thoughts are very welcome from my side as well 🙂
Cheers