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

Tests 1.1.9 and 1.1.10 sometimes failing running command #909

Closed
yoavrotems opened this issue Jun 16, 2021 · 0 comments · Fixed by #911
Closed

Tests 1.1.9 and 1.1.10 sometimes failing running command #909

yoavrotems opened this issue Jun 16, 2021 · 0 comments · Fixed by #911
Assignees
Labels

Comments

@yoavrotems
Copy link
Contributor

Test 1.1.9 is running the following command

audit: |
          ps -ef | grep $kubeletbin | grep -- --cni-conf-dir | sed 's%.*cni-conf-dir[= ]\([^ ]*\).*%\1%' | xargs -I{} find {} -mindepth 1 | xargs stat -c permissions=%a
          find /var/lib/cni/networks -type f 2> /dev/null | xargs --no-run-if-empty stat -c permissions=%a

Sometimes the first part ps -ef | grep $kubeletbin | grep -- --cni-conf-dir | sed 's%.*cni-conf-dir[= ]\([^ ]*\).*%\1%' | xargs -I{} find {} -mindepth 1 returns empty value, and stat couldn't run with empty value.
Command needs to be

audit: |
          ps -ef | grep $kubeletbin | grep -- --cni-conf-dir | sed 's%.*cni-conf-dir[= ]\([^ ]*\).*%\1%' | xargs -I{} find {} -mindepth 1 | xargs --no-run-if-empty stat -c permissions=%a
          find /var/lib/cni/networks -type f 2> /dev/null | xargs --no-run-if-empty stat -c permissions=%a

Same apply to 1.1.10

@yoavrotems yoavrotems added the bug label Jun 16, 2021
@yoavrotems yoavrotems self-assigned this Jun 16, 2021
yoavrotems added a commit that referenced this issue Jun 16, 2021
@yoavrotems yoavrotems linked a pull request Jun 16, 2021 that will close this issue
tengqm pushed a commit to tengqm/kube-bench that referenced this issue Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant