-
Couldn't load subscription status.
- Fork 66
feat(minimal/nginx): run server as non-root #1697
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
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Hi @mselim00. Thanks for your PR. I'm waiting for a aws member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
6a5f391 to
b6e539f
Compare
f602c10 to
aa88f77
Compare
| # TODO: remove these when changes can be coordinated in eks-a-build-tooling | ||
| install_rpm bash \ | ||
| coreutils && \ | ||
| coreutils && \ |
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.
Seems indent missing
| export OUTPUT_DEBUG_LOG=${OUTPUT_DEBUG_LOG} && \ | ||
| enable_extra nginx1 && \ | ||
| install_rpm nginx-filesystem \ | ||
| 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.
Indent missing here
| COPY --from=base-nginx-builder /newroot / | ||
|
|
||
| # Let nginx read/write its pid | ||
| RUN chmod o+rw /run |
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.
read-write permissions to (o+rw) on /run can be risky from a security perspective. If possible, can you restrict permissions to the nginx user or group?
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.
Makes sense - I added an nginx config file which allows us to further scope this down by writing the pid to /run/nginx/nginx.pid rather than the default /run/nginx.pid, and gave nginx ownership of /run/nginx
|
/ok-to-test |
4c452b6 to
f1c01ee
Compare
Issue #, if available:
Description of changes:
Currently attempts to run this image with nginx in the foreground, as most other nginx images are ran, fails:
This is because the default configurations for
nginxassume that the master process is ran by the super-user/root and tries to access conventionally privileged files and directories. This means that, without a new image built with changes like the one in this PR, the current image essentially has to be run as rootThis PR also bumps up the error verbosity to notice to match other nginx images and links the access/error logs to stdout/stderr so they can be seen from container run and logs commands. Ref the alpine slim example for comparison: https://github.com/nginx/docker-nginx/blob/master/Dockerfile-alpine-slim.template#L86
After this change, users can still run the image as root and get the same behavior (other than the log links to standard out/error, but I don't think there should be a dependency on that not being the case since it is after all an nginx image), but they can also run it as the default user and get a functional nginx image.
docker run <minimal-nginx-image>should exhibit similar behavior todocker run nginx. Currently it immediately exits because there's no default command set. This change sets the same command as the typical nginx container image, and makes additional tweaks so that the server can be ran by/as the current user (nginx).Shell 1:
Shell 2:
Shell 1:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.