• Stars
    star
    482
  • Rank 90,695 (Top 2 %)
  • Language
    Ruby
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

CIS Docker Benchmark - InSpec Profile

CIS Docker Benchmark - InSpec Profile

Build Status Supermarket Gitter Chat

Description

This InSpec compliance profile implement the CIS Docker 1.13.0 Benchmark in an automated way to provide security best-practice tests around Docker daemon and containers in a production environment.

InSpec is an open-source run-time framework and rule language used to specify compliance, security, and policy requirements for testing any node in your infrastructure.

Requirements

  • at least InSpec version 2.3.23
  • Docker 1.13+

Platform

  • Debian 8
  • Ubuntu 16.04
  • CentOS 7

Attributes

We use a yml attribute file to steer the configuration, the following options are available:

  • trusted_user: vagrant define trusted user to control Docker daemon.
  • authorization_plugin: authz-broker define authorization plugin to manage access to Docker daemon.
  • log_driver: syslog define preferable way to store logs.
  • log_opts: /syslog-address/ define Docker daemon log-opts.
  • registry_cert_path: /etc/docker/certs.d directory contains various Docker registry directories.
  • registry_name: /etc/docker/certs.d/registry_hostname:port directory contain certificate certain Docker registry.
  • registry_ca_file: /etc/docker/certs.d/registry_hostname:port/ca.crt certificate file for a certain Docker registry certificate files.
  • container_user: vagrant define user within containers.
  • app_armor_profile: docker-default define apparmor profile for Docker containers.
  • selinux_profile: /label\:level\:s0-s0\:c1023/ define SELinux profile for Docker containers.
  • container_capadd: null define needed capabilities for containers. example: container_capadd: NET_ADMIN,SYS_ADMIN
  • managable_container_number: 25 keep number of containers on a host to a manageable total.
  • daemon_tlscacert : /etc/docker/ssl/ca.pem configure the certificate authority.
  • daemon_tlscert: /etc/docker/ssl/server_cert.pem configure the server certificate.
  • daemon_tlskey: /etc/docker/ssl/server_key.pem configure the server key.
  • swarm_mode: inactive configure the swarm mode.
  • swarm_max_manager_nodes: 3 configure the maximum number of swarm leaders.
  • swarm_port: 2377 configure the swarm port.
  • benchmark_version to execute also the old controls from previous benchmarks, e.g. set it to 1.12.0 to execute also the tests from cis-benchmark-1.12.0 (which is the default).

These settings can be overridden using an attributes file (e.g. --attrs <attributefile.yml>). See sample_attributes.yml as an example.

Usage

InSpec makes it easy to run your tests wherever you need. More options listed here: InSpec cli

# run profile locally
$ git clone https://github.com/dev-sec/cis-docker-benchmark
$ inspec exec cis-docker-benchmark

# run profile locally and directly from Github
$ inspec exec https://github.com/dev-sec/cis-docker-benchmark

# run profile on remote host via SSH
inspec exec cis-docker-benchmark -t ssh://user@hostname -i /path/to/key

# run profile on remote host via SSH with sudo
inspec exec cis-docker-benchmark -t ssh://user@hostname -i /path/to/key --sudo

# run profile on remote host via SSH with sudo and define attribute value
inspec exec cis-docker-benchmark --attrs sample_attributes.yml

# run profile direct from inspec supermarket
inspec supermarket exec dev-sec/cis-docker-benchmark -t ssh://user@hostname --key-files private_key --sudo

Run individual controls

In order to verify individual controls, just provide the control ids to InSpec:

inspec exec cis-docker-benchmark --controls 'cis-docker-benchmark-1.4 cis-docker-benchmark-1.5'

Contributors + Kudos

License and Author

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

ansible-collection-hardening

This Ansible collection provides battle tested hardening for Linux, SSH, nginx, MySQL
Jinja
3,906
star
2

linux-baseline

DevSec Linux Baseline - InSpec Profile
Ruby
774
star
3

ansible-ssh-hardening

This Ansible role provides numerous security-related ssh configurations, providing all-round base protection.
HTML
774
star
4

chef-os-hardening

This chef cookbook provides numerous security-related configurations, providing all-round base protection.
Ruby
438
star
5

hardening

DevSec Examples
Ruby
319
star
6

cis-kubernetes-benchmark

