Skip to content

Support for 'CIS Docker Benchmark 1.12.0'#182

Merged
konstruktoid merged 2 commits intodocker:masterfrom
vadapalliravikumar:docker-benchmark-1.12.0
Jan 23, 2017
Merged

Support for 'CIS Docker Benchmark 1.12.0'#182
konstruktoid merged 2 commits intodocker:masterfrom
vadapalliravikumar:docker-benchmark-1.12.0

Conversation

@vadapalliravikumar
Copy link
Contributor

Signed-off-by: Ravi Kumar Vadapalli vadapalli.ravikumar@gmail.com

The code changes are to support 'CIS Docker 1.12.0 Benchmark'. 17 new recommendations have been added in 1.12.0 benchmark. 12 out of these 17 have tests have been included in these code changes.

Tested in Ubuntu16.04 with GNU bash 4.3.46. Checked the changes with shellcheck & checkbashims.

Signed-off-by: Ravi Kumar Vadapalli <vadapalli.ravikumar@gmail.com>
@konstruktoid
Copy link
Collaborator

Thanks a lot @vadapalliravikumar! I'll go through it all in detail and update when CIS 1.13 is available, which should be Soon™

@konstruktoid konstruktoid added this to the v1.2.0 milestone Jan 20, 2017
pass "$check_5_28"
fi

# 5.29
Copy link
Collaborator

Choose a reason for hiding this comment

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

This results in

[WARN] 5.29 - Do not use Docker's default bridge docker0
[WARN]      * container in docker0 network:  16794ef13b98785b74c08775d3580b44cb7648f140a3cd3871e7d05f9512d852  219607ecdfe3a37161fcba50ae92c54dd1d6c12f465a434a9cec48e58e9eb61e

were the IDs and not names are presented on a single line.

warn " * Docker sock shared: $c"
fail=1
else
warn " * Docekr sock shared: $c"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo.


# 2.16
check_2_16="2.16 - Control the number of manager nodes in a swarm"
docker node ls 2>/dev/null | grep "Leader" >/dev/null 2>&1
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't count the actual number of leaders.

info "$check_4_7"
fi
imgName=`docker inspect --format='{{.RepoTags}}' $img 2>/dev/null`
info " update instruction found in history of $imgName"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should start with capital letter.

info "$check_4_9"
fi
imgName=`docker inspect --format='{{.RepoTags}}' $img 2>/dev/null`
info " found ADD in docker history of $imgName"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should start with capital letter.

# If it's the first container, fail the test
if [ $fail -eq 0 ]; then
warn "$check_5_28"
warn " * pidslimit not set: $c"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should start with capital letter.

warn " * pidslimit not set: $c"
fail=1
else
warn " * pidslimit not set: $c"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should start with capital letter.

fail=1
fi
for c in $docker0Containers; do
warn " * container in docker0 network: $c"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should start with capital letter.

fi

# 2.17
check_2_17="2.17 - Bind swarm services to a specific host interface"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does not check if a specific host interface is used.

$ netstat -tl | grep 2377
tcp        0      0 10.2.3.41:2377          *:*                     LISTEN 

warn "$check_4_6"
fi
imgName=`docker inspect --format='{{.RepoTags}}' $img 2>/dev/null`
warn " No Healthcheck found : $imgName"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use consistent warning and info messages. Start with a * and capital letter.

@konstruktoid
Copy link
Collaborator

@vadapalliravikumar please see the comments, could you update your PR?

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/docker/docker/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "docker-benchmark-1.12.0" git@github.com:vadapalliravikumar/docker-bench-security.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354447304
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

@konstruktoid konstruktoid merged commit 200152d into docker:master Jan 23, 2017
@konstruktoid
Copy link
Collaborator

Merging and we'll go from there, so you can get credit for the work you've done.

konstruktoid added a commit to konstruktoid/docker-bench-security that referenced this pull request Jan 23, 2017
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
konstruktoid added a commit that referenced this pull request Jan 23, 2017
konstruktoid added a commit to konstruktoid/docker-bench-security that referenced this pull request Jan 23, 2017
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
konstruktoid added a commit that referenced this pull request Jan 23, 2017
konstruktoid added a commit to konstruktoid/docker-bench-security that referenced this pull request Jan 23, 2017
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
konstruktoid added a commit that referenced this pull request Jan 23, 2017
konstruktoid added a commit to konstruktoid/docker-bench-security that referenced this pull request Jan 23, 2017
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
konstruktoid added a commit that referenced this pull request Jan 23, 2017
konstruktoid added a commit that referenced this pull request Jan 23, 2017
@vadapalliravikumar
Copy link
Contributor Author

Thank you for merging the changes. Sorry about not being able to manage time to address the comments before the merge.

@konstruktoid
Copy link
Collaborator

You're welcome @vadapalliravikumar, take care.

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 this pull request may close these issues.

3 participants