serverspec 1.16.0 → 2.0.0.beta1
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/README.md +1 -2
- data/Rakefile +20 -25
- data/lib/serverspec.rb +0 -3
- data/lib/serverspec/helper/os.rb +0 -3
- data/lib/serverspec/helper/type.rb +3 -3
- data/lib/serverspec/matchers.rb +1 -7
- data/lib/serverspec/matchers/have_rule.rb +1 -1
- data/lib/serverspec/setup.rb +12 -11
- data/lib/serverspec/type/file.rb +0 -15
- data/lib/serverspec/type/iis_app_pool.rb +0 -28
- data/lib/serverspec/type/iis_website.rb +0 -12
- data/lib/serverspec/type/interface.rb +0 -3
- data/lib/serverspec/type/user.rb +0 -4
- data/lib/serverspec/version.rb +1 -1
- data/serverspec.gemspec +4 -3
- data/wercker.yml +9 -9
- metadata +36 -471
- data/lib/serverspec/matchers/belong_to_primary_group.rb +0 -5
- data/lib/serverspec/matchers/have_site_application.rb +0 -18
- data/lib/serverspec/matchers/have_site_bindings.rb +0 -22
- data/lib/serverspec/matchers/have_virtual_dir.rb +0 -14
- data/lib/serverspec/type/ip6tables.rb +0 -13
- data/lib/serverspec/type/ppa.rb +0 -13
- data/lib/serverspec/type/windows_scheduled_task.rb +0 -9
- data/spec/aix/command_spec.rb +0 -65
- data/spec/aix/cron_spec.rb +0 -21
- data/spec/aix/default_gateway_spec.rb +0 -16
- data/spec/aix/file_spec.rb +0 -404
- data/spec/aix/group_spec.rb +0 -21
- data/spec/aix/host_spec.rb +0 -58
- data/spec/aix/package_spec.rb +0 -100
- data/spec/aix/php_config_spec.rb +0 -36
- data/spec/aix/port_spec.rb +0 -30
- data/spec/aix/process_spec.rb +0 -29
- data/spec/aix/routing_table_spec.rb +0 -120
- data/spec/aix/service_spec.rb +0 -93
- data/spec/aix/user_spec.rb +0 -57
- data/spec/arch/file_spec.rb +0 -413
- data/spec/arch/package_spec.rb +0 -100
- data/spec/arch/service_spec.rb +0 -84
- data/spec/backend/cmd/configuration_spec.rb +0 -9
- data/spec/backend/exec/configuration_spec.rb +0 -61
- data/spec/backend/powershell/script_helper_spec.rb +0 -105
- data/spec/backend/ssh/configuration_spec.rb +0 -184
- data/spec/backend/winrm/configuration_spec.rb +0 -9
- data/spec/darwin/command_spec.rb +0 -65
- data/spec/darwin/cron_spec.rb +0 -21
- data/spec/darwin/default_gateway_spec.rb +0 -16
- data/spec/darwin/file_spec.rb +0 -413
- data/spec/darwin/group_spec.rb +0 -21
- data/spec/darwin/host_spec.rb +0 -58
- data/spec/darwin/mail_alias_spec.rb +0 -12
- data/spec/darwin/package_spec.rb +0 -82
- data/spec/darwin/php_config_spec.rb +0 -36
- data/spec/darwin/port_spec.rb +0 -30
- data/spec/darwin/process_spec.rb +0 -29
- data/spec/darwin/routing_table_spec.rb +0 -120
- data/spec/darwin/service_spec.rb +0 -91
- data/spec/darwin/user_spec.rb +0 -57
- data/spec/debian/cgroup_spec.rb +0 -14
- data/spec/debian/command_spec.rb +0 -65
- data/spec/debian/cron_spec.rb +0 -21
- data/spec/debian/default_gateway_spec.rb +0 -16
- data/spec/debian/file_spec.rb +0 -413
- data/spec/debian/group_spec.rb +0 -22
- data/spec/debian/host_spec.rb +0 -58
- data/spec/debian/interface_spec.rb +0 -24
- data/spec/debian/ip6tables_spec.rb +0 -21
- data/spec/debian/iptables_spec.rb +0 -21
- data/spec/debian/kernel_module_spec.rb +0 -12
- data/spec/debian/linux_kernel_parameter_spec.rb +0 -36
- data/spec/debian/lxc_spec.rb +0 -22
- data/spec/debian/mail_alias_spec.rb +0 -12
- data/spec/debian/package_spec.rb +0 -130
- data/spec/debian/php_config_spec.rb +0 -36
- data/spec/debian/port_spec.rb +0 -40
- data/spec/debian/process_spec.rb +0 -29
- data/spec/debian/routing_table_spec.rb +0 -120
- data/spec/debian/selinux_spec.rb +0 -18
- data/spec/debian/service_spec.rb +0 -93
- data/spec/debian/user_spec.rb +0 -57
- data/spec/debian/zfs_spec.rb +0 -18
- data/spec/fedora/cgroup_spec.rb +0 -14
- data/spec/fedora/command_spec.rb +0 -67
- data/spec/fedora/cron_spec.rb +0 -21
- data/spec/fedora/default_gateway_spec.rb +0 -16
- data/spec/fedora/file_spec.rb +0 -413
- data/spec/fedora/group_spec.rb +0 -21
- data/spec/fedora/host_spec.rb +0 -58
- data/spec/fedora/interface_spec.rb +0 -24
- data/spec/fedora/ip6tables_spec.rb +0 -21
- data/spec/fedora/iptables_spec.rb +0 -21
- data/spec/fedora/kernel_module_spec.rb +0 -12
- data/spec/fedora/linux_kernel_parameter_spec.rb +0 -36
- data/spec/fedora/lxc_spec.rb +0 -22
- data/spec/fedora/mail_alias_spec.rb +0 -12
- data/spec/fedora/package_spec.rb +0 -118
- data/spec/fedora/php_config_spec.rb +0 -36
- data/spec/fedora/port_spec.rb +0 -30
- data/spec/fedora/process_spec.rb +0 -41
- data/spec/fedora/routing_table_spec.rb +0 -120
- data/spec/fedora/selinux_spec.rb +0 -18
- data/spec/fedora/user_spec.rb +0 -57
- data/spec/fedora/yumrepo_spec.rb +0 -25
- data/spec/fedora/zfs_spec.rb +0 -18
- data/spec/freebsd/command_spec.rb +0 -65
- data/spec/freebsd/cron_spec.rb +0 -21
- data/spec/freebsd/default_gateway_spec.rb +0 -16
- data/spec/freebsd/file_spec.rb +0 -385
- data/spec/freebsd/group_spec.rb +0 -21
- data/spec/freebsd/host_spec.rb +0 -58
- data/spec/freebsd/package_spec.rb +0 -96
- data/spec/freebsd/php_config_spec.rb +0 -36
- data/spec/freebsd/port_spec.rb +0 -30
- data/spec/freebsd/process_spec.rb +0 -29
- data/spec/freebsd/routing_table_spec.rb +0 -120
- data/spec/freebsd/service_spec.rb +0 -93
- data/spec/freebsd/user_spec.rb +0 -57
- data/spec/freebsd10/package_spec.rb +0 -13
- data/spec/gentoo/cgroup_spec.rb +0 -14
- data/spec/gentoo/command_spec.rb +0 -65
- data/spec/gentoo/cron_spec.rb +0 -21
- data/spec/gentoo/default_gateway_spec.rb +0 -16
- data/spec/gentoo/file_spec.rb +0 -413
- data/spec/gentoo/group_spec.rb +0 -21
- data/spec/gentoo/host_spec.rb +0 -58
- data/spec/gentoo/interface_spec.rb +0 -24
- data/spec/gentoo/ip6tables_spec.rb +0 -21
- data/spec/gentoo/iptables_spec.rb +0 -21
- data/spec/gentoo/kernel_module_spec.rb +0 -12
- data/spec/gentoo/linux_kernel_parameter_spec.rb +0 -36
- data/spec/gentoo/lxc_spec.rb +0 -22
- data/spec/gentoo/mail_alias_spec.rb +0 -12
- data/spec/gentoo/package_spec.rb +0 -91
- data/spec/gentoo/php_config_spec.rb +0 -36
- data/spec/gentoo/port_spec.rb +0 -30
- data/spec/gentoo/process_spec.rb +0 -29
- data/spec/gentoo/routing_table_spec.rb +0 -120
- data/spec/gentoo/selinux_spec.rb +0 -18
- data/spec/gentoo/service_spec.rb +0 -93
- data/spec/gentoo/user_spec.rb +0 -57
- data/spec/gentoo/zfs_spec.rb +0 -18
- data/spec/nixos/file_spec.rb +0 -421
- data/spec/nixos/package_spec.rb +0 -109
- data/spec/nixos/service_spec.rb +0 -40
- data/spec/plamo/cgroup_spec.rb +0 -14
- data/spec/plamo/command_spec.rb +0 -65
- data/spec/plamo/cron_spec.rb +0 -21
- data/spec/plamo/default_gateway_spec.rb +0 -16
- data/spec/plamo/file_spec.rb +0 -413
- data/spec/plamo/group_spec.rb +0 -22
- data/spec/plamo/host_spec.rb +0 -58
- data/spec/plamo/interface_spec.rb +0 -24
- data/spec/plamo/ip6tables_spec.rb +0 -21
- data/spec/plamo/iptables_spec.rb +0 -21
- data/spec/plamo/kernel_module_spec.rb +0 -12
- data/spec/plamo/linux_kernel_parameter_spec.rb +0 -36
- data/spec/plamo/lxc_spec.rb +0 -22
- data/spec/plamo/mail_alias_spec.rb +0 -12
- data/spec/plamo/package_spec.rb +0 -100
- data/spec/plamo/php_config_spec.rb +0 -36
- data/spec/plamo/port_spec.rb +0 -30
- data/spec/plamo/routing_table_spec.rb +0 -120
- data/spec/plamo/selinux_spec.rb +0 -18
- data/spec/plamo/service_spec.rb +0 -84
- data/spec/plamo/user_spec.rb +0 -57
- data/spec/plamo/zfs_spec.rb +0 -18
- data/spec/redhat/cgroup_spec.rb +0 -14
- data/spec/redhat/command_spec.rb +0 -67
- data/spec/redhat/cron_spec.rb +0 -21
- data/spec/redhat/default_gateway_spec.rb +0 -16
- data/spec/redhat/file_spec.rb +0 -418
- data/spec/redhat/group_spec.rb +0 -21
- data/spec/redhat/host_spec.rb +0 -64
- data/spec/redhat/interface_spec.rb +0 -24
- data/spec/redhat/ip6tables_spec.rb +0 -21
- data/spec/redhat/iptables_spec.rb +0 -21
- data/spec/redhat/kernel_module_spec.rb +0 -12
- data/spec/redhat/linux_kernel_parameter_spec.rb +0 -36
- data/spec/redhat/lxc_spec.rb +0 -22
- data/spec/redhat/mail_alias_spec.rb +0 -12
- data/spec/redhat/package_spec.rb +0 -118
- data/spec/redhat/php_config_spec.rb +0 -36
- data/spec/redhat/port_spec.rb +0 -30
- data/spec/redhat/process_spec.rb +0 -41
- data/spec/redhat/routing_table_spec.rb +0 -120
- data/spec/redhat/selinux_spec.rb +0 -18
- data/spec/redhat/service_spec.rb +0 -93
- data/spec/redhat/user_spec.rb +0 -57
- data/spec/redhat/yumrepo_spec.rb +0 -25
- data/spec/redhat/zfs_spec.rb +0 -18
- data/spec/redhat7/service_spec.rb +0 -21
- data/spec/smartos/mail_alias_spec.rb +0 -12
- data/spec/smartos/process_spec.rb +0 -29
- data/spec/solaris/command_spec.rb +0 -65
- data/spec/solaris/cron_spec.rb +0 -21
- data/spec/solaris/default_gateway_spec.rb +0 -16
- data/spec/solaris/file_spec.rb +0 -413
- data/spec/solaris/group_spec.rb +0 -21
- data/spec/solaris/host_spec.rb +0 -58
- data/spec/solaris/ipfilter_spec.rb +0 -8
- data/spec/solaris/ipnat_spec.rb +0 -8
- data/spec/solaris/mail_alias_spec.rb +0 -12
- data/spec/solaris/package_spec.rb +0 -100
- data/spec/solaris/php_config_spec.rb +0 -36
- data/spec/solaris/port_spec.rb +0 -30
- data/spec/solaris/process_spec.rb +0 -29
- data/spec/solaris/routing_table_spec.rb +0 -120
- data/spec/solaris/service_spec.rb +0 -93
- data/spec/solaris/svcprop_spec.rb +0 -13
- data/spec/solaris/user_spec.rb +0 -57
- data/spec/solaris/zfs_spec.rb +0 -18
- data/spec/solaris10/file_spec.rb +0 -395
- data/spec/solaris10/group_spec.rb +0 -21
- data/spec/solaris10/mail_alias_spec.rb +0 -12
- data/spec/solaris10/package_spec.rb +0 -85
- data/spec/solaris10/php_config_spec.rb +0 -36
- data/spec/solaris10/user_spec.rb +0 -57
- data/spec/solaris11/command_spec.rb +0 -65
- data/spec/solaris11/cron_spec.rb +0 -21
- data/spec/solaris11/default_gateway_spec.rb +0 -16
- data/spec/solaris11/file_spec.rb +0 -413
- data/spec/solaris11/group_spec.rb +0 -21
- data/spec/solaris11/host_spec.rb +0 -58
- data/spec/solaris11/ipfilter_spec.rb +0 -8
- data/spec/solaris11/ipnat_spec.rb +0 -8
- data/spec/solaris11/mail_alias_spec.rb +0 -12
- data/spec/solaris11/package_spec.rb +0 -100
- data/spec/solaris11/php_config_spec.rb +0 -36
- data/spec/solaris11/port_spec.rb +0 -12
- data/spec/solaris11/routing_table_spec.rb +0 -120
- data/spec/solaris11/service_spec.rb +0 -93
- data/spec/solaris11/svcprop_spec.rb +0 -13
- data/spec/solaris11/user_spec.rb +0 -57
- data/spec/solaris11/zfs_spec.rb +0 -18
- data/spec/support/powershell_command_runner.rb +0 -52
- data/spec/ubuntu/ppa_spec.rb +0 -25
- data/spec/windows/command_spec.rb +0 -67
- data/spec/windows/file_spec.rb +0 -161
- data/spec/windows/group_spec.rb +0 -28
- data/spec/windows/port_spec.rb +0 -31
- data/spec/windows/service_spec.rb +0 -31
- data/spec/windows/user_spec.rb +0 -44
- data/spec/windows/windows_hot_fix_spec.rb +0 -25
- data/spec/windows/windows_registry_key_spec.rb +0 -66
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
include SpecInfra::Helper::Solaris
|
|
4
|
-
|
|
5
|
-
describe service('svc:/network/http:apache22') do
|
|
6
|
-
it { should have_property 'httpd/enable_64bit' => false }
|
|
7
|
-
its(:command) { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep -- \\^false\\$" }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe service('svc:/network/http:apache22') do
|
|
11
|
-
it { should have_property 'httpd/enable_64bit' => false, 'httpd/server_type' => 'worker' }
|
|
12
|
-
its(:command) { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep -- \\^false\\$ && svcprop -p httpd/server_type svc:/network/http:apache22 | grep -- \\^worker\\$" }
|
|
13
|
-
end
|
data/spec/solaris/user_spec.rb
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
include SpecInfra::Helper::Solaris
|
|
4
|
-
|
|
5
|
-
describe user('root') do
|
|
6
|
-
it { should exist }
|
|
7
|
-
its(:command) { should eq "id root" }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe user('invalid-user') do
|
|
11
|
-
it { should_not exist }
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe user('root') do
|
|
15
|
-
it { should belong_to_group 'root' }
|
|
16
|
-
its(:command) { should eq "id -Gn root | grep -- root" }
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe user('root') do
|
|
20
|
-
it { should_not belong_to_group 'invalid-group' }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe user('root') do
|
|
24
|
-
it { should have_uid 0 }
|
|
25
|
-
its(:command) { should eq "id root | grep -- \\^uid\\=0\\(" }
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe user('root') do
|
|
29
|
-
it { should_not have_uid 'invalid-uid' }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe user('root') do
|
|
33
|
-
it { should have_login_shell '/bin/bash' }
|
|
34
|
-
its(:command) { should eq "getent passwd root | cut -f 7 -d ':' | grep -w -- /bin/bash" }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
describe user('root') do
|
|
38
|
-
it { should_not have_login_shell 'invalid-login-shell' }
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
describe user('root') do
|
|
42
|
-
it { should have_home_directory '/root' }
|
|
43
|
-
its(:command) { should eq "getent passwd root | cut -f 6 -d ':' | grep -w -- /root" }
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
describe user('root') do
|
|
47
|
-
it { should_not have_home_directory 'invalid-home-directory' }
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe user('root') do
|
|
51
|
-
it { should have_authorized_key 'ssh-rsa ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH foo@bar.local' }
|
|
52
|
-
its(:command) { should eq "grep -w -- ssh-rsa\\ ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH ~root/.ssh/authorized_keys" }
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
describe user('root') do
|
|
56
|
-
it { should_not have_authorized_key 'invalid-key' }
|
|
57
|
-
end
|
data/spec/solaris/zfs_spec.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
include SpecInfra::Helper::Solaris
|
|
4
|
-
|
|
5
|
-
describe zfs('rpool') do
|
|
6
|
-
it { should exist }
|
|
7
|
-
its(:command) { should eq "zfs list -H rpool" }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe zfs('rpool') do
|
|
11
|
-
it { should have_property 'mountpoint' => '/rpool' }
|
|
12
|
-
its(:command) { should eq "zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe zfs('rpool') do
|
|
16
|
-
it { should have_property 'mountpoint' => '/rpool', 'compression' => 'off' }
|
|
17
|
-
its(:command) { should eq "zfs list -H -o compression rpool | grep -- \\^off\\$ && zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
|
|
18
|
-
end
|
data/spec/solaris10/file_spec.rb
DELETED
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
include SpecInfra::Helper::Solaris10
|
|
4
|
-
|
|
5
|
-
describe file('/etc/ssh/sshd_config') do
|
|
6
|
-
it { should be_file }
|
|
7
|
-
its(:command) { should eq "test -f /etc/ssh/sshd_config" }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe file('/etc/invalid_file') do
|
|
11
|
-
it { should_not be_file }
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe file('/etc/ssh') do
|
|
15
|
-
it { should be_directory }
|
|
16
|
-
its(:command) { should eq "test -d /etc/ssh" }
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe file('/etc/invalid_directory') do
|
|
20
|
-
it { should_not be_directory }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe file('/var/run/unicorn.sock') do
|
|
24
|
-
it { should be_socket }
|
|
25
|
-
its(:command) { should eq "test -S /var/run/unicorn.sock" }
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe file('/etc/invalid_socket') do
|
|
29
|
-
it { should_not be_socket }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe file('/etc/ssh/sshd_config') do
|
|
33
|
-
it { should contain 'This is the sshd server system-wide configuration file' }
|
|
34
|
-
its(:command) { should eq "grep -- This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config" }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
describe file('/etc/ssh/sshd_config') do
|
|
38
|
-
it { should contain /^This is the sshd server system-wide configuration file/ }
|
|
39
|
-
its(:command) { should eq "grep -- \\^This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config" }
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
describe file('/etc/ssh/sshd_config') do
|
|
43
|
-
it { should_not contain 'This is invalid text!!' }
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
describe file('Gemfile') do
|
|
47
|
-
it { should contain('rspec').from(/^group :test do/).to(/^end/) }
|
|
48
|
-
its(:command) { should eq "sed -n /\\^group\\ :test\\ do/,/\\^end/p Gemfile | grep -q -- rspec /dev/stdin || sed -n /\\^group\\ :test\\ do/,/\\^end/p Gemfile | grep -qF -- rspec /dev/stdin" }
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
describe file('/etc/ssh/sshd_config') do
|
|
52
|
-
it { should_not contain('This is invalid text!!').from(/^group :test do/).to(/^end/) }
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
describe file('Gemfile') do
|
|
56
|
-
it { should contain('rspec').after(/^group :test do/) }
|
|
57
|
-
its(:command) { should eq "sed -n /\\^group\\ :test\\ do/,\\$p Gemfile | grep -q -- rspec /dev/stdin || sed -n /\\^group\\ :test\\ do/,\\$p Gemfile | grep -qF -- rspec /dev/stdin" }
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
describe file('/etc/ssh/sshd_config') do
|
|
61
|
-
it { should_not contain('This is invalid text!!').after(/^group :test do/) }
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
describe file('Gemfile') do
|
|
65
|
-
it { should contain('rspec').before(/^end/) }
|
|
66
|
-
its(:command) { should eq "sed -n 1,/\\^end/p Gemfile | grep -q -- rspec /dev/stdin || sed -n 1,/\\^end/p Gemfile | grep -qF -- rspec /dev/stdin" }
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
describe file('/etc/ssh/sshd_config') do
|
|
70
|
-
it { should_not contain('This is invalid text!!').before(/^end/) }
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
describe file('/etc/passwd') do
|
|
74
|
-
it { should be_mode 644 }
|
|
75
|
-
its(:command) { should eq "perl -e 'printf \"%o\", (stat shift)[2]&07777' /etc/passwd | grep -- \\^644\\$" }
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
describe file('/etc/passwd') do
|
|
79
|
-
it { should_not be_mode 'invalid' }
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
describe file('/etc/passwd') do
|
|
83
|
-
it { should be_owned_by 'root' }
|
|
84
|
-
its(:command) { should eq "perl -e 'printf \"%s\", getpwuid((stat(\"/etc/passwd\"))[4])' | grep -- \\^root\\$" }
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
describe file('/etc/passwd') do
|
|
88
|
-
it { should_not be_owned_by 'invalid-owner' }
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
describe file('/etc/passwd') do
|
|
92
|
-
it { should be_grouped_into 'root' }
|
|
93
|
-
its(:command) { should eq "perl -e 'printf \"%s\", getgrgid((stat(\"/etc/passwd\"))[5])' | grep -- \\^root\\$" }
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
describe file('/etc/passwd') do
|
|
97
|
-
it { should_not be_grouped_into 'invalid-group' }
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
describe file('/etc/pam.d/system-auth') do
|
|
101
|
-
it { should be_linked_to '/etc/pam.d/system-auth-ac' }
|
|
102
|
-
its(:command) { should eq "perl -e 'printf \"%s\", readlink(\"/etc/pam.d/system-auth\")' | grep -- \\^/etc/pam.d/system-auth-ac\\$" }
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
describe file('dummy-link') do
|
|
106
|
-
it { should_not be_linked_to '/invalid/target' }
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
describe file('/dev') do
|
|
110
|
-
let(:stdout) { "755\r\n" }
|
|
111
|
-
it { should be_readable }
|
|
112
|
-
its(:command) { should eq "perl -e 'printf \"%o\", (stat shift)[2]&07777' /dev" }
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
describe file('/dev') do
|
|
116
|
-
let(:stdout) { "333\r\n" }
|
|
117
|
-
it { should_not be_readable }
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
describe file('/dev') do
|
|
121
|
-
let(:stdout) { "400\r\n" }
|
|
122
|
-
it { should be_readable.by('owner') }
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
describe file('/dev') do
|
|
126
|
-
let(:stdout) { "044\r\n" }
|
|
127
|
-
it { should_not be_readable.by('owner') }
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
describe file('/dev') do
|
|
131
|
-
let(:stdout) { "040\r\n" }
|
|
132
|
-
it { should be_readable.by('group') }
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
describe file('/dev') do
|
|
136
|
-
let(:stdout) { "404\r\n" }
|
|
137
|
-
it { should_not be_readable.by('group') }
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
describe file('/dev') do
|
|
141
|
-
let(:stdout) { "044\r\n" }
|
|
142
|
-
it { should be_readable.by('others') }
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
describe file('/dev') do
|
|
146
|
-
let(:stdout) { "443\r\n" }
|
|
147
|
-
it { should_not be_readable.by('others') }
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
describe file('/tmp') do
|
|
151
|
-
it { should be_readable.by_user('mail') }
|
|
152
|
-
its(:command) { should eq "su mail -c \"test -r /tmp\"" }
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
describe file('/tmp') do
|
|
156
|
-
it { should_not be_readable.by_user('invalid-user') }
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
describe file('/dev') do
|
|
160
|
-
let(:stdout) { "755\r\n" }
|
|
161
|
-
it { should be_writable }
|
|
162
|
-
its(:command) { should eq "perl -e 'printf \"%o\", (stat shift)[2]&07777' /dev" }
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
describe file('/dev') do
|
|
166
|
-
let(:stdout) { "555\r\n" }
|
|
167
|
-
it { should_not be_writable }
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
describe file('/dev') do
|
|
171
|
-
let(:stdout) { "200\r\n" }
|
|
172
|
-
it { should be_writable.by('owner') }
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
describe file('/dev') do
|
|
176
|
-
let(:stdout) { "555\r\n" }
|
|
177
|
-
it { should_not be_writable.by('owner') }
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
describe file('/dev') do
|
|
181
|
-
let(:stdout) { "030\r\n" }
|
|
182
|
-
it { should be_writable.by('group') }
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
describe file('/dev') do
|
|
186
|
-
let(:stdout) { "555\r\n" }
|
|
187
|
-
it { should_not be_writable.by('group') }
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
describe file('/dev') do
|
|
191
|
-
let(:stdout) { "666\r\n" }
|
|
192
|
-
it { should be_writable.by('others') }
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
describe file('/dev') do
|
|
196
|
-
let(:stdout) { "555\r\n" }
|
|
197
|
-
it { should_not be_writable.by('others') }
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
describe file('/tmp') do
|
|
201
|
-
it { should be_writable.by_user('mail') }
|
|
202
|
-
its(:command) { should eq "su mail -c \"test -w /tmp\"" }
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
describe file('/tmp') do
|
|
206
|
-
it { should_not be_writable.by_user('invalid-user') }
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
describe file('/dev') do
|
|
210
|
-
let(:stdout) { "755\r\n" }
|
|
211
|
-
it { should be_executable }
|
|
212
|
-
its(:command) { should eq "perl -e 'printf \"%o\", (stat shift)[2]&07777' /dev" }
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
describe file('/dev') do
|
|
216
|
-
let(:stdout) { "666\r\n" }
|
|
217
|
-
it { should_not be_executable }
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
describe file('/dev') do
|
|
221
|
-
let(:stdout) { "100\r\n" }
|
|
222
|
-
it { should be_executable.by('owner') }
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
describe file('/dev') do
|
|
226
|
-
let(:stdout) { "666\r\n" }
|
|
227
|
-
it { should_not be_executable.by('owner') }
|
|
228
|
-
end
|
|
229
|
-
|
|
230
|
-
describe file('/dev') do
|
|
231
|
-
let(:stdout) { "070\r\n" }
|
|
232
|
-
it { should be_executable.by('group') }
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
describe file('/dev') do
|
|
236
|
-
let(:stdout) { "666\r\n" }
|
|
237
|
-
it { should_not be_executable.by('group') }
|
|
238
|
-
end
|
|
239
|
-
|
|
240
|
-
describe file('/dev') do
|
|
241
|
-
let(:stdout) { "001\r\n" }
|
|
242
|
-
it { should be_executable.by('others') }
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
describe file('/dev') do
|
|
246
|
-
let(:stdout) { "666\r\n" }
|
|
247
|
-
it { should_not be_executable.by('others') }
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
describe file('/tmp') do
|
|
251
|
-
it { should be_executable.by_user('mail') }
|
|
252
|
-
its(:command) { should eq "su mail -c \"test -x /tmp\"" }
|
|
253
|
-
end
|
|
254
|
-
|
|
255
|
-
describe file('/tmp') do
|
|
256
|
-
it { should_not be_executable.by_user('invalid-user') }
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
describe file('/') do
|
|
260
|
-
it { should be_mounted }
|
|
261
|
-
its(:command) { should eq "mount | grep -w -- on\\ /" }
|
|
262
|
-
end
|
|
263
|
-
|
|
264
|
-
describe file('/etc/invalid-mount') do
|
|
265
|
-
it { should_not be_mounted }
|
|
266
|
-
end
|
|
267
|
-
|
|
268
|
-
describe file('/') do
|
|
269
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
270
|
-
it { should be_mounted.with( :type => 'ext4' ) }
|
|
271
|
-
end
|
|
272
|
-
|
|
273
|
-
describe file('/') do
|
|
274
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
275
|
-
it { should be_mounted.with( :type => 'ext4', :options => { :rw => true } ) }
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
describe file('/') do
|
|
279
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
280
|
-
it { should be_mounted.with( :type => 'ext4', :options => { :mode => 620 } ) }
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
describe file('/') do
|
|
284
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
285
|
-
it { should be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_root' ) }
|
|
286
|
-
end
|
|
287
|
-
|
|
288
|
-
describe file('/') do
|
|
289
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
290
|
-
it { should_not be_mounted.with( :type => 'xfs' ) }
|
|
291
|
-
end
|
|
292
|
-
|
|
293
|
-
describe file('/') do
|
|
294
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
295
|
-
it { should_not be_mounted.with( :type => 'ext4', :options => { :rw => false } ) }
|
|
296
|
-
end
|
|
297
|
-
|
|
298
|
-
describe file('/') do
|
|
299
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
300
|
-
it { should_not be_mounted.with( :type => 'ext4', :options => { :mode => 600 } ) }
|
|
301
|
-
end
|
|
302
|
-
|
|
303
|
-
describe file('/') do
|
|
304
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
305
|
-
it { should_not be_mounted.with( :type => 'xfs', :device => '/dev/mapper/VolGroup-lv_root' ) }
|
|
306
|
-
end
|
|
307
|
-
|
|
308
|
-
describe file('/') do
|
|
309
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
310
|
-
it { should_not be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_r00t' ) }
|
|
311
|
-
end
|
|
312
|
-
|
|
313
|
-
describe file('/etc/invalid-mount') do
|
|
314
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
315
|
-
it { should_not be_mounted.with( :type => 'ext4' ) }
|
|
316
|
-
end
|
|
317
|
-
|
|
318
|
-
describe file('/') do
|
|
319
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
320
|
-
it do
|
|
321
|
-
should be_mounted.only_with(
|
|
322
|
-
:device => '/dev/mapper/VolGroup-lv_root',
|
|
323
|
-
:type => 'ext4',
|
|
324
|
-
:options => {
|
|
325
|
-
:rw => true,
|
|
326
|
-
:mode => 620,
|
|
327
|
-
}
|
|
328
|
-
)
|
|
329
|
-
end
|
|
330
|
-
end
|
|
331
|
-
|
|
332
|
-
describe file('/') do
|
|
333
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
334
|
-
it do
|
|
335
|
-
should_not be_mounted.only_with(
|
|
336
|
-
:device => '/dev/mapper/VolGroup-lv_root',
|
|
337
|
-
:type => 'ext4',
|
|
338
|
-
:options => {
|
|
339
|
-
:rw => true,
|
|
340
|
-
:mode => 620,
|
|
341
|
-
:bind => true,
|
|
342
|
-
}
|
|
343
|
-
)
|
|
344
|
-
end
|
|
345
|
-
end
|
|
346
|
-
|
|
347
|
-
describe file('/') do
|
|
348
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
349
|
-
it do
|
|
350
|
-
should_not be_mounted.only_with(
|
|
351
|
-
:device => '/dev/mapper/VolGroup-lv_root',
|
|
352
|
-
:type => 'ext4',
|
|
353
|
-
:options => {
|
|
354
|
-
:rw => true,
|
|
355
|
-
}
|
|
356
|
-
)
|
|
357
|
-
end
|
|
358
|
-
end
|
|
359
|
-
|
|
360
|
-
describe file('/') do
|
|
361
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
362
|
-
it do
|
|
363
|
-
should_not be_mounted.only_with(
|
|
364
|
-
:device => '/dev/mapper/VolGroup-lv_roooooooooot',
|
|
365
|
-
:type => 'ext4',
|
|
366
|
-
:options => {
|
|
367
|
-
:rw => true,
|
|
368
|
-
:mode => 620,
|
|
369
|
-
}
|
|
370
|
-
)
|
|
371
|
-
end
|
|
372
|
-
end
|
|
373
|
-
|
|
374
|
-
describe file('/etc/invalid-mount') do
|
|
375
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
376
|
-
it { should_not be_mounted.only_with( :type => 'ext4' ) }
|
|
377
|
-
end
|
|
378
|
-
|
|
379
|
-
describe file('/etc/services') do
|
|
380
|
-
it { should match_md5checksum '35435ea447c19f0ea5ef971837ab9ced' }
|
|
381
|
-
its(:command) { should eq "digest -a md5 -v /etc/services | grep -iw -- 35435ea447c19f0ea5ef971837ab9ced" }
|
|
382
|
-
end
|
|
383
|
-
|
|
384
|
-
describe file('invalid-file') do
|
|
385
|
-
it { should_not match_md5checksum 'INVALIDMD5CHECKSUM' }
|
|
386
|
-
end
|
|
387
|
-
|
|
388
|
-
describe file('/etc/services') do
|
|
389
|
-
it { should match_sha256checksum '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a' }
|
|
390
|
-
its(:command) { should eq "sha256sum /etc/services | grep -iw -- \\^0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a" }
|
|
391
|
-
end
|
|
392
|
-
|
|
393
|
-
describe file('invalid-file') do
|
|
394
|
-
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
|
395
|
-
end
|