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

Test running docker via -t docker:// #36

Open
bartosznaumowicz-olx opened this issue Jul 18, 2017 · 9 comments
Open

Test running docker via -t docker:// #36

bartosznaumowicz-olx opened this issue Jul 18, 2017 · 9 comments

Comments

@bartosznaumowicz-olx
Copy link

Hi,
is it possible to test running dokcer with this profile? I'm trying to run it via docker and point different container.
docker run -it --rm -v $(pwd):/share -v /var/run/docker.sock:/var/run/docker.sock chef/inspec exec https://github.com/dev-sec/cis-docker-benchmark -t docker://<container_id>

All what I get is 99 skipped controls.

@atomic111
Copy link
Member

Hi @bartosznaumowicz-olx , if i understood your question correctly you want to test the services within the container. like a nginx or so? Then you have to execute the nginx-baseline in the container.

Those tests running on the docker host and it inspect the container and there capabilities like this test: https://github.com/dev-sec/cis-docker-benchmark/blob/master/controls/container_runtime.rb#L96-L115, as an example. This test checks kernel capabilities for containers.

@bartosznaumowicz-olx
Copy link
Author

Hi,
not quite. I have a running container for e.g. 0b059353c982. Lets say it's a ubuntu 16.04. From host I would like to scan this container via command provided upper.

Or, perhaps, cis-docker-benchmark can scan only host machine?

@atomic111
Copy link
Member

@bartosznaumowicz-olx Sorry, may be i have a long line today. This Benchamrk tests the docker host and the running containers on this host. Inspec is able to inspect the running container via the docker api.

you execute the cis-docker-benchmark like inspec exec cis-docker-benchmark -t ssh://. Some tests iterate over the running container to check the privs, the capabilities and so on for a running container.

May be, you describe me what do you want to test on the running container. As an example, you want to test, if a container runs with the privileged flag. then this is the test for you: https://github.com/dev-sec/cis-docker-benchmark/blob/master/controls/container_runtime.rb#L117-L133

You can execute the test, if you take this command: inspec exec cis-docker-benchmark -t ssh://. Inspec iterates over the running container and extract if the flag is set.

@bartosznaumowicz-olx
Copy link
Author

So if I'm running it via docker and want to test host machine I need to ssh to host? That's the only supported protocol? I can't use -t docker://<container_id> to point container that I want to scan?

@atomic111
Copy link
Member

the cis-docker-benchmark design is to have access to the docker host to inspec the CIS Rules from the host and the running container. You can run it locally like inspec exec cis-docker-benchmark.

You can use the ssh-baseline, nginx-baseline or so to inspect the running config inside of a container via inspec exec nginx-baseline -t docker://.

Can you please describe what do you want to achieve? Do you want to test a service within the container?

@bartosznaumowicz-olx
Copy link
Author

I'm trying to verify if container is compliant with PCI requirements. No difference what kind of service is running inside.

When I'm trying to do this with -t docker:// all my tests a skipped.

@atomic111
Copy link
Member

sorry, now i got your point. the baseline design is that you execute inspec via ssh or locally on shell.

if you want to use the baseline via the docker api, then we need some changes. feel free to create some PRs for that. this would help.

@atomic111
Copy link
Member

@bartosznaumowicz-olx this is a nice tutorial about the inspec docker resource http://lollyrock.com/articles/inspec-for-docker/

@atomic111
Copy link
Member

@bartosznaumowicz-olx can i close this issue?

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

2 participants