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

fix style and false warning in check_5_3 #491

Merged
merged 1 commit into from
Dec 1, 2021

Conversation

SericaLaw
Copy link
Contributor

@SericaLaw SericaLaw commented Dec 1, 2021

Hi @konstruktoid , I'm testing a container created with the command:

docker run --rm -it --cap-add CAP_SYS_CHROOT --name ubuntu  ubuntu bash

, where CAP_SYS_CHROOT is a default capability for containers.

In this case, running check_5_3 should not give warnings ( also I noticed that the default capabilities are trimmed ), but in fact, it gives output like:

[WARN] 5.3 - Ensure that Linux kernel capabilities are restricted within containers (Automated)
[WARN      * Capabilities added: CapAdd=[CAP_] to ubuntu

( If then adding some other extra caps, the output will be like: CapAdd=[CAP_CAP_SYS_ADMIN] )

This is because users may give cap args in the long form of CAP_*.

This commit will deal with this scenario and fix the false warning ( already tested with input args CAP_SYS_CHROOT/SYS_CHROOT, CAP_SYS_ADMIN ).

Also, it fixed the code style ( {{ .HostConfig.CapAdd}} -> {{ .HostConfig.CapAdd }} )

@konstruktoid
Copy link
Collaborator

Hi @SericaLaw and thanks for your contribution!

@konstruktoid konstruktoid merged commit 3f3ff4f into docker:master Dec 1, 2021
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.

2 participants