Skip to content

Commit 04e5f00

Browse files
committed
add swarm mode attribute
Signed-off-by: Patrick Münch <patrick.muench1111@gmail.com>
1 parent 6ab0aae commit 04e5f00

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ We use a yml attribute file to steer the configuration, the following options ar
6969
* `daemon_tlskey: /etc/docker/ssl/server_key.pem`
7070
configure the server key. cis-docker-benchmark-2.6
7171

72+
* `swarm_mode: Swarm: inactive`
73+
configure the swarm mode. cis-docker-benchmark-2.15
74+
7275
## Usage
7376

7477
InSpec makes it easy to run your tests wherever you need. More options listed here: [InSpec cli](http://inspec.io/docs/reference/cli/)

controls/docker_level2.rb

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@
5252
default: /label\:level\:s0-s0\:c1023/
5353
)
5454

55+
SWARM_MODE = attribute(
56+
'SWARM_MODE',
57+
description: 'define the swarm mode, active or inactive',
58+
default: 'Swarm: inactive'
59+
)
60+
5561
# check if docker exists
5662
only_if do
5763
command('docker').exist?
@@ -186,20 +192,7 @@
186192
ref 'docker swarm init', url: 'https://docs.docker.com/engine/reference/commandline/swarm_init/'
187193

188194
describe command('docker info') do
189-
its('stdout') { should include 'Swarm: inactive' }
190-
end
191-
end
192-
193-
control 'cis-docker-benchmark-2.16' do
194-
impact 1.0
195-
title 'Control the number of manager nodes in a swarm'
196-
desc 'Ensure that the minimum number of required manager nodes is created in a swarm.'
197-
tag 'daemon'
198-
tag cis: '2.16'
199-
ref 'docker swarm init', url: 'https://docs.docker.com/engine/reference/commandline/swarm_init/'
200-
201-
describe command('docker info') do
202-
its('stdout') { should include 'Swarm: inactive' }
195+
its('stdout') { should include SWARM_MODE }
203196
end
204197
end
205198

0 commit comments

Comments
 (0)