inspec 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +58 -8
- data/README.md +8 -39
- data/Rakefile +74 -9
- data/bin/inspec +66 -10
- data/docs/ctl_inspec.rst +7 -1
- data/docs/inspec_and_friends.rst +1 -1
- data/docs/resources.rst +51 -45
- data/examples/README.md +7 -0
- data/examples/kitchen-ansible/.kitchen.yml +25 -0
- data/examples/kitchen-ansible/Gemfile +20 -0
- data/examples/kitchen-ansible/README.md +53 -0
- data/examples/kitchen-ansible/files/nginx.repo +6 -0
- data/examples/kitchen-ansible/tasks/main.yml +16 -0
- data/examples/kitchen-ansible/test/integration/default/default.yml +5 -0
- data/examples/{test-kitchen → kitchen-ansible}/test/integration/default/web_spec.rb +0 -0
- data/examples/{test-kitchen → kitchen-chef}/.kitchen.yml +1 -1
- data/examples/{test-kitchen → kitchen-chef}/Berksfile +0 -0
- data/examples/{test-kitchen → kitchen-chef}/Gemfile +1 -2
- data/examples/{test-kitchen → kitchen-chef}/README.md +1 -1
- data/examples/{test-kitchen → kitchen-chef}/metadata.rb +0 -0
- data/examples/{test-kitchen → kitchen-chef}/recipes/default.rb +0 -0
- data/examples/{test-kitchen → kitchen-chef}/recipes/nginx.rb +0 -0
- data/examples/kitchen-chef/test/integration/default/web_spec.rb +28 -0
- data/examples/kitchen-puppet/.kitchen.yml +22 -0
- data/examples/kitchen-puppet/Gemfile +21 -0
- data/examples/kitchen-puppet/Puppetfile +25 -0
- data/examples/kitchen-puppet/README.md +53 -0
- data/examples/kitchen-puppet/manifests/site.pp +33 -0
- data/examples/kitchen-puppet/metadata.json +11 -0
- data/examples/kitchen-puppet/test/integration/default/web_spec.rb +28 -0
- data/inspec.gemspec +2 -0
- data/lib/inspec/plugins/resource.rb +21 -0
- data/lib/inspec/shell.rb +73 -11
- data/lib/inspec/version.rb +1 -1
- data/lib/matchers/matchers.rb +43 -0
- data/lib/resources/apache_conf.rb +12 -9
- data/lib/resources/apt.rb +7 -0
- data/lib/resources/audit_policy.rb +6 -6
- data/lib/resources/auditd_conf.rb +6 -7
- data/lib/resources/auditd_rules.rb +9 -8
- data/lib/resources/bond.rb +6 -6
- data/lib/resources/bridge.rb +7 -0
- data/lib/resources/command.rb +10 -8
- data/lib/resources/csv.rb +6 -5
- data/lib/resources/directory.rb +6 -0
- data/lib/resources/etc_group.rb +9 -1
- data/lib/resources/file.rb +72 -61
- data/lib/resources/gem.rb +6 -4
- data/lib/resources/group.rb +7 -0
- data/lib/resources/host.rb +6 -0
- data/lib/resources/inetd_conf.rb +8 -8
- data/lib/resources/ini.rb +6 -6
- data/lib/resources/interface.rb +8 -8
- data/lib/resources/iptables.rb +6 -0
- data/lib/resources/json.rb +6 -5
- data/lib/resources/kernel_module.rb +6 -5
- data/lib/resources/kernel_parameter.rb +6 -4
- data/lib/resources/limits_conf.rb +6 -6
- data/lib/resources/login_def.rb +6 -0
- data/lib/resources/mysql_conf.rb +6 -0
- data/lib/resources/mysql_session.rb +7 -0
- data/lib/resources/npm.rb +6 -4
- data/lib/resources/ntp_conf.rb +7 -7
- data/lib/resources/oneget.rb +6 -0
- data/lib/resources/os.rb +8 -0
- data/lib/resources/os_env.rb +6 -0
- data/lib/resources/package.rb +8 -1
- data/lib/resources/parse_config.rb +14 -0
- data/lib/resources/passwd.rb +7 -0
- data/lib/resources/pip.rb +6 -0
- data/lib/resources/port.rb +22 -11
- data/lib/resources/postgres_conf.rb +6 -0
- data/lib/resources/postgres_session.rb +8 -0
- data/lib/resources/processes.rb +17 -1
- data/lib/resources/registry_key.rb +7 -0
- data/lib/resources/script.rb +11 -0
- data/lib/resources/security_policy.rb +6 -1
- data/lib/resources/service.rb +10 -0
- data/lib/resources/ssh_conf.rb +6 -0
- data/lib/resources/user.rb +9 -2
- data/lib/resources/windows_feature.rb +6 -0
- data/lib/resources/yaml.rb +6 -0
- data/lib/resources/yum.rb +7 -0
- data/lib/utils/find_files.rb +15 -7
- data/test/helper.rb +9 -0
- data/test/integration/.kitchen.yml +3 -0
- data/test/integration/test/integration/default/compare_matcher_spec.rb +19 -0
- data/test/integration/test/integration/default/etc_group.rb +13 -0
- data/test/integration/test/integration/default/os_spec.rb +13 -0
- data/test/integration/test/integration/default/port_spec.rb +1 -1
- data/test/unit/mock/cmd/find-apache2-conf-enabled +1 -0
- data/test/unit/mock/cmd/find-apache2-ports-conf +1 -0
- data/test/unit/mock/cmd/ps-aux +2 -0
- data/test/unit/mock/files/apache2.conf +14 -0
- data/test/unit/mock/files/ports.conf +6 -0
- data/test/unit/mock/files/serve-cgi-bin.conf +20 -0
- data/test/unit/resources/apache_conf_test.rb +31 -0
- data/test/unit/resources/file_test.rb +181 -0
- data/test/unit/resources/package_test.rb +9 -0
- data/test/unit/resources/port_test.rb +33 -13
- data/test/unit/resources/processes_test.rb +6 -0
- data/test/unit/resources/service_test.rb +10 -0
- data/test/unit/resources/user_test.rb +12 -0
- data/test/unit/utils/find_files_test.rb +23 -0
- metadata +61 -16
- data/bin/inspec.orig +0 -115
- data/lib/resources/.service.rb.swp +0 -0
- data/test/unit/mock/profiles/rules/metadata.rb +0 -2
- data/test/unit/mock/profiles/rules/test/test.rb +0 -6
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
require 'inspec/resource'
|
|
3
|
+
|
|
4
|
+
def shared_file_permission_tests(method_under_test)
|
|
5
|
+
it 'returns false if the file does not exist' do
|
|
6
|
+
resource.stubs(:exist?).returns(false)
|
|
7
|
+
resource.send(method_under_test, nil, nil).must_equal(false)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'returns the value of #file_permission_granted?' do
|
|
11
|
+
resource.stubs(:exist?).returns(true)
|
|
12
|
+
resource.stubs(:file_permission_granted?).returns('test_result')
|
|
13
|
+
resource.send(method_under_test, nil, nil).must_equal('test_result')
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe Inspec::Resources::File do
|
|
18
|
+
let(:resource) { load_resource('file', '/fakepath/fakefile') }
|
|
19
|
+
let(:os) { stub(:[] => { 'family' => 'fakefamily' }) }
|
|
20
|
+
let(:inspec) { stub(os: os) }
|
|
21
|
+
|
|
22
|
+
before { resource.stubs(:inspec).returns(inspec) }
|
|
23
|
+
|
|
24
|
+
describe '#readable?' do
|
|
25
|
+
shared_file_permission_tests(:readable?)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe '#writable?' do
|
|
29
|
+
shared_file_permission_tests(:writable?)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe '#executable?' do
|
|
33
|
+
shared_file_permission_tests(:executable?)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
describe '#to_s' do
|
|
37
|
+
it 'returns a properly formatted string' do
|
|
38
|
+
resource.to_s.must_equal('File /fakepath/fakefile')
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe '#file_permission_granted?' do
|
|
43
|
+
describe 'when not on a unix OS' do
|
|
44
|
+
it 'raises an exception' do
|
|
45
|
+
resource.stubs(:unix?).returns(false)
|
|
46
|
+
|
|
47
|
+
proc { resource.send(:file_permission_granted?, 'flag', nil, nil) }.must_raise(RuntimeError)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
describe 'when on a unix OS' do
|
|
52
|
+
before do
|
|
53
|
+
resource.stubs(:unix?).returns(true)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
describe 'when no user is provided' do
|
|
57
|
+
it 'checks file permission by mask' do
|
|
58
|
+
resource.expects(:check_file_permission_by_mask).with('usergroup', 'flag')
|
|
59
|
+
resource.send(:file_permission_granted?, 'flag', 'usergroup', nil)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
describe 'when a user is provided' do
|
|
64
|
+
it 'checks file permission by user' do
|
|
65
|
+
resource.expects(:check_file_permission_by_user).with('user', 'flag')
|
|
66
|
+
resource.send(:file_permission_granted?, 'flag', nil, 'user')
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
describe '#check_file_permission_by_mask' do
|
|
73
|
+
describe 'when no mask is returned' do
|
|
74
|
+
let(:file) { stub(unix_mode_mask: nil) }
|
|
75
|
+
|
|
76
|
+
it 'raises an exception' do
|
|
77
|
+
file = stub(unix_mode_mask: nil)
|
|
78
|
+
resource.stubs(:file).returns(file)
|
|
79
|
+
proc { resource.send(:check_file_permission_by_mask, 'usergroup', 'flag') }.must_raise(RuntimeError)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
describe 'when a mask is returned' do
|
|
84
|
+
describe 'when the bitwise AND returns a non-zero' do
|
|
85
|
+
let(:file) { stub(unix_mode_mask: 292, mode: 420) }
|
|
86
|
+
it 'returns true' do
|
|
87
|
+
resource.stubs(:file).returns(file)
|
|
88
|
+
resource.send(:check_file_permission_by_mask, 'usergroup', 'flag').must_equal(true)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
describe 'when the bitwise AND returns zero' do
|
|
93
|
+
let(:file) { stub(unix_mode_mask: 73, mode: 420) }
|
|
94
|
+
it 'returns false' do
|
|
95
|
+
resource.stubs(:file).returns(file)
|
|
96
|
+
resource.send(:check_file_permission_by_mask, 'usergroup', 'flag').must_equal(false)
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
describe 'check_file_permission_by_user' do
|
|
103
|
+
describe 'when on linux' do
|
|
104
|
+
before do
|
|
105
|
+
resource.stubs(:linux?).returns(true)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
it 'executes a properly formatted command' do
|
|
109
|
+
cmd = stub(exit_status: 0)
|
|
110
|
+
inspec.expects(:command).with('su -s /bin/sh -c "test -flag /fakepath/fakefile" user').returns(cmd)
|
|
111
|
+
resource.send(:check_file_permission_by_user, 'user', 'flag')
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it 'returns true when the cmd exits 0' do
|
|
115
|
+
cmd = stub(exit_status: 0)
|
|
116
|
+
inspec.stubs(:command).returns(cmd)
|
|
117
|
+
resource.send(:check_file_permission_by_user, 'user', 'flag').must_equal(true)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
it 'returns true when the cmd exits non-zero' do
|
|
121
|
+
cmd = stub(exit_status: 1)
|
|
122
|
+
inspec.stubs(:command).returns(cmd)
|
|
123
|
+
resource.send(:check_file_permission_by_user, 'user', 'flag').must_equal(false)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
describe 'when on freebsd' do
|
|
128
|
+
before do
|
|
129
|
+
resource.stubs(:linux?).returns(false)
|
|
130
|
+
resource.stubs(:family).returns('freebsd')
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
it 'executes a properly formatted command' do
|
|
134
|
+
cmd = stub(exit_status: 0)
|
|
135
|
+
inspec.expects(:command).with('sudo -u user test -flag /fakepath/fakefile').returns(cmd)
|
|
136
|
+
resource.send(:check_file_permission_by_user, 'user', 'flag')
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it 'returns true when the cmd exits 0' do
|
|
140
|
+
cmd = stub(exit_status: 0)
|
|
141
|
+
inspec.stubs(:command).returns(cmd)
|
|
142
|
+
resource.send(:check_file_permission_by_user, 'user', 'flag').must_equal(true)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
it 'returns true when the cmd exits non-zero' do
|
|
146
|
+
cmd = stub(exit_status: 1)
|
|
147
|
+
inspec.stubs(:command).returns(cmd)
|
|
148
|
+
resource.send(:check_file_permission_by_user, 'user', 'flag').must_equal(false)
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
describe 'when not on linux or freebsd' do
|
|
153
|
+
before do
|
|
154
|
+
resource.stubs(:linux?).returns(false)
|
|
155
|
+
resource.stubs(:family).returns('fakefamily')
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
it 'returns an error string' do
|
|
159
|
+
resource.send(:check_file_permission_by_user, 'user', 'flag').must_equal('The `file` resource does not support `by_user` on your OS.')
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
describe '#usergroup_for' do
|
|
165
|
+
it 'returns "other" if "others" is provided' do
|
|
166
|
+
resource.send(:usergroup_for, 'others', nil).must_equal('other')
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
it 'returns "all" if no usergroup or user is specified' do
|
|
170
|
+
resource.send(:usergroup_for, nil, nil).must_equal('all')
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
it 'returns nil if the usergroup is nil and a user is specified' do
|
|
174
|
+
resource.send(:usergroup_for, nil, 'user').must_equal(nil)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
it 'returns the passed-in usergroup if usergroup is not nil and user is nil' do
|
|
178
|
+
resource.send(:usergroup_for, 'mygroup', nil).must_equal('mygroup')
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
@@ -33,6 +33,15 @@ describe 'Inspec::Resources::Package' do
|
|
|
33
33
|
_(resource.info).must_equal pkg
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
# wrlinux
|
|
37
|
+
it 'verify wrlinux package parsing' do
|
|
38
|
+
resource = MockLoader.new(:wrlinux).load_resource('package', 'curl')
|
|
39
|
+
pkg = { name: 'curl', installed: true, version: '7.29.0', type: 'rpm' }
|
|
40
|
+
_(resource.installed?).must_equal true
|
|
41
|
+
_(resource.version).must_equal '7.29.0'
|
|
42
|
+
_(resource.info).must_equal pkg
|
|
43
|
+
end
|
|
44
|
+
|
|
36
45
|
# windows
|
|
37
46
|
it 'verify windows package parsing' do
|
|
38
47
|
resource = MockLoader.new(:windows).load_resource('package', 'Microsoft Visual C++ 2008 Redistributable - x64 9.0.30729.6161')
|
|
@@ -9,38 +9,58 @@ describe 'Inspec::Resources::Port' do
|
|
|
9
9
|
it 'verify port on Ubuntu 14.04' do
|
|
10
10
|
resource = MockLoader.new(:ubuntu1404).load_resource('port', 22)
|
|
11
11
|
_(resource.listening?).must_equal true
|
|
12
|
-
_(resource.
|
|
13
|
-
_(resource.
|
|
14
|
-
_(resource.
|
|
12
|
+
_(resource.protocols).must_equal %w{ tcp tcp6 }
|
|
13
|
+
_(resource.pids).must_equal [1]
|
|
14
|
+
_(resource.processes).must_equal ['sshd']
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
it 'verify port on MacOs x' do
|
|
18
18
|
resource = MockLoader.new(:osx104).load_resource('port', 2022)
|
|
19
19
|
_(resource.listening?).must_equal true
|
|
20
|
-
_(resource.
|
|
21
|
-
_(resource.
|
|
20
|
+
_(resource.protocols).must_equal ['tcp']
|
|
21
|
+
_(resource.processes).must_equal ['VBoxHeadl']
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
it 'verify port on Windows' do
|
|
25
25
|
resource = MockLoader.new(:windows).load_resource('port', 135)
|
|
26
26
|
_(resource.listening?).must_equal true
|
|
27
|
-
_(resource.
|
|
28
|
-
_(resource.
|
|
27
|
+
_(resource.protocols).must_equal ['tcp']
|
|
28
|
+
_(resource.processes).must_equal nil
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it 'verify port on FreeBSD' do
|
|
32
32
|
resource = MockLoader.new(:freebsd10).load_resource('port', 22)
|
|
33
33
|
_(resource.listening?).must_equal true
|
|
34
|
-
_(resource.
|
|
35
|
-
_(resource.
|
|
36
|
-
_(resource.
|
|
34
|
+
_(resource.protocols).must_equal %w{ tcp6 tcp }
|
|
35
|
+
_(resource.pids).must_equal [668]
|
|
36
|
+
_(resource.processes).must_equal ['sshd']
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'verify port on wrlinux' do
|
|
40
|
+
resource = MockLoader.new(:wrlinux).load_resource('port', 22)
|
|
41
|
+
_(resource.listening?).must_equal true
|
|
42
|
+
_(resource.protocols).must_equal %w{ tcp tcp6 }
|
|
43
|
+
_(resource.processes).must_equal ['sshd']
|
|
37
44
|
end
|
|
38
45
|
|
|
39
46
|
it 'verify running on undefined' do
|
|
40
47
|
resource = MockLoader.new(:undefined).load_resource('port', 22)
|
|
41
48
|
_(resource.listening?).must_equal false
|
|
42
|
-
_(resource.
|
|
43
|
-
_(resource.
|
|
44
|
-
_(resource.
|
|
49
|
+
_(resource.protocols).must_equal nil
|
|
50
|
+
_(resource.pids).must_equal nil
|
|
51
|
+
_(resource.processes).must_equal nil
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'verify port and interface on Ubuntu 14.04' do
|
|
55
|
+
resource = MockLoader.new(:ubuntu1404).load_resource('port', '0.0.0.0', 22)
|
|
56
|
+
_(resource.listening?).must_equal true
|
|
57
|
+
_(resource.protocols).must_equal %w{ tcp }
|
|
58
|
+
_(resource.pids).must_equal [1]
|
|
59
|
+
_(resource.processes).must_equal ['sshd']
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'verify not listening port on interface on Ubuntu 14.04' do
|
|
63
|
+
resource = MockLoader.new(:ubuntu1404).load_resource('port', '127.0.0.1', 22)
|
|
64
|
+
_(resource.listening?).must_equal false
|
|
45
65
|
end
|
|
46
66
|
end
|
|
@@ -29,4 +29,10 @@ describe 'Inspec::Resources::Processes' do
|
|
|
29
29
|
|
|
30
30
|
_(resource.list.length).must_equal 1
|
|
31
31
|
end
|
|
32
|
+
|
|
33
|
+
it 'retrieves the users and states as arrays' do
|
|
34
|
+
resource = load_resource('processes', 'svc')
|
|
35
|
+
_(resource.users.sort).must_equal ['noot']
|
|
36
|
+
_(resource.states.sort).must_equal ['S', 'Ss']
|
|
37
|
+
end
|
|
32
38
|
end
|
|
@@ -107,6 +107,16 @@ describe 'Inspec::Resources::Service' do
|
|
|
107
107
|
_(resource.running?).must_equal true
|
|
108
108
|
end
|
|
109
109
|
|
|
110
|
+
# wrlinux
|
|
111
|
+
it 'verify wrlinux package parsing' do
|
|
112
|
+
resource = MockLoader.new(:wrlinux).load_resource('service', 'sshd')
|
|
113
|
+
srv = { name: 'sshd', description: nil, installed: true, running: true, enabled: true, type: 'sysv' }
|
|
114
|
+
_(resource.info).must_equal srv
|
|
115
|
+
_(resource.installed?).must_equal true
|
|
116
|
+
_(resource.enabled?).must_equal true
|
|
117
|
+
_(resource.running?).must_equal true
|
|
118
|
+
end
|
|
119
|
+
|
|
110
120
|
# unknown OS
|
|
111
121
|
it 'verify package handling on unsupported os' do
|
|
112
122
|
resource = MockLoader.new(:undefined).load_resource('service', 'dhcp')
|
|
@@ -56,6 +56,18 @@ describe 'Inspec::Resources::User' do
|
|
|
56
56
|
_(resource.warndays).must_equal 7
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
+
it 'read user on centos7' do
|
|
60
|
+
resource = MockLoader.new(:wrlinux).load_resource('user', 'root')
|
|
61
|
+
_(resource.exists?).must_equal true
|
|
62
|
+
_(resource.group).must_equal 'root'
|
|
63
|
+
_(resource.groups).must_equal ['root']
|
|
64
|
+
_(resource.home).must_equal '/root'
|
|
65
|
+
_(resource.shell).must_equal '/bin/bash'
|
|
66
|
+
_(resource.mindays).must_equal 0
|
|
67
|
+
_(resource.maxdays).must_equal 99999
|
|
68
|
+
_(resource.warndays).must_equal 7
|
|
69
|
+
end
|
|
70
|
+
|
|
59
71
|
it 'read user on freebsd' do
|
|
60
72
|
resource = MockLoader.new(:freebsd10).load_resource('user', 'root')
|
|
61
73
|
_(resource.exists?).must_equal true
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# author: Stephan Renatus
|
|
3
|
+
|
|
4
|
+
require 'helper'
|
|
5
|
+
|
|
6
|
+
describe FindFiles do
|
|
7
|
+
let (:findfiles) do
|
|
8
|
+
class FindFilesTest
|
|
9
|
+
include FindFiles
|
|
10
|
+
def inspec
|
|
11
|
+
Inspec::Backend.create(backend: :mock)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
FindFilesTest.new
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe '#find_files' do
|
|
18
|
+
it 'returns an array (of findings)' do
|
|
19
|
+
files = findfiles.find_files('/no/such/mock', type: 'file', depth: 1)
|
|
20
|
+
files.must_equal([])
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inspec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dominik Richter
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-11
|
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: r-train
|
|
@@ -136,6 +136,20 @@ dependencies:
|
|
|
136
136
|
- - "~>"
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: mocha
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - "~>"
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '1.1'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - "~>"
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '1.1'
|
|
139
153
|
description: Validate Inspec compliance checks.
|
|
140
154
|
email:
|
|
141
155
|
- dominik.richter@gmail.com
|
|
@@ -153,21 +167,35 @@ files:
|
|
|
153
167
|
- README.md
|
|
154
168
|
- Rakefile
|
|
155
169
|
- bin/inspec
|
|
156
|
-
- bin/inspec.orig
|
|
157
170
|
- docs/ctl_inspec.rst
|
|
158
171
|
- docs/dsl_inspec.rst
|
|
159
172
|
- docs/inspec_and_friends.rst
|
|
160
173
|
- docs/readme.rst
|
|
161
174
|
- docs/resources.rst
|
|
162
175
|
- docs/template.rst
|
|
163
|
-
- examples/
|
|
164
|
-
- examples/
|
|
165
|
-
- examples/
|
|
166
|
-
- examples/
|
|
167
|
-
- examples/
|
|
168
|
-
- examples/
|
|
169
|
-
- examples/
|
|
170
|
-
- examples/
|
|
176
|
+
- examples/README.md
|
|
177
|
+
- examples/kitchen-ansible/.kitchen.yml
|
|
178
|
+
- examples/kitchen-ansible/Gemfile
|
|
179
|
+
- examples/kitchen-ansible/README.md
|
|
180
|
+
- examples/kitchen-ansible/files/nginx.repo
|
|
181
|
+
- examples/kitchen-ansible/tasks/main.yml
|
|
182
|
+
- examples/kitchen-ansible/test/integration/default/default.yml
|
|
183
|
+
- examples/kitchen-ansible/test/integration/default/web_spec.rb
|
|
184
|
+
- examples/kitchen-chef/.kitchen.yml
|
|
185
|
+
- examples/kitchen-chef/Berksfile
|
|
186
|
+
- examples/kitchen-chef/Gemfile
|
|
187
|
+
- examples/kitchen-chef/README.md
|
|
188
|
+
- examples/kitchen-chef/metadata.rb
|
|
189
|
+
- examples/kitchen-chef/recipes/default.rb
|
|
190
|
+
- examples/kitchen-chef/recipes/nginx.rb
|
|
191
|
+
- examples/kitchen-chef/test/integration/default/web_spec.rb
|
|
192
|
+
- examples/kitchen-puppet/.kitchen.yml
|
|
193
|
+
- examples/kitchen-puppet/Gemfile
|
|
194
|
+
- examples/kitchen-puppet/Puppetfile
|
|
195
|
+
- examples/kitchen-puppet/README.md
|
|
196
|
+
- examples/kitchen-puppet/manifests/site.pp
|
|
197
|
+
- examples/kitchen-puppet/metadata.json
|
|
198
|
+
- examples/kitchen-puppet/test/integration/default/web_spec.rb
|
|
171
199
|
- inspec.gemspec
|
|
172
200
|
- lib/inspec.rb
|
|
173
201
|
- lib/inspec/backend.rb
|
|
@@ -193,7 +221,6 @@ files:
|
|
|
193
221
|
- lib/inspec/targets/zip.rb
|
|
194
222
|
- lib/inspec/version.rb
|
|
195
223
|
- lib/matchers/matchers.rb
|
|
196
|
-
- lib/resources/.service.rb.swp
|
|
197
224
|
- lib/resources/apache.rb
|
|
198
225
|
- lib/resources/apache_conf.rb
|
|
199
226
|
- lib/resources/apt.rb
|
|
@@ -272,13 +299,16 @@ files:
|
|
|
272
299
|
- test/integration/cookbooks/os_prepare/recipes/service.rb
|
|
273
300
|
- test/integration/test/integration/default/_debug_spec.rb
|
|
274
301
|
- test/integration/test/integration/default/apt_spec.rb
|
|
302
|
+
- test/integration/test/integration/default/compare_matcher_spec.rb
|
|
275
303
|
- test/integration/test/integration/default/csv_spec.rb
|
|
304
|
+
- test/integration/test/integration/default/etc_group.rb
|
|
276
305
|
- test/integration/test/integration/default/file_spec.rb
|
|
277
306
|
- test/integration/test/integration/default/group_spec.rb
|
|
278
307
|
- test/integration/test/integration/default/ini_spec.rb
|
|
279
308
|
- test/integration/test/integration/default/json_spec.rb
|
|
280
309
|
- test/integration/test/integration/default/kernel_module_spec.rb
|
|
281
310
|
- test/integration/test/integration/default/kernel_parameter_spec.rb
|
|
311
|
+
- test/integration/test/integration/default/os_spec.rb
|
|
282
312
|
- test/integration/test/integration/default/package_spec.rb
|
|
283
313
|
- test/integration/test/integration/default/port_spec.rb
|
|
284
314
|
- test/integration/test/integration/default/registry_key_spec.rb
|
|
@@ -306,6 +336,8 @@ files:
|
|
|
306
336
|
- test/unit/mock/cmd/dscl
|
|
307
337
|
- test/unit/mock/cmd/env
|
|
308
338
|
- test/unit/mock/cmd/etc-apt
|
|
339
|
+
- test/unit/mock/cmd/find-apache2-conf-enabled
|
|
340
|
+
- test/unit/mock/cmd/find-apache2-ports-conf
|
|
309
341
|
- test/unit/mock/cmd/find-etc-rc-d-name-S
|
|
310
342
|
- test/unit/mock/cmd/find-net-interface
|
|
311
343
|
- test/unit/mock/cmd/gem-list-local-a-q-rubocop
|
|
@@ -348,6 +380,7 @@ files:
|
|
|
348
380
|
- test/unit/mock/cmd/systemctl-show-all-sshd
|
|
349
381
|
- test/unit/mock/cmd/win32_product
|
|
350
382
|
- test/unit/mock/cmd/yum-repolist-all
|
|
383
|
+
- test/unit/mock/files/apache2.conf
|
|
351
384
|
- test/unit/mock/files/auditd.conf
|
|
352
385
|
- test/unit/mock/files/bond0
|
|
353
386
|
- test/unit/mock/files/etcgroup
|
|
@@ -361,15 +394,16 @@ files:
|
|
|
361
394
|
- test/unit/mock/files/ntp.conf
|
|
362
395
|
- test/unit/mock/files/passwd
|
|
363
396
|
- test/unit/mock/files/policyfile.lock.json
|
|
397
|
+
- test/unit/mock/files/ports.conf
|
|
364
398
|
- test/unit/mock/files/rootwrap.conf
|
|
399
|
+
- test/unit/mock/files/serve-cgi-bin.conf
|
|
365
400
|
- test/unit/mock/files/ssh_config
|
|
366
401
|
- test/unit/mock/files/sshd_config
|
|
367
402
|
- test/unit/mock/profiles/empty/metadata.rb
|
|
368
403
|
- test/unit/mock/profiles/metadata/metadata.rb
|
|
369
|
-
- test/unit/mock/profiles/rules/metadata.rb
|
|
370
|
-
- test/unit/mock/profiles/rules/test/test.rb
|
|
371
404
|
- test/unit/profile_context_test.rb
|
|
372
405
|
- test/unit/profile_test.rb
|
|
406
|
+
- test/unit/resources/apache_conf_test.rb
|
|
373
407
|
- test/unit/resources/apt_test.rb
|
|
374
408
|
- test/unit/resources/audit_policy_test.rb
|
|
375
409
|
- test/unit/resources/auditd_conf_test.rb
|
|
@@ -378,6 +412,7 @@ files:
|
|
|
378
412
|
- test/unit/resources/bridge_test.rb
|
|
379
413
|
- test/unit/resources/csv_test.rb
|
|
380
414
|
- test/unit/resources/etc_group_test.rb
|
|
415
|
+
- test/unit/resources/file_test.rb
|
|
381
416
|
- test/unit/resources/gem_test.rb
|
|
382
417
|
- test/unit/resources/group_test.rb
|
|
383
418
|
- test/unit/resources/host_test.rb
|
|
@@ -411,6 +446,7 @@ files:
|
|
|
411
446
|
- test/unit/resources/yum_test.rb
|
|
412
447
|
- test/unit/simpleconfig_test.rb
|
|
413
448
|
- test/unit/utils/content_parser_test.rb
|
|
449
|
+
- test/unit/utils/find_files_test.rb
|
|
414
450
|
homepage: https://github.com/chef/inspec
|
|
415
451
|
licenses:
|
|
416
452
|
- Apache 2.0
|
|
@@ -455,13 +491,16 @@ test_files:
|
|
|
455
491
|
- test/integration/cookbooks/os_prepare/recipes/service.rb
|
|
456
492
|
- test/integration/test/integration/default/_debug_spec.rb
|
|
457
493
|
- test/integration/test/integration/default/apt_spec.rb
|
|
494
|
+
- test/integration/test/integration/default/compare_matcher_spec.rb
|
|
458
495
|
- test/integration/test/integration/default/csv_spec.rb
|
|
496
|
+
- test/integration/test/integration/default/etc_group.rb
|
|
459
497
|
- test/integration/test/integration/default/file_spec.rb
|
|
460
498
|
- test/integration/test/integration/default/group_spec.rb
|
|
461
499
|
- test/integration/test/integration/default/ini_spec.rb
|
|
462
500
|
- test/integration/test/integration/default/json_spec.rb
|
|
463
501
|
- test/integration/test/integration/default/kernel_module_spec.rb
|
|
464
502
|
- test/integration/test/integration/default/kernel_parameter_spec.rb
|
|
503
|
+
- test/integration/test/integration/default/os_spec.rb
|
|
465
504
|
- test/integration/test/integration/default/package_spec.rb
|
|
466
505
|
- test/integration/test/integration/default/port_spec.rb
|
|
467
506
|
- test/integration/test/integration/default/registry_key_spec.rb
|
|
@@ -489,6 +528,8 @@ test_files:
|
|
|
489
528
|
- test/unit/mock/cmd/dscl
|
|
490
529
|
- test/unit/mock/cmd/env
|
|
491
530
|
- test/unit/mock/cmd/etc-apt
|
|
531
|
+
- test/unit/mock/cmd/find-apache2-conf-enabled
|
|
532
|
+
- test/unit/mock/cmd/find-apache2-ports-conf
|
|
492
533
|
- test/unit/mock/cmd/find-etc-rc-d-name-S
|
|
493
534
|
- test/unit/mock/cmd/find-net-interface
|
|
494
535
|
- test/unit/mock/cmd/gem-list-local-a-q-rubocop
|
|
@@ -531,6 +572,7 @@ test_files:
|
|
|
531
572
|
- test/unit/mock/cmd/systemctl-show-all-sshd
|
|
532
573
|
- test/unit/mock/cmd/win32_product
|
|
533
574
|
- test/unit/mock/cmd/yum-repolist-all
|
|
575
|
+
- test/unit/mock/files/apache2.conf
|
|
534
576
|
- test/unit/mock/files/auditd.conf
|
|
535
577
|
- test/unit/mock/files/bond0
|
|
536
578
|
- test/unit/mock/files/etcgroup
|
|
@@ -544,15 +586,16 @@ test_files:
|
|
|
544
586
|
- test/unit/mock/files/ntp.conf
|
|
545
587
|
- test/unit/mock/files/passwd
|
|
546
588
|
- test/unit/mock/files/policyfile.lock.json
|
|
589
|
+
- test/unit/mock/files/ports.conf
|
|
547
590
|
- test/unit/mock/files/rootwrap.conf
|
|
591
|
+
- test/unit/mock/files/serve-cgi-bin.conf
|
|
548
592
|
- test/unit/mock/files/ssh_config
|
|
549
593
|
- test/unit/mock/files/sshd_config
|
|
550
594
|
- test/unit/mock/profiles/empty/metadata.rb
|
|
551
595
|
- test/unit/mock/profiles/metadata/metadata.rb
|
|
552
|
-
- test/unit/mock/profiles/rules/metadata.rb
|
|
553
|
-
- test/unit/mock/profiles/rules/test/test.rb
|
|
554
596
|
- test/unit/profile_context_test.rb
|
|
555
597
|
- test/unit/profile_test.rb
|
|
598
|
+
- test/unit/resources/apache_conf_test.rb
|
|
556
599
|
- test/unit/resources/apt_test.rb
|
|
557
600
|
- test/unit/resources/audit_policy_test.rb
|
|
558
601
|
- test/unit/resources/auditd_conf_test.rb
|
|
@@ -561,6 +604,7 @@ test_files:
|
|
|
561
604
|
- test/unit/resources/bridge_test.rb
|
|
562
605
|
- test/unit/resources/csv_test.rb
|
|
563
606
|
- test/unit/resources/etc_group_test.rb
|
|
607
|
+
- test/unit/resources/file_test.rb
|
|
564
608
|
- test/unit/resources/gem_test.rb
|
|
565
609
|
- test/unit/resources/group_test.rb
|
|
566
610
|
- test/unit/resources/host_test.rb
|
|
@@ -594,3 +638,4 @@ test_files:
|
|
|
594
638
|
- test/unit/resources/yum_test.rb
|
|
595
639
|
- test/unit/simpleconfig_test.rb
|
|
596
640
|
- test/unit/utils/content_parser_test.rb
|
|
641
|
+
- test/unit/utils/find_files_test.rb
|