italia / Satosa-Saml2Spid

SATOSA SAML-to-SAML proxy with Spid compliances
Apache License 2.0
42 stars 23 forks source link

security enforcement: run docker as normal user and preferably in a RO container #142

Open MdreW opened 2 weeks ago

MdreW commented 2 weeks ago

Hi All! Work as root expose the container to many problem, uWSGI specifically in his docs say:

do not run uWSGI instances as root. You can start your uWSGIs as root, but be sure to drop privileges with the uid and gid options.

Another best docker practice is ran the container without write permission and limit temp file in tmpfs mount.

Proposal

@peppelinux what do you think?

peppelinux commented 2 weeks ago

I'm not in favour of changing the path of the proxy installation to an user home

uwsgi prints that messages because it didnt know that's executed in a container

if we want to run uwsgi as normal user we can create it without creating the home and also give privileges to the installation folders to that user and gid/uid in the uwsgi configuration

we had this previously, we decided therefore to run it as root because we didn't find any risks within docker

MdreW commented 1 week ago

Ok, @peppelinux , I follow your advices and try to add only a user creation and set uwsgi to start as user from root.

I'm a creature of habit and limit the right is a good habit. If someone gain an access on a container have a complete virtual system for run many bad things. If I can limit this risk I think that is good.

I try to add also an optional config to set as read-only the nginx and satosa containers, this can limit many abuse action.

I make a pull request.... if will be good we can merge this, otherwise is anyway a good study work :+1: