mirror of
https://github.com/healthchecks/healthchecks.git
synced 2026-04-26 07:25:51 +03:00
[GH-ISSUE #769] Possible permission error with opening /opt/healthchecks/docker/uwsgi.ini after building image and launching the container #538
Labels
No labels
bug
bug
bug
feature
good-first-issue
new integration
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/healthchecks#538
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Klionheart on GitHub (Dec 26, 2022).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/769
On some (particularly security-conscious?) machines, after the repository is cloned, files and directories in the local copy can end up with 700/600 permissions. In my case it was a Synology system with "0077" umask forcing the permissions to be like this:
As a consequence, when you build a docker image on such a system, the container directory "/opt/healthchecks/docker/" ends up with the same permissions, meaning it is not accessible by the "hs" user in the container.
So the startup command "uwsgi /opt/healthchecks/docker/uwsgi.ini" fails and the container never starts.
For a solution, the owner of the directory in the container can simply be changed to the "hs" user in the Dockerfile, for example:
I tried the above while building my own image and it seems to be ok. The container works and the file system looks like this:
I don't believe there should be other issues with having "hc" own the healthchecks directory...in fact it does seems to make logical sense.
If you agree, the fix here should be fairly straightforward and might avoid some unexpected headaches in the future ;)
@cuu508 commented on GitHub (Dec 26, 2022):
Thank you for the report.
A problem I see with the proposed solution is, the hc user would now have write access to the files. It should only have read access.
@cuu508 commented on GitHub (Jan 16, 2023):
chown) would make files writable by the hc user, which is not good security-wisechmod) would be problematic, as the hc user needs read permission only for some files, and read+execute permission for othersgit clonecreates files with the correct permissions to start with. I've not tested this, but look into setting git's core.sharedRepository setting toall.