CIS Kubernetes Benchmark - InSpec Profile
Ruby
292
star
7

puppet-os-hardening

This puppet module provides numerous security-related configurations, providing all-round base protection.
Puppet
280
star
8

ssh-baseline

DevSec SSH Baseline - InSpec Profile
Ruby
275
star
9

windows-baseline

DevSec Windows Baseline - InSpec Profile
Ruby
218
star
10

ansible-nginx-hardening

This Ansible role provides secure nginx configurations.
Ruby
185
star
11

chef-ssh-hardening

This chef cookbook provides secure ssh-client and ssh-server configurations.
Ruby
160
star
12

cis-dil-benchmark

CIS Distribution Independent Linux Benchmark - InSpec Profile
Ruby
146
star
13

ansible-windows-hardening

This Ansible role provides windows hardening configurations for the DevSec Windows baseline profile.
Ruby
145
star
14

ansible-mysql-hardening

This Ansible role provides security configuration for MySQL.
Ruby
140
star
15

nginx-baseline

DevSec Nginx Baseline - InSpec Profile
Ruby
102
star
16

chef-windows-hardening

This chef cookbook provides windows hardening configurations for the DevSec Windows baseline profile.
Ruby
97
star
17

linux-patch-baseline

DevSec Linux Patch Baseline - InSpec Profile
Ruby
85
star
18

ssl-baseline

DevSec SSL/TLS Baseline - InSpec Profile
Ruby
65
star
19

puppet-ssh-hardening

This puppet module provides secure ssh-client and ssh-server configurations.
Ruby
59
star
20

mysql-baseline

DevSec MySQL Baseline - InSpec Profile
Ruby
58
star
21

postgres-baseline

DevSec PostgreSQL Baseline - InSpec Profile
Ruby
50
star
22

chef-nginx-hardening

This chef cookbook provides secure nginx configurations.
Ruby
50
star
23

windows-patch-baseline

DevSec Windows Patch Baseline - InSpec Profile
Ruby
47
star
24

apache-baseline

DevSec Apache Baseline - InSpec Profile
Ruby
38
star
25

ansible-apache-hardening

HTML
36
star
26

example-puppet-hardening

β›” DEPRECATED
Dockerfile
34
star
27

php-baseline

DevSec PHP baseline - InSpec Profile
Ruby
27
star
28

chef-postgres-hardening

This chef cookbook provides security configuration for PostgreSQL.
Ruby
27
star
29

chef-mysql-hardening

This chef cookbook provides security configuration for mysql.
Ruby
26
star
30

chef-apache-hardening

Ruby
25
star
31

puppet-nginx-hardening

Nginx Web Server Hardening with Puppet
Puppet
23
star
32

docker-ansible

Docker containers that include ansible latest stable 2.x version.
Dockerfile
23
star
33

openstack-baseline

Use InSpec to run through the configurations from the OpenStack Security Guide.
Ruby
18
star
34

puppet-mysql-hardening

MySql Server Hardening with Puppet
Puppet
18
star
35

dev-sec.github.io

project website
SCSS
18
star
36

chef-jenkins-hardening

β›” DEPRECATED: A secure jenkins installation
Ruby
17
star
37

puppet-apache-hardening

Apache Web Server Hardening with Puppet
HTML
15
star
38

docs

β›” DEPRECATED, migrated to dev-sec/dev-sec.github.io
12
star
39

puppet-postgres-hardening

Postgres Web Server Hardening with Puppet
Puppet
11
star
40

patcher

β›” DEPRECATED: CLI to extract patches from InSpec report
Ruby
7
star
41

blog

β›” DEPRECATED, migrated to dev-sec/dev-sec.github.io
HTML
6
star
42

pam-tester

Python
5
star
43

git-contributors

Get contributors of your git repos.
Ruby
4
star
44

puppet-hardening-stdlib

Shared functions for puppet hardening.
Ruby
4
star
45

chef-percona-hardening

β›” DEPRECATED: Security Configuration for Percona
Ruby
4
star
46

chef-linux-patch

β›” DEPRECATED: Update Linux packages according to InSpec linux-patch-baseline output
Ruby
4
star
47

cnspec-collection-baselines

DevSec Security Baselines provide battle tested hardening checks for Linux, SSH, nginx, MySQL in cnspec
4
star
48

.github

2
star