serverspec 2.0.0.beta19 → 2.0.0.beta20
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/WINDOWS_SUPPORT.md +9 -13
- data/lib/serverspec/helper/type.rb +7 -9
- data/lib/serverspec/helper.rb +0 -2
- data/lib/serverspec/setup.rb +11 -7
- data/lib/serverspec/type/base.rb +15 -17
- data/lib/serverspec/type/cgroup.rb +13 -16
- data/lib/serverspec/type/command.rb +14 -17
- data/lib/serverspec/type/cron.rb +8 -9
- data/lib/serverspec/type/default_gateway.rb +14 -16
- data/lib/serverspec/type/file.rb +76 -78
- data/lib/serverspec/type/group.rb +7 -9
- data/lib/serverspec/type/host.rb +10 -12
- data/lib/serverspec/type/iis_app_pool.rb +40 -42
- data/lib/serverspec/type/iis_website.rb +28 -31
- data/lib/serverspec/type/interface.rb +10 -12
- data/lib/serverspec/type/ipfilter.rb +7 -9
- data/lib/serverspec/type/ipnat.rb +7 -9
- data/lib/serverspec/type/iptables.rb +7 -9
- data/lib/serverspec/type/kernel_module.rb +4 -6
- data/lib/serverspec/type/linux_kernel_parameter.rb +7 -9
- data/lib/serverspec/type/lxc.rb +10 -12
- data/lib/serverspec/type/mail_alias.rb +4 -6
- data/lib/serverspec/type/package.rb +48 -50
- data/lib/serverspec/type/php_config.rb +7 -9
- data/lib/serverspec/type/port.rb +28 -30
- data/lib/serverspec/type/ppa.rb +7 -9
- data/lib/serverspec/type/process.rb +20 -22
- data/lib/serverspec/type/routing_table.rb +7 -9
- data/lib/serverspec/type/selinux.rb +13 -17
- data/lib/serverspec/type/service.rb +24 -26
- data/lib/serverspec/type/user.rb +22 -30
- data/lib/serverspec/type/windows_feature.rb +4 -6
- data/lib/serverspec/type/windows_hot_fix.rb +4 -6
- data/lib/serverspec/type/windows_registry_key.rb +13 -15
- data/lib/serverspec/type/windows_scheduled_task.rb +4 -6
- data/lib/serverspec/type/yumrepo.rb +7 -9
- data/lib/serverspec/type/zfs.rb +10 -12
- data/lib/serverspec/version.rb +1 -1
- data/lib/serverspec.rb +2 -1
- data/spec/spec_helper.rb +2 -3
- data/spec/type/aix/group_spec.rb +0 -4
- data/spec/type/aix/package_spec.rb +0 -4
- data/spec/type/aix/port_spec.rb +12 -25
- data/spec/type/aix/service_spec.rb +0 -7
- data/spec/type/aix/user_spec.rb +0 -12
- data/spec/type/arch/file_spec.rb +0 -13
- data/spec/type/arch/package_spec.rb +0 -10
- data/spec/type/base/cron_spec.rb +0 -8
- data/spec/type/base/file_spec.rb +0 -53
- data/spec/type/base/group_spec.rb +0 -8
- data/spec/type/base/host_spec.rb +0 -20
- data/spec/type/base/mail_alias_spec.rb +0 -4
- data/spec/type/base/package_spec.rb +10 -38
- data/spec/type/base/port_spec.rb +19 -18
- data/spec/type/base/service_spec.rb +4 -29
- data/spec/type/base/user_spec.rb +0 -24
- data/spec/type/darwin/package_spec.rb +0 -8
- data/spec/type/darwin/port_spec.rb +17 -23
- data/spec/type/darwin/service_spec.rb +0 -12
- data/spec/type/debian/package_spec.rb +0 -12
- data/spec/type/debian/service_spec.rb +0 -8
- data/spec/type/freebsd/file_spec.rb +0 -16
- data/spec/type/freebsd/package_spec.rb +0 -8
- data/spec/type/freebsd/port_spec.rb +17 -23
- data/spec/type/freebsd/service_spec.rb +0 -4
- data/spec/type/freebsd10/package_spec.rb +0 -8
- data/spec/type/gentoo/package_spec.rb +0 -5
- data/spec/type/gentoo/service_spec.rb +0 -8
- data/spec/type/linux/file_spec.rb +0 -13
- data/spec/type/linux/iptables_spec.rb +0 -8
- data/spec/type/linux/kernel_module_spec.rb +0 -4
- data/spec/type/linux/lxc_container_spec.rb +0 -8
- data/spec/type/nixos/package_spec.rb +0 -12
- data/spec/type/openbsd/file_spec.rb +0 -30
- data/spec/type/openbsd/mail_alias_spec.rb +0 -4
- data/spec/type/openbsd/package_spec.rb +0 -9
- data/spec/type/openbsd/service_spec.rb +0 -7
- data/spec/type/openbsd/user_spec.rb +0 -8
- data/spec/type/opensuse/service_spec.rb +0 -12
- data/spec/type/plamo/package_spec.rb +0 -4
- data/spec/type/plamo/service_spec.rb +0 -4
- data/spec/type/redhat/file_spec.rb +0 -13
- data/spec/type/redhat/package_spec.rb +0 -12
- data/spec/type/redhat/service_spec.rb +0 -8
- data/spec/type/redhat/yumrepo_spec.rb +5 -19
- data/spec/type/redhat5/iptables_spec.rb +0 -8
- data/spec/type/smartos/package_spec.rb +0 -8
- data/spec/type/smartos/service_spec.rb +0 -12
- data/spec/type/solaris/cron_spec.rb +0 -8
- data/spec/type/solaris/file_spec.rb +0 -14
- data/spec/type/solaris/group_spec.rb +0 -4
- data/spec/type/solaris/host_spec.rb +3 -11
- data/spec/type/solaris/package_spec.rb +0 -4
- data/spec/type/solaris/port_spec.rb +23 -22
- data/spec/type/solaris/service_spec.rb +0 -12
- data/spec/type/solaris/user_spec.rb +0 -12
- data/spec/type/solaris10/file_spec.rb +0 -58
- data/spec/type/solaris10/group_spec.rb +0 -4
- data/spec/type/solaris10/host_spec.rb +2 -6
- data/spec/type/solaris10/package_spec.rb +0 -3
- data/spec/type/solaris10/user_spec.rb +0 -4
- data/spec/type/suse/package_spec.rb +0 -12
- data/spec/type/suse/service_spec.rb +0 -8
- data/spec/type/ubuntu/ppa_spec.rb +0 -8
- data/spec/type/ubuntu/service_spec.rb +0 -4
- data/spec/type/windows/feature_spec.rb +8 -0
- data/spec/type/windows/file_spec.rb +0 -36
- data/spec/type/windows/group_spec.rb +0 -4
- data/spec/type/windows/host_spec.rb +0 -20
- data/spec/type/windows/port_spec.rb +0 -4
- data/spec/type/windows/service_spec.rb +0 -8
- data/spec/type/windows/user_spec.rb +0 -8
- metadata +2 -5
- data/lib/serverspec/helper/properties.rb +0 -9
- data/spec/helper/properties_spec.rb +0 -11
data/spec/type/base/port_spec.rb
CHANGED
|
@@ -2,32 +2,33 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
set :os, :family => 'base'
|
|
4
4
|
|
|
5
|
-
describe
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
describe port(80) do
|
|
6
|
+
it { should be_listening }
|
|
7
|
+
end
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
describe port(80) do
|
|
10
|
+
it { should be_listening.with('tcp') }
|
|
11
|
+
end
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
describe port(80) do
|
|
14
|
+
it do
|
|
12
15
|
expect {
|
|
13
16
|
should be_listening.with('not implemented')
|
|
14
17
|
}.to raise_error(ArgumentError, %r/\A`be_listening` matcher doesn\'t support/)
|
|
15
18
|
end
|
|
19
|
+
end
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
it 'invalid local address raises error' do
|
|
22
|
-
expect{ should be_listening.on('') }.to raise_error(ArgumentError)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
21
|
+
describe port(80) do
|
|
22
|
+
it { should be_listening.on('127.0.0.1') }
|
|
23
|
+
end
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
describe port(80) do
|
|
26
|
+
it do
|
|
27
|
+
expect{ should be_listening.on('') }.to raise_error(ArgumentError)
|
|
28
28
|
end
|
|
29
|
+
end
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
31
|
+
describe port(53) do
|
|
32
|
+
it { should be_listening.with('udp') }
|
|
33
33
|
end
|
|
34
|
+
|
|
@@ -6,29 +6,17 @@ describe service('sshd') do
|
|
|
6
6
|
it { should be_running }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe service('invalid-daemon') do
|
|
10
|
-
it { should_not be_running }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe service('sshd') do
|
|
14
10
|
let(:stdout) { "sshd is stopped\r\n" }
|
|
15
11
|
it { should be_running }
|
|
16
12
|
end
|
|
17
13
|
|
|
18
14
|
describe service('sshd') do
|
|
19
|
-
it { should be_running.under(
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe service('invalid-daemon') do
|
|
23
|
-
it { should_not be_running.under('supervisor') }
|
|
15
|
+
it { should be_running.under(:supervisor) }
|
|
24
16
|
end
|
|
25
17
|
|
|
26
18
|
describe service('sshd') do
|
|
27
|
-
it { should be_running.under(
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe service('invalid-daemon') do
|
|
31
|
-
it { should_not be_running.under('upstart') }
|
|
19
|
+
it { should be_running.under(:upstart) }
|
|
32
20
|
end
|
|
33
21
|
|
|
34
22
|
describe service('sshd') do
|
|
@@ -41,24 +29,11 @@ end
|
|
|
41
29
|
|
|
42
30
|
describe service('sshd') do
|
|
43
31
|
let(:stdout) { "Process 'sshd'\r\n status running\r\n monitoring status monitored" }
|
|
44
|
-
it { should be_monitored_by(
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
describe service('sshd') do
|
|
48
|
-
let(:stdout) { "Process 'sshd'\r\n status not monitored\r\n monitoring status not monitored" }
|
|
49
|
-
it { should_not be_monitored_by('monit') }
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
describe service('invalid-daemon') do
|
|
53
|
-
it { should_not be_monitored_by('monit') }
|
|
32
|
+
it { should be_monitored_by(:monit) }
|
|
54
33
|
end
|
|
55
34
|
|
|
56
35
|
describe service('unicorn') do
|
|
57
|
-
it { should be_monitored_by(
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
describe service('invalid-daemon') do
|
|
61
|
-
it { should_not be_monitored_by('god') }
|
|
36
|
+
it { should be_monitored_by(:god) }
|
|
62
37
|
end
|
|
63
38
|
|
|
64
39
|
describe service('sshd') do
|
data/spec/type/base/user_spec.rb
CHANGED
|
@@ -6,10 +6,6 @@ describe user('root') do
|
|
|
6
6
|
it { should exist }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe user('invalid-user') do
|
|
10
|
-
it { should_not exist }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe user('root') do
|
|
14
10
|
it { should belong_to_group 'root' }
|
|
15
11
|
end
|
|
@@ -18,38 +14,18 @@ describe user('root') do
|
|
|
18
14
|
it { should belong_to_primary_group 'root' }
|
|
19
15
|
end
|
|
20
16
|
|
|
21
|
-
describe user('root') do
|
|
22
|
-
it { should_not belong_to_group 'invalid-group' }
|
|
23
|
-
end
|
|
24
|
-
|
|
25
17
|
describe user('root') do
|
|
26
18
|
it { should have_uid 0 }
|
|
27
19
|
end
|
|
28
20
|
|
|
29
|
-
describe user('root') do
|
|
30
|
-
it { should_not have_uid 'invalid-uid' }
|
|
31
|
-
end
|
|
32
|
-
|
|
33
21
|
describe user('root') do
|
|
34
22
|
it { should have_login_shell '/bin/bash' }
|
|
35
23
|
end
|
|
36
24
|
|
|
37
|
-
describe user('root') do
|
|
38
|
-
it { should_not have_login_shell 'invalid-login-shell' }
|
|
39
|
-
end
|
|
40
|
-
|
|
41
25
|
describe user('root') do
|
|
42
26
|
it { should have_home_directory '/root' }
|
|
43
27
|
end
|
|
44
28
|
|
|
45
|
-
describe user('root') do
|
|
46
|
-
it { should_not have_home_directory 'invalid-home-directory' }
|
|
47
|
-
end
|
|
48
|
-
|
|
49
29
|
describe user('root') do
|
|
50
30
|
it { should have_authorized_key 'ssh-rsa ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH foo@bar.local' }
|
|
51
31
|
end
|
|
52
|
-
|
|
53
|
-
describe user('root') do
|
|
54
|
-
it { should_not have_authorized_key 'invalid-key' }
|
|
55
|
-
end
|
|
@@ -6,18 +6,10 @@ describe package('httpd') do
|
|
|
6
6
|
it { should be_installed }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe package('invalid-package') do
|
|
10
|
-
it { should_not be_installed }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe package('httpd') do
|
|
14
10
|
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe package('httpd') do
|
|
18
|
-
it { should_not be_installed.with_version('invalid-version') }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
13
|
describe package('httpd') do
|
|
22
14
|
it { should be_installed.by('homebrew') }
|
|
23
15
|
end
|
|
@@ -2,32 +2,26 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
set :os, :family => 'darwin'
|
|
4
4
|
|
|
5
|
-
describe
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
it('protocol: tcp') { should be_listening.with('tcp') }
|
|
10
|
-
|
|
11
|
-
it 'invalid protocol raises error' do
|
|
12
|
-
expect {
|
|
13
|
-
should be_listening.with('not implemented')
|
|
14
|
-
}.to raise_error(ArgumentError, %r/\A`be_listening` matcher doesn\'t support/)
|
|
15
|
-
end
|
|
5
|
+
describe port(80) do
|
|
6
|
+
it { should be_listening }
|
|
7
|
+
end
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
describe port(80) do
|
|
10
|
+
it { should be_listening.with('tcp') }
|
|
11
|
+
end
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
describe port(80) do
|
|
14
|
+
it do
|
|
15
|
+
expect {
|
|
16
|
+
should be_listening.with('not implemented')
|
|
17
|
+
}.to raise_error(ArgumentError, %r/\A`be_listening` matcher doesn\'t support/)
|
|
24
18
|
end
|
|
19
|
+
end
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
describe port(80) do
|
|
22
|
+
it { should be_listening.on('127.0.0.1') }
|
|
23
|
+
end
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
25
|
+
describe port(53) do
|
|
26
|
+
it { should be_listening.with('udp') }
|
|
33
27
|
end
|
|
@@ -6,23 +6,11 @@ describe service('sshd') do
|
|
|
6
6
|
it { should be_enabled }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe service('invalid-service') do
|
|
10
|
-
it { should_not be_enabled }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe service('sshd') do
|
|
14
10
|
it { should be_enabled.with_level(4) }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe service('invalid-service') do
|
|
18
|
-
it { should_not be_enabled.with_level(4) }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
13
|
describe service('sshd') do
|
|
22
14
|
it { should be_running }
|
|
23
15
|
end
|
|
24
16
|
|
|
25
|
-
describe service('invalid-service') do
|
|
26
|
-
it { should_not be_running }
|
|
27
|
-
end
|
|
28
|
-
|
|
@@ -6,14 +6,6 @@ describe package('httpd') do
|
|
|
6
6
|
it { should be_installed }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe package('invalid-package') do
|
|
10
|
-
it { should_not be_installed }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe package('invalid-package') do
|
|
14
|
-
it { should_not be_installed.by('apt') }
|
|
15
|
-
end
|
|
16
|
-
|
|
17
9
|
describe package('httpd') do
|
|
18
10
|
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
19
11
|
end
|
|
@@ -22,10 +14,6 @@ describe package('httpd') do
|
|
|
22
14
|
it { should be_installed.by('apt').with_version('2.2.15-28.el6') }
|
|
23
15
|
end
|
|
24
16
|
|
|
25
|
-
describe package('httpd') do
|
|
26
|
-
it { should_not be_installed.with_version('invalid-version') }
|
|
27
|
-
end
|
|
28
|
-
|
|
29
17
|
describe package('httpd') do
|
|
30
18
|
let(:stdout) { "2.2.15\n" }
|
|
31
19
|
its(:version) { should eq '2.2.15' }
|
|
@@ -6,14 +6,6 @@ describe service('sshd') do
|
|
|
6
6
|
it { should be_enabled }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe service('invalid-service') do
|
|
10
|
-
it { should_not be_enabled }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe service('sshd') do
|
|
14
10
|
it { should be_enabled.with_level(4) }
|
|
15
11
|
end
|
|
16
|
-
|
|
17
|
-
describe service('invalid-service') do
|
|
18
|
-
it { should_not be_enabled.with_level(4) }
|
|
19
|
-
end
|
|
@@ -6,34 +6,18 @@ describe file('/etc/passwd') do
|
|
|
6
6
|
it { should be_mode 644 }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe file('/etc/passwd') do
|
|
10
|
-
it { should_not be_mode 'invalid' }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe file('/etc/passwd') do
|
|
14
10
|
it { should be_owned_by 'root' }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe file('/etc/passwd') do
|
|
18
|
-
it { should_not be_owned_by 'invalid-owner' }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
13
|
describe file('/etc/passwd') do
|
|
22
14
|
it { should be_grouped_into 'root' }
|
|
23
15
|
end
|
|
24
16
|
|
|
25
|
-
describe file('/etc/passwd') do
|
|
26
|
-
it { should_not be_grouped_into 'invalid-group' }
|
|
27
|
-
end
|
|
28
|
-
|
|
29
17
|
describe file('/sbin/nologin') do
|
|
30
18
|
it { should be_linked_to '/usr/sbin/nologin' }
|
|
31
19
|
end
|
|
32
20
|
|
|
33
|
-
describe file('dummy-link') do
|
|
34
|
-
it { should_not be_linked_to '/invalid/target' }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
21
|
describe file('/etc/passwd') do
|
|
38
22
|
let(:stdout) { Time.now.to_i.to_s }
|
|
39
23
|
its(:mtime) { should > DateTime.now - 1 }
|
|
@@ -6,18 +6,10 @@ describe package('httpd') do
|
|
|
6
6
|
it { should be_installed }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe package('invalid-package') do
|
|
10
|
-
it { should_not be_installed }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe package('httpd') do
|
|
14
10
|
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe package('httpd') do
|
|
18
|
-
it { should_not be_installed.with_version('invalid-version') }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
13
|
describe package('httpd') do
|
|
22
14
|
let(:stdout) { "2.2.15\n" }
|
|
23
15
|
its(:version) { should eq '2.2.15' }
|
|
@@ -2,32 +2,26 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
set :os, :family => 'freebsd'
|
|
4
4
|
|
|
5
|
-
describe
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
it('protocol: tcp') { should be_listening.with('tcp') }
|
|
10
|
-
|
|
11
|
-
it 'invalid protocol raises error' do
|
|
12
|
-
expect {
|
|
13
|
-
should be_listening.with('not implemented')
|
|
14
|
-
}.to raise_error(ArgumentError, %r/\A`be_listening` matcher doesn\'t support/)
|
|
15
|
-
end
|
|
5
|
+
describe port(80) do
|
|
6
|
+
it { should be_listening }
|
|
7
|
+
end
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
describe port(80) do
|
|
10
|
+
it { should be_listening.with('tcp') }
|
|
11
|
+
end
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
describe port(80) do
|
|
14
|
+
it do
|
|
15
|
+
expect {
|
|
16
|
+
should be_listening.with('not implemented')
|
|
17
|
+
}.to raise_error(ArgumentError, %r/\A`be_listening` matcher doesn\'t support/)
|
|
24
18
|
end
|
|
19
|
+
end
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
describe port(80) do
|
|
22
|
+
it { should be_listening.on('127.0.0.1') }
|
|
23
|
+
end
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
25
|
+
describe port(53) do
|
|
26
|
+
it { should be_listening.with('udp') }
|
|
33
27
|
end
|
|
@@ -6,18 +6,10 @@ describe package('httpd') do
|
|
|
6
6
|
it { should be_installed }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe package('invalid-package') do
|
|
10
|
-
it { should_not be_installed }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe package('httpd') do
|
|
14
10
|
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe package('httpd') do
|
|
18
|
-
it { should_not be_installed.with_version('invalid-version') }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
13
|
describe package('httpd') do
|
|
22
14
|
let(:stdout) { "2.2.15\n" }
|
|
23
15
|
its(:version) { should eq '2.2.15' }
|
|
@@ -6,15 +6,7 @@ describe service('sshd') do
|
|
|
6
6
|
it { should be_enabled }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe service('invalid-service') do
|
|
10
|
-
it { should_not be_enabled }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe service('sshd') do
|
|
14
10
|
it { should be_running }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe service('invalid-service') do
|
|
18
|
-
it { should_not be_running }
|
|
19
|
-
end
|
|
20
|
-
|
|
@@ -8,27 +8,14 @@ describe file('/tmp') do
|
|
|
8
8
|
it { should be_readable.by_user('mail') }
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
describe file('/tmp') do
|
|
12
|
-
it { should_not be_readable.by_user('invalid-user') }
|
|
13
|
-
end
|
|
14
|
-
|
|
15
11
|
describe file('/tmp') do
|
|
16
12
|
it { should be_writable.by_user('mail') }
|
|
17
13
|
end
|
|
18
14
|
|
|
19
|
-
describe file('/tmp') do
|
|
20
|
-
it { should_not be_writable.by_user('invalid-user') }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
|
|
24
15
|
describe file('/tmp') do
|
|
25
16
|
it { should be_executable.by_user('mail') }
|
|
26
17
|
end
|
|
27
18
|
|
|
28
|
-
describe file('/tmp') do
|
|
29
|
-
it { should_not be_executable.by_user('invalid-user') }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
19
|
describe file('/tmp') do
|
|
33
20
|
it { should be_immutable }
|
|
34
21
|
end
|
|
@@ -6,14 +6,6 @@ describe iptables do
|
|
|
6
6
|
it { should have_rule '-P INPUT ACCEPT' }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe iptables do
|
|
10
|
-
it { should_not have_rule 'invalid-rule' }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe iptables do
|
|
14
10
|
it { should have_rule('-P INPUT ACCEPT').with_table('mangle').with_chain('INPUT') }
|
|
15
11
|
end
|
|
16
|
-
|
|
17
|
-
describe iptables do
|
|
18
|
-
it { should_not have_rule('invalid-rule').with_table('mangle').with_chain('INPUT') }
|
|
19
|
-
end
|
|
@@ -6,15 +6,7 @@ describe lxc('ct01') do
|
|
|
6
6
|
it { should exist }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe lxc('invalid-ct') do
|
|
10
|
-
it { should_not exist }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe lxc('ct01') do
|
|
14
10
|
it { should be_running }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe lxc('invalid-ct') do
|
|
18
|
-
it { should_not be_running }
|
|
19
|
-
end
|
|
20
|
-
|
|
@@ -6,14 +6,6 @@ describe package('httpd') do
|
|
|
6
6
|
it { should be_installed }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe package('invalid-package') do
|
|
10
|
-
it { should_not be_installed }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe package('invalid-package') do
|
|
14
|
-
it { should_not be_installed.by('nix') }
|
|
15
|
-
end
|
|
16
|
-
|
|
17
9
|
describe package('httpd') do
|
|
18
10
|
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
19
11
|
end
|
|
@@ -21,7 +13,3 @@ end
|
|
|
21
13
|
describe package('httpd') do
|
|
22
14
|
it { should be_installed.by('nix').with_version('2.2.15-28.el6') }
|
|
23
15
|
end
|
|
24
|
-
|
|
25
|
-
describe package('httpd') do
|
|
26
|
-
it { should_not be_installed.with_version('invalid-version') }
|
|
27
|
-
end
|
|
@@ -6,42 +6,22 @@ describe file('/etc/passwd') do
|
|
|
6
6
|
it { should be_mode 644 }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe file('/etc/passwd') do
|
|
10
|
-
it { should_not be_mode 'invalid' }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe file('/etc/passwd') do
|
|
14
10
|
it { should be_owned_by 'root' }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe file('/etc/passwd') do
|
|
18
|
-
it { should_not be_owned_by 'invalid-owner' }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
13
|
describe file('/etc/passwd') do
|
|
22
14
|
it { should be_grouped_into 'root' }
|
|
23
15
|
end
|
|
24
16
|
|
|
25
|
-
describe file('/etc/passwd') do
|
|
26
|
-
it { should_not be_grouped_into 'invalid-group' }
|
|
27
|
-
end
|
|
28
|
-
|
|
29
17
|
describe file('/etc/pam.d/system-auth') do
|
|
30
18
|
it { should be_linked_to '/etc/pam.d/system-auth-ac' }
|
|
31
19
|
end
|
|
32
20
|
|
|
33
|
-
describe file('dummy-link') do
|
|
34
|
-
it { should_not be_linked_to '/invalid/target' }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
21
|
describe file('/') do
|
|
38
22
|
it { should be_mounted }
|
|
39
23
|
end
|
|
40
24
|
|
|
41
|
-
describe file('/etc/invalid-mount') do
|
|
42
|
-
it { should_not be_mounted }
|
|
43
|
-
end
|
|
44
|
-
|
|
45
25
|
describe file('/') do
|
|
46
26
|
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
47
27
|
it { should be_mounted.with( :type => 'ext4' ) }
|
|
@@ -87,11 +67,6 @@ describe file('/') do
|
|
|
87
67
|
it { should_not be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_r00t' ) }
|
|
88
68
|
end
|
|
89
69
|
|
|
90
|
-
describe file('/etc/invalid-mount') do
|
|
91
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
92
|
-
it { should_not be_mounted.with( :type => 'ext4' ) }
|
|
93
|
-
end
|
|
94
|
-
|
|
95
70
|
describe file('/') do
|
|
96
71
|
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
97
72
|
it do
|
|
@@ -148,11 +123,6 @@ describe file('/') do
|
|
|
148
123
|
end
|
|
149
124
|
end
|
|
150
125
|
|
|
151
|
-
describe file('/etc/invalid-mount') do
|
|
152
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
153
|
-
it { should_not be_mounted.only_with( :type => 'ext4' ) }
|
|
154
|
-
end
|
|
155
|
-
|
|
156
126
|
describe file('/etc/services') do
|
|
157
127
|
let(:stdout) { "35435ea447c19f0ea5ef971837ab9ced\n" }
|
|
158
128
|
its(:md5sum) { should eq '35435ea447c19f0ea5ef971837ab9ced' }
|
|
@@ -6,15 +6,6 @@ describe package('httpd') do
|
|
|
6
6
|
it { should be_installed }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe package('invalid-package') do
|
|
10
|
-
it { should_not be_installed }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe package('httpd') do
|
|
14
10
|
it { should be_installed.with_version('2.2.15-28.el6') }
|
|
15
11
|
end
|
|
16
|
-
|
|
17
|
-
describe package('httpd') do
|
|
18
|
-
it { should_not be_installed.with_version('invalid-version') }
|
|
19
|
-
end
|
|
20
|
-
|
|
@@ -6,15 +6,8 @@ describe service('sshd') do
|
|
|
6
6
|
it { should be_enabled }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe service('invalid-service') do
|
|
10
|
-
it { should_not be_enabled }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe service('sshd') do
|
|
14
10
|
it { should be_running }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe service('invalid-service') do
|
|
18
|
-
it { should_not be_running }
|
|
19
|
-
end
|
|
20
13
|
|
|
@@ -6,15 +6,7 @@ describe user('root') do
|
|
|
6
6
|
it { should have_login_shell '/bin/bash' }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe user('root') do
|
|
10
|
-
it { should_not have_login_shell 'invalid-login-shell' }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
describe user('root') do
|
|
14
10
|
it { should have_home_directory '/root' }
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
describe user('root') do
|
|
18
|
-
it { should_not have_home_directory 'invalid-home-directory' }
|
|
19
|
-
end
|
|
20
|
-
|