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

Harden kube-dns to run with less privileges. #82347

Merged
merged 7 commits into from Sep 25, 2019

Conversation

@pjbgf
Copy link
Contributor

commented Sep 4, 2019

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
Hardens the kube-dns add-on by implementing some security best practices, such as:

  • Run as non-root (& disallow privilege escalation)
  • ReadOnlyRootFilesystem
  • Drop unneeded capabilities

Which issue(s) this PR fixes:

Fixes #82623

Special notes for your reviewer:
No major changes were made, only removed privileges not used by the containers.
The dnsmasq cannot run as non-root at this point, so will leave it for the time being as it will require deeper changes.

Does this PR introduce a user-facing change?:

kube-dns add-on: 
- All containers are now being executed under more restrictive privileges. 
- Most of the containers now run as non-root user and has the root filesystem set as read-only. 
- The remaining container running as root only has the minimum Linux capabilities it requires to run. 
- Privilege escalation has been disabled for all containers.

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Sep 4, 2019

Welcome @pjbgf!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Sep 4, 2019

Hi @pjbgf. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot requested review from bowei and MrHohn Sep 4, 2019
@pjbgf

This comment has been minimized.

Copy link
Contributor Author

commented Sep 4, 2019

/area security
/priority important-longterm
/assign @MrHohn

@MrHohn

This comment has been minimized.

Copy link
Member

commented Sep 4, 2019

/ok-to-test
/assign @prameshj @bowei
/cc @tallclair

@MrHohn

This comment has been minimized.

Copy link
Member

commented Sep 4, 2019

Would we do similar to CoreDNS addon?

@rajansandeep

This comment has been minimized.

Copy link
Member

commented Sep 4, 2019

Copy link
Member

left a comment

@pjbgf These changes should also be made to the kube-dns.yaml.in and kube-dns.yaml.sed files.

@k8s-ci-robot k8s-ci-robot added size/M and removed size/S labels Sep 4, 2019
@pjbgf

This comment has been minimized.

Copy link
Contributor Author

commented Sep 4, 2019

@rajansandeep fair point, I have just updated them accordingly.

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2019

@pjbgf: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-conformance-image-test cbadca6 link /test pull-kubernetes-conformance-image-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@pjbgf

This comment has been minimized.

Copy link
Contributor Author

commented Sep 12, 2019

/retest

@pjbgf pjbgf referenced this pull request Sep 12, 2019
12 of 18 tasks complete
pjbgf added 2 commits Sep 17, 2019
@pjbgf

This comment has been minimized.

Copy link
Contributor Author

commented Sep 19, 2019

@MrHohn @tallclair all the points on review were fixed. Are we good to lgtm?

@pjbgf

This comment has been minimized.

Copy link
Contributor Author

commented Sep 23, 2019

@MrHohn
MrHohn approved these changes Sep 24, 2019
Copy link
Member

left a comment

Would be great to have a final LGTM from @tallclair
/approve

@MrHohn

This comment has been minimized.

Copy link
Member

commented Sep 24, 2019

/assign @tallclair

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MrHohn, pjbgf

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@prameshj

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label Sep 24, 2019
@k8s-ci-robot k8s-ci-robot merged commit 129a13a into kubernetes:master Sep 25, 2019
25 checks passed
25 checks passed
cla/linuxfoundation pjbgf authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-conformance-kind-ipv6 Skipped.
pull-kubernetes-cross Skipped.
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-alpha-features Skipped.
pull-kubernetes-e2e-gce-csi-serial Skipped.
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gce-iscsi Skipped.
pull-kubernetes-e2e-gce-iscsi-serial Skipped.
pull-kubernetes-e2e-gce-storage-slow Skipped.
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped.
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-node-e2e-containerd Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details
@k8s-ci-robot k8s-ci-robot added this to the v1.17 milestone Sep 25, 2019
@pjbgf pjbgf deleted the pjbgf:non-root branch Sep 25, 2019
@pjbgf pjbgf referenced this pull request Sep 30, 2019
6 of 6 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.