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

release: Add several security-related sysctls #435

Merged
merged 2 commits into from
Oct 21, 2019
Merged

release: Add several security-related sysctls #435

merged 2 commits into from
Oct 21, 2019

Conversation

sam-aws
Copy link
Contributor

@sam-aws sam-aws commented Oct 18, 2019

Issue #, if available:
N/A

Description of changes:
Add recommended settings from the Kernel Self Protection Project
wiki. Most of these are straightforward, some notes on the others:

  • kernel.perf_event_paranoid: Omitted since the Thar kernel does not
    include the required patch for '3' and the default is '2'.
  • kernel.yama.ptrace_scope: The Yama LSM is now enabled in the kernel in order to support this option.
  • user.max_user_namespaces: Included since Kubernetes doesn't yet
    support user namespaces, but could be something to review later on.

Tested by building and launching an instance and confirming the values were correct under /proc/sys/...

Signed-off-by: Samuel Mendoza-Jonas [email protected]

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sam-aws sam-aws requested a review from bcressey October 18, 2019 17:37
Add recommended settings from the Kernel Self Protection Project[0]
wiki. Most of these are straightforward, some notes on the others:

- kernel.perf_event_paranoid: Omitted since the Thar kernel does not
include the required patch for '3' and the default is '2'.
- kernel.yama.ptrace_scope: Omitted since Thar doesn't build the Yama
LSM.
- user.max_user_namespaces: Included since Kubernetes doesn't yet
support user namespaces[1], but could be something to review later on.

[0]: https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings#sysctls
[1]: kubernetes/enhancements#127

Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
Enable the Yama LSM and set kernel.yama.ptrace_scope to 1; restricting
how processes can use ptrace.
For more information see
https://www.kernel.org/doc/Documentation/security/Yama.txt

Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
@sam-aws
Copy link
Contributor Author

sam-aws commented Oct 18, 2019

Updated to point to the KSPP wiki in the sysctl settings and added a new commit which enables the Yama LSM.
This adds 8K to the kernel size and adds some extra serenity to the logs:

[    0.843983] Yama: becoming mindful.

kernel.yama.ptrace_scope = 1

# Disable User Namespaces, as it opens up a large attack surface to unprivileged users.
user.max_user_namespaces = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels like something we're going to need to change eventually given the use of user namespaces in containers...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, it sounds like this isn't used too thoroughly yet but could be in the future - should we exclude it or wait until it's explicitly supported?

@iliana iliana mentioned this pull request Oct 21, 2019
@sam-aws sam-aws merged commit cc30391 into develop Oct 21, 2019
@iliana iliana deleted the kernel branch October 21, 2019 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants