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

[Proposal] Checking kubelet process arguments and kubelet config file #240

Closed
ttousai opened this issue Mar 12, 2019 · 1 comment
Closed

Comments

@ttousai
Copy link
Contributor

ttousai commented Mar 12, 2019

On the matter of considering the kubelet config file for kubelet audits (#195) , I think the simplest solution is to wrap the standard CIS audit commands in a script that also checks the config files as well and returns the expected output for the audit tests.

We already do something similar in cfg/1.8/master tests for configuration files (1.4), where we wrap the actual test in a script that checks if the file exists in the first place before running the audit command. It is a flexible, expressive solution that does not require code changes in kube-bench, and our work will be limited to getting the script right.

This is an example of such a wrapper (according to the CIS document commandline params take precedence.

# get config file path
f=$(ps -C kubelet -o cmd --no-headers | sed 's%^.*--config[= ]\([^ ]*\) .*$%\1%')
# check for command line param
ps -C kublet -o cmd --no-headers | grep '\-\-allow-privileged'
if [ $? -eq 0 ]; then
	echo use standard audit command
	# ps -fC kubelet
elif [ -f "$f" ]; then
	echo write audit command to check kubelet config
else
  echo default
fi
@ttousai
Copy link
Contributor Author

ttousai commented Mar 19, 2019

Closing this issue in favor of the proposal in #239.

@ttousai ttousai closed this as completed Mar 19, 2019
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

No branches or pull requests

1 participant