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

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

Closed
MdreW opened this issue Jun 27, 2024 · 2 comments · Fixed by #168
Closed

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

MdreW opened this issue Jun 27, 2024 · 2 comments · Fixed by #168
Assignees
Labels
enhancement New feature or request

Comments

@MdreW
Copy link
Collaborator

MdreW commented Jun 27, 2024

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

  • make a satosa user with his home (/home/satosa)
  • move the venv directory in the user home (/home/satosa/.venv)
  • move the proxy in a user home subdirectory (/home/satosa/proxy)
  • make a tmp filesystem for satosa pid (/hoe/satosa/run)
  • make a environments for set the service as read only in the compose

@peppelinux what do you think?

@MdreW MdreW added the enhancement New feature or request label Jun 27, 2024
@peppelinux
Copy link
Member

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
Copy link
Collaborator Author

MdreW commented Jul 3, 2024

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 👍

@MdreW MdreW self-assigned this Nov 5, 2024
@MdreW MdreW linked a pull request Nov 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants