This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 519
chore(CIS): add protect-kernel-defaults #999
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
060add2
fix: add protect-kernel-defaults for CIS
andyzhangx 8b7cb13
set up kernel tunable flags
andyzhangx 45302f3
test: preferred way of applying and validating changes
jackfrancis f5a3008
test: add unit test, make default not static
jackfrancis 88c5805
chore: only add --protect-kernel-defaults setting for ubuntu distro
jackfrancis 5a3277b
test: update unit tests
jackfrancis d6f4929
chore: lint
jackfrancis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,12 @@ func (cs *ContainerService) setKubeletConfig() { | |
"--streaming-connection-idle-timeout": "5m", | ||
} | ||
|
||
// "--protect-kernel-defaults" is true is currently only valid using base Ubuntu OS image | ||
// until the changes are baked into a VHD | ||
if cs.Properties.IsUbuntuDistroForAllNodes() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like it will always return false now @jackfrancis
I think I have already tried the latest Ubuntu version:
|
||
defaultKubeletConfig["--protect-kernel-defaults"] = "true" | ||
} | ||
|
||
// Set --non-masquerade-cidr if ip-masq-agent is disabled on AKS | ||
if !cs.Properties.IsIPMasqAgentEnabled() { | ||
defaultKubeletConfig["--non-masquerade-cidr"] = cs.Properties.OrchestratorProfile.KubernetesConfig.ClusterSubnet | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@jackfrancis I found this code change will fail all e2e test, and actully the kernel flags are not set correctly after this PR:
There is also no
/etc/sysctl.d/60-CIS.conf
file under/etc/sysctl.d/
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.
Addressed by putting the whole thing behind "if ubuntu distro" only logic. Once the changes in this file are baked into the VHD then we can turn the functionality on, and run tests, by default