-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Docker: run as non-root #28849
Docker: run as non-root #28849
Conversation
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
d1fc79d
to
076f93d
Compare
Now that it doesn't run as root: element-hq/element-web#28849
RUN sed -i -e 's,/var/run/nginx.pid,/tmp/nginx.pid,' /etc/nginx/nginx.conf | ||
|
||
# nginx user must own the cache and etc directory to write cache and tweak the nginx config | ||
RUN chown -R nginx:0 /var/cache/nginx /etc/nginx | ||
RUN chmod -R g+w /var/cache/nginx /etc/nginx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than having to maintain two tmp file systems (/tmp
and /var/cache
), why not move both to the same place, e.g. /tmp
?
(Sadly it seems impossible to prevent the creation of a PID file at all.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, and by the way rather than modifying the config via a scary regexp you could just launch nginx via a parameter override:
nginx -g "pid /tmp/nginx.pid;"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contributions welcome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to contribute under terms of AGPL-3.0, but I won't sign CLAs.
https://build.opensuse.org/request/show/1238072 by user dheidler + anag+factory - Version 1.11.90 ## ✨ Features * Docker: run as non-root (element-hq/element-web#28849). Contributed by @richvdh. * Docker: allow configuration of HTTP listen port via env var (element-hq/element-web#28840). Contributed by @richvdh. * Update matrix-wysiwyg to consume WASM asset (element-hq/element-web#28838). Contributed by @t3chguy. * OIDC settings tweaks (element-hq/element-web#28787). Contributed by @t3chguy. * Delabs native OIDC support (element-hq/element-web#28615). Contributed by @t3chguy. * Move room header info button to right-most position (element-hq/element-web#28754). Contributed by @t3chguy. * Enable key backup by defa
https://build.opensuse.org/request/show/1238071 by user dheidler + anag+factory - Version 1.11.90 ## ✨ Features * Docker: run as non-root (element-hq/element-web#28849). Contributed by @richvdh. * Docker: allow configuration of HTTP listen port via env var (element-hq/element-web#28840). Contributed by @richvdh. * Update matrix-wysiwyg to consume WASM asset (element-hq/element-web#28838). Contributed by @t3chguy. * OIDC settings tweaks (element-hq/element-web#28787). Contributed by @t3chguy. * Delabs native OIDC support (element-hq/element-web#28615). Contributed by @t3chguy. * Move room header info button to right-most position (element-hq/element-web#28754). Contributed by @t3chguy. * Enable key backup by defa
Notes: The docker image now runs as a non-root user
Empirically, listening on port 80 with non-root works just fine nowadays, so we may as well do that.
The hacks toTurns out we don't need many hacks, for our usecase.nginx.conf
are based on "Running nginx as a non-root user" in https://hub.docker.com/_/nginx (and the dockerfile fornginxinc/nginx-unprivileged
).Based on #28840Fixes #25926