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

Add documentation about kernel module autoloading security #15451

Merged
merged 1 commit into from
Oct 23, 2019

Conversation

danwinship
Copy link
Contributor

This came out of a discussion of moving the SCTP KEP forward in sig-network; some people might be thinking that since Kubernetes doesn't (currently) support SCTP, that this means they are protected from CVEs involving the SCTP kernel module, but that's not true at all. (See also https://discuss.kubernetes.io/t/kubernetes-security-announcement-linux-kernel-memory-cgroups-escape-via-sctp-cve-2019-3874/5594.)

I'm not sure how specific we should get about recommendations here... People should definitely be blacklisting dccp if their distro still ships it, and a lot of people will want to blacklist sctp. But like, you could make a good argument for blacklisting bluetooth too; it's not like pods are going to need to be talking to Bluetooth devices... I think the answer probably comes down to "if you spend more than 5 minutes thinking about it, you should probably just run selinux". (Or maybe someone should improve the cgroups APIs so that Kubernetes can control whether module loading is available or blocked via PodSecurityPolicy. But that's way outside the scope of this PR...)

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. language/en Issues or PRs related to English language sig/docs Categorizes an issue or PR as relevant to SIG Docs. labels Jul 16, 2019
@netlify
Copy link

netlify bot commented Jul 16, 2019

Deploy preview for kubernetes-io-master-staging ready!

Built with commit 9dfde6c

https://deploy-preview-15451--kubernetes-io-master-staging.netlify.com

blacklist sctp
```

To block module loading more generically, a Linux Security Module (such as SELinux) can be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about: “…you can use a Linux Security Module (such as SELinux)…” (active rather than passive voice)

@danwinship danwinship force-pushed the securing-kernel-modules branch from be39fa2 to 645fe31 Compare July 17, 2019 13:59

To block module loading more generically, you can use a Linux Security Module (such as
SELinux) to completely deny the `module_request` permission to containers, preventing the
kernel from loading modules for them under any circumstances. (Pods would still be able to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: what is the for them under any circumstances?
nit: Do you need the sentence Pods would still ... contained in parens?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"them" = "containers". I guess it wouldn't be too unwieldy to just repeat "containers"

The parenthetical statement is parenthetical because the reader ought to understand that without us having to say it. But in the context of making security recommendations, overexplaining seems better than underexplaining.

@danwinship
Copy link
Contributor Author

Thanks for the style comments, though I'd like this to get some security expert review too. I'm not sure who the appropriate reviewers would be.

@destijl
Copy link
Member

destijl commented Jul 17, 2019

This advice seems fine, but it also seems out of place in the Kubernetes docs. I'm not sure how much linux hardening advice we really want to provide and maintain here, and why we'd focus on kernel module blacklisting in particular. The relationship to Kubernetes for the vuln notification seems like it was already fairly tenuous (i.e. not a vulnerability in a part of Kubernetes). Perhaps @philips has an opinion here since he did the vuln response.

@kbhawkey
Copy link
Contributor

Preview:
https://deploy-preview-15451--kubernetes-io-master-staging.netlify.com/docs/tasks/administer-cluster/securing-a-cluster/

@danwinship , I agree. For a security-related review, possibly assign a label such as sig/network, sig/node, sig/auth?

@danwinship
Copy link
Contributor Author

and why we'd focus on kernel module blacklisting in particular. The relationship to Kubernetes for the vuln notification seems like it was already fairly tenuous (i.e. not a vulnerability in a part of Kubernetes).

The issue is that it's a somewhat non-obvious place where containers are less-contained than people might expect. It's particularly a problem for people running "Kubernetes-as-a-Service". But maybe people doing that already need to be thinking about a lot of other security issues we don't warn about.

I'm fine if people think this doesn't belong here.

@tengqm tengqm added Needs Tech Review sig/network Categorizes an issue or PR as relevant to SIG Network. labels Jul 18, 2019
@zacharysarah
Copy link
Contributor

zacharysarah commented Aug 6, 2019

@kubernetes/sig-network-pr-reviews 👋 Thanks in advance for your review! It's still valuable even though the PR is closed (hopefully it's only temporary).

@zacharysarah
Copy link
Contributor

@danwinship 👋 Thanks for this PR. Please feel free to /reopen when you're ready to incorporate @kbhawkey's review feedback.

@philips
Copy link
Contributor

philips commented Aug 15, 2019

This seems like fine advice to have in our docs as it is a fairly common, standardized, and easy best practice.

@xiangpengzhao
Copy link
Contributor

/cc @liggitt

@k8s-ci-robot k8s-ci-robot requested a review from liggitt August 16, 2019 05:56
@danwinship danwinship force-pushed the securing-kernel-modules branch from 645fe31 to 9dfde6c Compare August 16, 2019 11:17
@liggitt
Copy link
Member

liggitt commented Aug 16, 2019

I'll defer to sig-node and sig-network reviewers on this one

@xiangpengzhao
Copy link
Contributor

cc @kubernetes/sig-node-pr-reviews

@k8s-ci-robot k8s-ci-robot added the sig/node Categorizes an issue or PR as relevant to SIG Node. label Aug 19, 2019
@sftim
Copy link
Contributor

sftim commented Oct 7, 2019

I'll also defer to sig-node and sig-network reviewers on this one
/uncc

@zacharysarah
Copy link
Contributor

/close

@k8s-ci-robot
Copy link
Contributor

@zacharysarah: Closed this PR.

In response to this:

/close

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.

@philips
Copy link
Contributor

philips commented Oct 10, 2019

@zacharysarah Can you provide some reasoning on why this was closed?

@zacharysarah
Copy link
Contributor

@philips Thanks for the prompt; I missed that we're waiting on SIG review, not on author response to reviewer feedback.

@kubernetes/sig-network-pr-reviews Ping

/reopen

@k8s-ci-robot k8s-ci-robot reopened this Oct 11, 2019
@k8s-ci-robot
Copy link
Contributor

@zacharysarah: Reopened this PR.

In response to this:

@philips Thanks for the prompt; I missed that we're waiting on SIG review, not on author response to reviewer feedback.

@kubernetes/sig-network-pr-reviews Ping

/reopen

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.

@zparnold
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 23, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zparnold

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 23, 2019
@k8s-ci-robot k8s-ci-robot merged commit 5ab1671 into kubernetes:master Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/docs Categorizes an issue or PR as relevant to SIG Docs. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/node Categorizes an issue or PR as relevant to SIG Node. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.