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,18 +0,0 @@
|
|
|
1
|
-
RSpec::Matchers.define :have_site_application do |app|
|
|
2
|
-
match do |subject|
|
|
3
|
-
if subject.class.name == 'Serverspec::Type::IisWebsite'
|
|
4
|
-
subject.has_site_application?(app, @pool, @physical_path)
|
|
5
|
-
else
|
|
6
|
-
className = subject.class.name
|
|
7
|
-
raise "not supported class #{className}"
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
chain :with_pool do |pool|
|
|
12
|
-
@pool = pool
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
chain :with_physical_path do |physical_path|
|
|
16
|
-
@physical_path = physical_path
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
RSpec::Matchers.define :have_site_bindings do |port|
|
|
2
|
-
match do |subject|
|
|
3
|
-
if subject.class.name == 'Serverspec::Type::IisWebsite'
|
|
4
|
-
subject.has_site_bindings?(port, @protocol, @ipaddress, @host_header)
|
|
5
|
-
else
|
|
6
|
-
className = subject.class.name
|
|
7
|
-
raise "not supported class #{className}"
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
chain :with_protocol do |protocol|
|
|
12
|
-
@protocol = protocol
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
chain :with_ipaddress do |ipaddress|
|
|
16
|
-
@ipaddress = ipaddress
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
chain :with_host_header do |host_header|
|
|
20
|
-
@host_header = host_header
|
|
21
|
-
end
|
|
22
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
RSpec::Matchers.define :have_virtual_dir do |vdir|
|
|
2
|
-
match do |subject|
|
|
3
|
-
if subject.class.name == 'Serverspec::Type::IisWebsite'
|
|
4
|
-
subject.has_virtual_dir?(vdir, @path)
|
|
5
|
-
else
|
|
6
|
-
className = subject.class.name
|
|
7
|
-
raise "not supported class #{className}"
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
chain :with_path do |path|
|
|
12
|
-
@path = path
|
|
13
|
-
end
|
|
14
|
-
end
|
data/lib/serverspec/type/ppa.rb
DELETED
data/spec/aix/command_spec.rb
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
include SpecInfra::Helper::AIX
|
|
4
|
-
|
|
5
|
-
describe command('cat /etc/resolv.conf') do
|
|
6
|
-
let(:stdout) { "nameserver 127.0.0.1\r\n" }
|
|
7
|
-
it { should return_stdout("nameserver 127.0.0.1") }
|
|
8
|
-
its(:command) { should eq 'cat /etc/resolv.conf' }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
describe 'complete matching of stdout' do
|
|
12
|
-
context command('cat /etc/resolv.conf') do
|
|
13
|
-
let(:stdout) { "foocontent-should-be-includedbar\r\n" }
|
|
14
|
-
it { should_not return_stdout('content-should-be-included') }
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe 'regexp matching of stdout' do
|
|
19
|
-
context command('cat /etc/resolv.conf') do
|
|
20
|
-
let(:stdout) { "nameserver 127.0.0.1\r\n" }
|
|
21
|
-
it { should return_stdout(/127\.0\.0\.1/) }
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe command('cat /etc/resolv.conf') do
|
|
26
|
-
let(:stderr) { "No such file or directory\r\n" }
|
|
27
|
-
it { should return_stderr("No such file or directory") }
|
|
28
|
-
its(:command) { should eq 'cat /etc/resolv.conf' }
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
describe 'complete matching of stderr' do
|
|
32
|
-
context command('cat /etc/resolv.conf') do
|
|
33
|
-
let(:stderr) { "No such file or directory\r\n" }
|
|
34
|
-
it { should_not return_stderr('file') }
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
describe 'regexp matching of stderr' do
|
|
39
|
-
context command('cat /etc/resolv.conf') do
|
|
40
|
-
let(:stderr) { "No such file or directory\r\n" }
|
|
41
|
-
it { should return_stderr(/file/) }
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
describe command('cat /etc/resolv.conf') do
|
|
46
|
-
it { should return_exit_status 0 }
|
|
47
|
-
its(:command) { should eq 'cat /etc/resolv.conf' }
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe command('ls -al /') do
|
|
51
|
-
let(:stdout) { <<EOF
|
|
52
|
-
total 88
|
|
53
|
-
drwxr-xr-x 23 root root 4096 Oct 10 17:19 .
|
|
54
|
-
drwxr-xr-x 23 root root 4096 Oct 10 17:19 ..
|
|
55
|
-
drwxr-xr-x 2 root root 4096 Sep 11 16:43 bin
|
|
56
|
-
drwxr-xr-x 3 root root 4096 Sep 23 18:14 boot
|
|
57
|
-
drwxr-xr-x 14 root root 4260 Oct 14 16:14 dev
|
|
58
|
-
drwxr-xr-x 104 root root 4096 Oct 14 17:34 etc
|
|
59
|
-
drwxr-xr-x 8 root root 4096 Oct 1 15:09 home
|
|
60
|
-
EOF
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
its(:stdout) { should match /bin/ }
|
|
64
|
-
its(:stdout) { should eq stdout }
|
|
65
|
-
end
|
data/spec/aix/cron_spec.rb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
include SpecInfra::Helper::AIX
|
|
4
|
-
|
|
5
|
-
describe cron do
|
|
6
|
-
it { should have_entry '* * * * * /usr/local/bin/batch.sh' }
|
|
7
|
-
its(:command) { should eq 'crontab -l | grep -v "#" -- | grep -- \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ /usr/local/bin/batch.sh' }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe cron do
|
|
11
|
-
it { should_not have_entry 'invalid entry' }
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe cron do
|
|
15
|
-
it { should have_entry('* * * * * /usr/local/bin/batch.sh').with_user('root') }
|
|
16
|
-
its(:command) { should eq 'crontab -u root -l | grep -v "#" | grep -- \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ /usr/local/bin/batch.sh' }
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe cron do
|
|
20
|
-
it { should_not have_entry('* * * * * /usr/local/bin/batch.sh').with_user('invalid-user') }
|
|
21
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
include SpecInfra::Helper::AIX
|
|
4
|
-
|
|
5
|
-
describe default_gateway do
|
|
6
|
-
let(:stdout) { "default via 192.168.1.1 dev eth1 \r\n" }
|
|
7
|
-
|
|
8
|
-
its(:ipaddress) { should eq '192.168.1.1' }
|
|
9
|
-
its(:command) { should eq "ip route | grep -E '^default |^default '" }
|
|
10
|
-
|
|
11
|
-
its(:interface) { should eq 'eth1' }
|
|
12
|
-
its(:command) { should eq "ip route | grep -E '^default |^default '" }
|
|
13
|
-
|
|
14
|
-
its(:ipaddress) { should_not eq '192.168.1.2' }
|
|
15
|
-
its(:interface) { should_not eq 'eth0' }
|
|
16
|
-
end
|
data/spec/aix/file_spec.rb
DELETED
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
include SpecInfra::Helper::AIX
|
|
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 -q -- This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config || grep -qF -- 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 -q -- \\^This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config || grep -qF -- \\^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 - || sed -n /\\^group\\ :test\\ do/,/\\^end/p Gemfile | grep -qF -- rspec -" }
|
|
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 - || sed -n /\\^group\\ :test\\ do/,\\$p Gemfile | grep -qF -- rspec -" }
|
|
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 - || sed -n 1,/\\^end/p Gemfile | grep -qF -- rspec -" }
|
|
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_owned_by 'root' }
|
|
75
|
-
its(:command) { should eq "ls -al /etc/passwd | awk '{print $3}' | grep -- \\^root\\$" }
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
describe file('/etc/passwd') do
|
|
79
|
-
it { should_not be_owned_by 'invalid-owner' }
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
describe file('/etc/passwd') do
|
|
83
|
-
it { should be_grouped_into 'root' }
|
|
84
|
-
its(:command) { should eq "ls -al /etc/passwd | awk '{print $4}' | grep -- \\^root\\$" }
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
describe file('/etc/passwd') do
|
|
88
|
-
it { should_not be_grouped_into 'invalid-group' }
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
describe file('/etc/pam.d/system-auth') do
|
|
92
|
-
it { should be_linked_to '/etc/pam.d/system-auth-ac' }
|
|
93
|
-
its(:command) { should eq "stat -c %N /etc/pam.d/system-auth | egrep -e \"-> ./etc/pam.d/system-auth-ac.\"" }
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
describe file('dummy-link') do
|
|
97
|
-
it { should_not be_linked_to '/invalid/target' }
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
describe file('/dev') do
|
|
101
|
-
let(:stdout) { "755\r\n" }
|
|
102
|
-
it { should be_readable }
|
|
103
|
-
its(:command) { should eq "stat -c %a /dev" }
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
describe file('/dev') do
|
|
107
|
-
let(:stdout) { "333\r\n" }
|
|
108
|
-
it { should_not be_readable }
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
describe file('/dev') do
|
|
112
|
-
let(:stdout) { "400\r\n" }
|
|
113
|
-
it { should be_readable.by('owner') }
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
describe file('/dev') do
|
|
117
|
-
let(:stdout) { "044\r\n" }
|
|
118
|
-
it { should_not be_readable.by('owner') }
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
describe file('/dev') do
|
|
122
|
-
let(:stdout) { "040\r\n" }
|
|
123
|
-
it { should be_readable.by('group') }
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
describe file('/dev') do
|
|
127
|
-
let(:stdout) { "404\r\n" }
|
|
128
|
-
it { should_not be_readable.by('group') }
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
describe file('/dev') do
|
|
132
|
-
let(:stdout) { "044\r\n" }
|
|
133
|
-
it { should be_readable.by('others') }
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
describe file('/dev') do
|
|
137
|
-
let(:stdout) { "443\r\n" }
|
|
138
|
-
it { should_not be_readable.by('others') }
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
describe file('/tmp') do
|
|
142
|
-
it { should be_readable.by_user('mail') }
|
|
143
|
-
its(:command) { should eq "su -s sh -c \"test -r /tmp\" mail" }
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
describe file('/tmp') do
|
|
147
|
-
it { should_not be_readable.by_user('invalid-user') }
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
describe file('/dev') do
|
|
151
|
-
let(:stdout) { "755\r\n" }
|
|
152
|
-
it { should be_writable }
|
|
153
|
-
its(:command) { should eq "stat -c %a /dev" }
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
describe file('/dev') do
|
|
157
|
-
let(:stdout) { "555\r\n" }
|
|
158
|
-
it { should_not be_writable }
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
describe file('/dev') do
|
|
162
|
-
let(:stdout) { "200\r\n" }
|
|
163
|
-
it { should be_writable.by('owner') }
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
describe file('/dev') do
|
|
167
|
-
let(:stdout) { "555\r\n" }
|
|
168
|
-
it { should_not be_writable.by('owner') }
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
describe file('/dev') do
|
|
172
|
-
let(:stdout) { "030\r\n" }
|
|
173
|
-
it { should be_writable.by('group') }
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
describe file('/dev') do
|
|
177
|
-
let(:stdout) { "555\r\n" }
|
|
178
|
-
it { should_not be_writable.by('group') }
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
describe file('/dev') do
|
|
182
|
-
let(:stdout) { "666\r\n" }
|
|
183
|
-
it { should be_writable.by('others') }
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
describe file('/dev') do
|
|
187
|
-
let(:stdout) { "555\r\n" }
|
|
188
|
-
it { should_not be_writable.by('others') }
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
describe file('/tmp') do
|
|
192
|
-
it { should be_writable.by_user('mail') }
|
|
193
|
-
its(:command) { should eq "su -s sh -c \"test -w /tmp\" mail" }
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
describe file('/tmp') do
|
|
197
|
-
it { should_not be_writable.by_user('invalid-user') }
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
describe file('/dev') do
|
|
201
|
-
let(:stdout) { "755\r\n" }
|
|
202
|
-
it { should be_executable }
|
|
203
|
-
its(:command) { should eq "stat -c %a /dev" }
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
describe file('/dev') do
|
|
207
|
-
let(:stdout) { "666\r\n" }
|
|
208
|
-
it { should_not be_executable }
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
describe file('/dev') do
|
|
212
|
-
let(:stdout) { "100\r\n" }
|
|
213
|
-
it { should be_executable.by('owner') }
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
describe file('/dev') do
|
|
217
|
-
let(:stdout) { "666\r\n" }
|
|
218
|
-
it { should_not be_executable.by('owner') }
|
|
219
|
-
end
|
|
220
|
-
|
|
221
|
-
describe file('/dev') do
|
|
222
|
-
let(:stdout) { "070\r\n" }
|
|
223
|
-
it { should be_executable.by('group') }
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
describe file('/dev') do
|
|
227
|
-
let(:stdout) { "666\r\n" }
|
|
228
|
-
it { should_not be_executable.by('group') }
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
describe file('/dev') do
|
|
232
|
-
let(:stdout) { "001\r\n" }
|
|
233
|
-
it { should be_executable.by('others') }
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
describe file('/dev') do
|
|
237
|
-
let(:stdout) { "666\r\n" }
|
|
238
|
-
it { should_not be_executable.by('others') }
|
|
239
|
-
end
|
|
240
|
-
|
|
241
|
-
describe file('/tmp') do
|
|
242
|
-
it { should be_executable.by_user('mail') }
|
|
243
|
-
its(:command) { should eq "su -s sh -c \"test -x /tmp\" mail" }
|
|
244
|
-
end
|
|
245
|
-
|
|
246
|
-
describe file('/tmp') do
|
|
247
|
-
it { should_not be_executable.by_user('invalid-user') }
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
describe file('/') do
|
|
251
|
-
it { should be_mounted }
|
|
252
|
-
its(:command) { should eq "mount | grep -w -- on\\ /" }
|
|
253
|
-
end
|
|
254
|
-
|
|
255
|
-
describe file('/etc/invalid-mount') do
|
|
256
|
-
it { should_not be_mounted }
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
describe file('/') do
|
|
260
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
261
|
-
it { should be_mounted.with( :type => 'ext4' ) }
|
|
262
|
-
end
|
|
263
|
-
|
|
264
|
-
describe file('/') do
|
|
265
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
266
|
-
it { should be_mounted.with( :type => 'ext4', :options => { :rw => true } ) }
|
|
267
|
-
end
|
|
268
|
-
|
|
269
|
-
describe file('/') do
|
|
270
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
271
|
-
it { should be_mounted.with( :type => 'ext4', :options => { :mode => 620 } ) }
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
describe file('/') do
|
|
275
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
276
|
-
it { should be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_root' ) }
|
|
277
|
-
end
|
|
278
|
-
|
|
279
|
-
describe file('/') do
|
|
280
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
281
|
-
it { should_not be_mounted.with( :type => 'xfs' ) }
|
|
282
|
-
end
|
|
283
|
-
|
|
284
|
-
describe file('/') do
|
|
285
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
286
|
-
it { should_not be_mounted.with( :type => 'ext4', :options => { :rw => false } ) }
|
|
287
|
-
end
|
|
288
|
-
|
|
289
|
-
describe file('/') do
|
|
290
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
291
|
-
it { should_not be_mounted.with( :type => 'ext4', :options => { :mode => 600 } ) }
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
describe file('/') do
|
|
295
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
296
|
-
it { should_not be_mounted.with( :type => 'xfs', :device => '/dev/mapper/VolGroup-lv_root' ) }
|
|
297
|
-
end
|
|
298
|
-
|
|
299
|
-
describe file('/') do
|
|
300
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
301
|
-
it { should_not be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_r00t' ) }
|
|
302
|
-
end
|
|
303
|
-
|
|
304
|
-
describe file('/etc/invalid-mount') do
|
|
305
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
306
|
-
it { should_not be_mounted.with( :type => 'ext4' ) }
|
|
307
|
-
end
|
|
308
|
-
|
|
309
|
-
describe file('/') do
|
|
310
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
311
|
-
it do
|
|
312
|
-
should be_mounted.only_with(
|
|
313
|
-
:device => '/dev/mapper/VolGroup-lv_root',
|
|
314
|
-
:type => 'ext4',
|
|
315
|
-
:options => {
|
|
316
|
-
:rw => true,
|
|
317
|
-
:mode => 620,
|
|
318
|
-
}
|
|
319
|
-
)
|
|
320
|
-
end
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
describe file('/') do
|
|
324
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
325
|
-
it do
|
|
326
|
-
should_not be_mounted.only_with(
|
|
327
|
-
:device => '/dev/mapper/VolGroup-lv_root',
|
|
328
|
-
:type => 'ext4',
|
|
329
|
-
:options => {
|
|
330
|
-
:rw => true,
|
|
331
|
-
:mode => 620,
|
|
332
|
-
:bind => true,
|
|
333
|
-
}
|
|
334
|
-
)
|
|
335
|
-
end
|
|
336
|
-
end
|
|
337
|
-
|
|
338
|
-
describe file('/') do
|
|
339
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
340
|
-
it do
|
|
341
|
-
should_not be_mounted.only_with(
|
|
342
|
-
:device => '/dev/mapper/VolGroup-lv_root',
|
|
343
|
-
:type => 'ext4',
|
|
344
|
-
:options => {
|
|
345
|
-
:rw => true,
|
|
346
|
-
}
|
|
347
|
-
)
|
|
348
|
-
end
|
|
349
|
-
end
|
|
350
|
-
|
|
351
|
-
describe file('/') do
|
|
352
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
353
|
-
it do
|
|
354
|
-
should_not be_mounted.only_with(
|
|
355
|
-
:device => '/dev/mapper/VolGroup-lv_roooooooooot',
|
|
356
|
-
:type => 'ext4',
|
|
357
|
-
:options => {
|
|
358
|
-
:rw => true,
|
|
359
|
-
:mode => 620,
|
|
360
|
-
}
|
|
361
|
-
)
|
|
362
|
-
end
|
|
363
|
-
end
|
|
364
|
-
|
|
365
|
-
describe file('/etc/invalid-mount') do
|
|
366
|
-
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
|
367
|
-
it { should_not be_mounted.only_with( :type => 'ext4' ) }
|
|
368
|
-
end
|
|
369
|
-
|
|
370
|
-
describe file('/etc/services') do
|
|
371
|
-
it { should match_md5checksum '35435ea447c19f0ea5ef971837ab9ced' }
|
|
372
|
-
its(:command) { should eq "md5sum /etc/services | grep -iw -- \\^35435ea447c19f0ea5ef971837ab9ced" }
|
|
373
|
-
end
|
|
374
|
-
|
|
375
|
-
describe file('invalid-file') do
|
|
376
|
-
it { should_not match_md5checksum 'INVALIDMD5CHECKSUM' }
|
|
377
|
-
end
|
|
378
|
-
|
|
379
|
-
describe file('/etc/services') do
|
|
380
|
-
it { should match_sha256checksum '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a' }
|
|
381
|
-
its(:command) { should eq "sha256sum /etc/services | grep -iw -- \\^0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a" }
|
|
382
|
-
end
|
|
383
|
-
|
|
384
|
-
describe file('invalid-file') do
|
|
385
|
-
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
|
386
|
-
end
|
|
387
|
-
|
|
388
|
-
describe file('/etc/passwd') do
|
|
389
|
-
let(:stdout) {<<EOF
|
|
390
|
-
root:x:0:0:root:/root:/bin/bash
|
|
391
|
-
bin:x:1:1:bin:/bin:/sbin/nologin
|
|
392
|
-
daemon:x:2:2:daemon:/sbin:/sbin/nologin
|
|
393
|
-
sync:x:5:0:sync:/sbin:/bin/sync
|
|
394
|
-
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
|
395
|
-
halt:x:7:0:halt:/sbin:/sbin/halt
|
|
396
|
-
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
|
|
397
|
-
operator:x:11:0:operator:/root:/sbin/nologin
|
|
398
|
-
nobody:x:99:99:Nobody:/:/sbin/nologin
|
|
399
|
-
dbus:x:81:81:System message bus:/:/sbin/nologin
|
|
400
|
-
EOF
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
its(:content) { should match /root:x:0:0/ }
|
|
404
|
-
end
|