Skip to content

Commit bc47f47

Browse files
authored
Merge pull request #5 from atomic111/master
add ruby 2.3.1 to travis.yml
2 parents 8d49cee + adbc615 commit bc47f47

6 files changed

Lines changed: 45 additions & 15 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ rvm:
66
- 1.9.3
77
- 2.0.0
88
- 2.2.0
9+
- 2.3.1
910

1011
bundler_args: --without integration
1112
script: bundle exec rake

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CIS Docker Benchmark - InSpec Profile
22

3+
[![Build Status](http://img.shields.io/travis/dev-sec/cis-docker-benchmark.svg)][1]
4+
[![Supermarket](https://img.shields.io/badge/CIS%20Docker%20Benchmark-InSpec%20Profile-brightgreen.svg)](https://supermarket.chef.io/tools/cis-docker-benchmark)
5+
[![Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)][2]
6+
37
## Description
48

59
This [InSpec](https://github.com/chef/inspec) compliance profile implement the [CIS Docker 1.11.0 Benchmark](https://benchmarks.cisecurity.org/downloads/show-single/index.cfm?file=docker16.110) in an automated way to provide security best-practice tests around Docker daemon and containers in a production environment.
@@ -102,4 +106,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
102106
See the License for the specific language governing permissions and
103107
limitations under the License.
104108

105-
[1]: https://benchmarks.cisecurity.org/tools2/docker/CIS_Docker_1.11.0_Benchmark_v1.0.0.pdf
109+
[1]: http://travis-ci.org/dev-sec/cis-docker-benchmark
110+
[2]: https://gitter.im/dev-sec/general
111+
[3]: https://benchmarks.cisecurity.org/tools2/docker/CIS_Docker_1.11.0_Benchmark_v1.0.0.pdf

controls/docker_host_os_level1.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# encoding: utf-8
2+
# frozen_string_literal: true
23
#
34
# Copyright 2016, Patrick Muench
45
#
@@ -150,14 +151,14 @@
150151
desc 'Apart from auditing your regular Linux file system and system calls, audit all Docker related files and directories. Docker daemon runs with \'root\' privileges. Its behavior depends on some key files and directories. docker.service is one such file. The docker.service file might be present if the daemon parameters have been changed by an administrator. It holds various parameters for Docker daemon. It must be audited, if applicable.'
151152
ref 'https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html'
152153

153-
unless docker.path.nil?
154+
if docker.path
154155
rule = '-w ' << docker.path << ' -p rwxa -k docker'
155156
describe auditd_rules do
156157
its(:lines) { should include(rule) }
157158
end
158159
else
159160
describe 'audit docker service' do
160-
skip "Cannot determine docker path"
161+
skip 'Cannot determine docker path'
161162
end
162163
end
163164
end
@@ -168,14 +169,14 @@
168169
desc 'Apart from auditing your regular Linux file system and system calls, audit all Docker related files and directories. Docker daemon runs with \'root\' privileges. Its behavior depends on some key files and directories. docker.service is one such file. The docker.service file might be present if the daemon parameters have been changed by an administrator. It holds various parameters for Docker daemon. It must be audited, if applicable.'
169170
ref 'https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html'
170171

171-
unless docker.path.nil?
172+
if docker.path
172173
rule = '-w ' << docker.socket << ' -p rwxa -k docker'
173174
describe auditd_rules do
174175
its(:lines) { should include(rule) }
175176
end
176177
else
177178
describe 'audit docker service' do
178-
skip "Cannot determine docker socket"
179+
skip 'Cannot determine docker socket'
179180
end
180181
end
181182
end

controls/docker_level1.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# encoding: utf-8
2+
# frozen_string_literal: true
23
#
34
# Copyright 2016, Patrick Muench
45
#
@@ -581,13 +582,13 @@
581582
info['Mounts'].each do |mounts|
582583
describe mounts['Source'] do
583584
it { should_not eq '/' }
584-
it { should_not match(/\/boot/) }
585-
it { should_not match(/\/dev/) }
586-
it { should_not match(/\/etc/) }
587-
it { should_not match(/\/lib/) }
588-
it { should_not match(/\/proc/) }
589-
it { should_not match(/\/sys/) }
590-
it { should_not match(/\/usr/) }
585+
it { should_not match(%r{\/boot}) }
586+
it { should_not match(%r{\/dev}) }
587+
it { should_not match(%r{\/etc}) }
588+
it { should_not match(%r{\/lib}) }
589+
it { should_not match(%r{\/proc}) }
590+
it { should_not match(%r{\/sys}) }
591+
it { should_not match(%r{\/usr}) }
591592
end
592593
end
593594
end

controls/docker_level2.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# encoding: utf-8
2+
# frozen_string_literal: true
23
#
34
# Copyright 2016, Patrick Muench
45
#

libraries/docker.rb

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
# encoding: utf-8
2+
#
3+
# Copyright 2016, Christoph Hartmann
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# author: Christoph Hartmann
18+
# author: Dominik Richter
19+
# author: Patrick Muench
20+
121
require 'yaml'
222

323
class Docker < Inspec.resource(1)
@@ -26,7 +46,7 @@ def path
2646
params = parse_systemd_values(cmd.stdout.chomp)
2747

2848
# return the value
29-
params["FragmentPath"]
49+
params['FragmentPath']
3050
end
3151

3252
def socket
@@ -37,7 +57,7 @@ def socket
3757
params = parse_systemd_values(cmd.stdout.chomp)
3858

3959
# return the value
40-
params["FragmentPath"]
60+
params['FragmentPath']
4161
end
4262

4363
private
@@ -47,7 +67,7 @@ def parse_systemd_values(stdout)
4767
SimpleConfig.new(
4868
stdout,
4969
assignment_re: /^\s*([^=]*?)\s*=\s*(.*?)\s*$/,
50-
multiple_values: false,
70+
multiple_values: false
5171
).params
5272
end
5373
end

0 commit comments

Comments
 (0)