-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Test 1_1 fails when user namespaces are enabled #363
Conversation
Please sign your commits following these rules: $ git clone -b "master" [email protected]:dginther/docker-bench-security.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f Amending updates the existing PR. You DO NOT need to open a new one. |
Signed-off-by: Demian Ginther <[email protected]>
Hi @dginther, there's a discussion going on at #332 (comment) and is kind of related to this. |
I noticed that conversation, and I saw there were similar issues, figured I'd take a stab at a solution. perhaps it would be better to find a solution that determines whether the Docker Root Dir is on the same filesystem as the root filesystem, and PASS if it is not? |
Instead of making some if statements for more than one case, how about this approach? Get the path and UUID of the Docker Home Dir Check that UUID against the parent paths of the Docker Home Dir If the UUID matches a parent path, we are not on our own volume.
@konstruktoid Thought about this a lot today and came up with a different approach. Take a look and see if this might be a better way to do things? You're already using the util-linux package for mountpoint, so findmnt is available. This PR gets the filesystem UUID that the docker home directory is on, checks the parents of that directory to see if the UUID matches, and fails if it does. The idea here is that the UUID for the filesystem that the docker directory is on should definitely NOT match the UUID of the filesystems of its parent directories, if it's on its own volume. |
Thanks, but could you run a
|
the more I look at this code the less I feel like I am barking up the right tree with this test. I'm not sure there is a good way to determine this programmatically, without checking to see if the homedir is set the way it is because of user namespaces or overlay. Edge cases abound. I see originally it looked to see if $DOCKER_HOME was in fstab, but even that doesn't really give a good way of making this work. |
When user namespaces are enabled as per test 2_8, this causes test 1_1 to fail because the Docker Root Dir is set to for example: /var/lib/docker/808080:808080.
This adds a test to see if userns is enabled and uses the dirname utility to get the parent directory, which should be the mount point.