mirror of
https://github.com/inspec/inspec
synced 2024-11-27 15:10:44 +00:00
Merge pull request #732 from chef/chris-rock/activate-integration-docker
run integration tests in docker
This commit is contained in:
commit
3d89a0dd5c
26 changed files with 294 additions and 156 deletions
|
@ -12,6 +12,13 @@ transport:
|
||||||
username: ec2-user
|
username: ec2-user
|
||||||
ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %>
|
ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %>
|
||||||
|
|
||||||
|
provisioner:
|
||||||
|
name: chef_solo
|
||||||
|
|
||||||
|
verifier:
|
||||||
|
name: inspec
|
||||||
|
sudo: true
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: windows-2008
|
- name: windows-2008
|
||||||
driver:
|
driver:
|
||||||
|
@ -73,3 +80,9 @@ platforms:
|
||||||
- name: aws-linux
|
- name: aws-linux
|
||||||
driver:
|
driver:
|
||||||
image_id: ami-daaeaec7
|
image_id: ami-daaeaec7
|
||||||
|
|
||||||
|
suites:
|
||||||
|
- name: default
|
||||||
|
run_list:
|
||||||
|
- recipe[os_prepare]
|
||||||
|
attributes:
|
||||||
|
|
45
.kitchen.vagrant.yml
Normal file
45
.kitchen.vagrant.yml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
---
|
||||||
|
driver:
|
||||||
|
name: vagrant
|
||||||
|
|
||||||
|
provisioner:
|
||||||
|
name: chef_solo
|
||||||
|
|
||||||
|
verifier:
|
||||||
|
name: inspec
|
||||||
|
sudo: true
|
||||||
|
|
||||||
|
platforms:
|
||||||
|
- name: centos-7.1
|
||||||
|
- name: centos-6.7
|
||||||
|
- name: centos-6.7-i386
|
||||||
|
- name: centos-5.11
|
||||||
|
- name: centos-5.11-i386
|
||||||
|
- name: debian-6.0.10
|
||||||
|
- name: debian-6.0.10-i386
|
||||||
|
- name: debian-7.8
|
||||||
|
- name: debian-7.8-i386
|
||||||
|
- name: debian-8.1
|
||||||
|
- name: debian-8.1-i386
|
||||||
|
- name: fedora-21
|
||||||
|
- name: fedora-21-i386
|
||||||
|
- name: fedora-22
|
||||||
|
- name: freebsd-9.3
|
||||||
|
- name: freebsd-10.2
|
||||||
|
- name: opensuse-13.2-x86_64
|
||||||
|
- name: opensuse-13.2-i386
|
||||||
|
- name: ubuntu-14.04
|
||||||
|
- name: ubuntu-14.04-i386
|
||||||
|
- name: ubuntu-12.04
|
||||||
|
- name: ubuntu-12.04-i386
|
||||||
|
- name: ubuntu-10.04
|
||||||
|
- name: ubuntu-10.04-i386
|
||||||
|
- name: mint-17.2-cinnamon
|
||||||
|
driver_config:
|
||||||
|
box: artem-sidorenko/mint-17.2-cinnamon
|
||||||
|
|
||||||
|
suites:
|
||||||
|
- name: default
|
||||||
|
run_list:
|
||||||
|
- recipe[os_prepare]
|
||||||
|
attributes:
|
101
.kitchen.yml
101
.kitchen.yml
|
@ -1,45 +1,80 @@
|
||||||
---
|
---
|
||||||
driver:
|
driver:
|
||||||
name: vagrant
|
name: dokken
|
||||||
|
chef_version: 12.5.1
|
||||||
|
privileged: true # because Docker and SystemD/Upstart
|
||||||
|
|
||||||
|
transport:
|
||||||
|
name: dokken
|
||||||
|
|
||||||
provisioner:
|
provisioner:
|
||||||
name: chef_solo
|
name: dokken
|
||||||
|
|
||||||
verifier:
|
verifier:
|
||||||
name: inspec
|
name: inspec
|
||||||
sudo: true
|
sudo: true
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: centos-7.1
|
- name: ubuntu-12.04
|
||||||
- name: centos-6.7
|
driver:
|
||||||
- name: centos-6.7-i386
|
image: ubuntu:12.04
|
||||||
- name: centos-5.11
|
- name: ubuntu-14.04
|
||||||
- name: centos-5.11-i386
|
driver:
|
||||||
- name: debian-6.0.10
|
image: ubuntu:14.04
|
||||||
- name: debian-6.0.10-i386
|
- name: ubuntu-15.10
|
||||||
- name: debian-7.8
|
driver:
|
||||||
- name: debian-7.8-i386
|
image: ubuntu:15.10
|
||||||
- name: debian-8.1
|
pid_one_command: /bin/systemd
|
||||||
- name: debian-8.1-i386
|
- name: ubuntu-16.04
|
||||||
- name: fedora-21
|
driver:
|
||||||
- name: fedora-21-i386
|
image: ubuntu:16.04
|
||||||
- name: fedora-22
|
intermediate_instructions:
|
||||||
- name: freebsd-9.3
|
- RUN /usr/bin/apt-get update
|
||||||
- name: freebsd-10.2
|
pid_one_command: /bin/systemd
|
||||||
- name: opensuse-13.2-x86_64
|
- name: centos-6.6
|
||||||
- name: opensuse-13.2-i386
|
driver:
|
||||||
- name: ubuntu-14.04
|
image: centos:6.6
|
||||||
- name: ubuntu-14.04-i386
|
- name: centos-6.7
|
||||||
- name: ubuntu-12.04
|
driver:
|
||||||
- name: ubuntu-12.04-i386
|
image: centos:6.7
|
||||||
- name: ubuntu-10.04
|
intermediate_instructions:
|
||||||
- name: ubuntu-10.04-i386
|
- RUN yum install -y initscripts
|
||||||
- name: mint-17.2-cinnamon
|
- name: centos-7
|
||||||
driver_config:
|
driver:
|
||||||
box: artem-sidorenko/mint-17.2-cinnamon
|
image: centos:7
|
||||||
|
pid_one_command: /usr/lib/systemd/systemd
|
||||||
|
- name: oracle-6.6
|
||||||
|
driver:
|
||||||
|
image: oraclelinux:6.6
|
||||||
|
- name: oracle-6.7
|
||||||
|
driver:
|
||||||
|
image: oraclelinux:6.7
|
||||||
|
- name: oracle-7.1
|
||||||
|
driver:
|
||||||
|
image: oraclelinux:7.1
|
||||||
|
pid_one_command: /usr/lib/systemd/systemd
|
||||||
|
- name: debian-7
|
||||||
|
driver:
|
||||||
|
image: debian:7
|
||||||
|
intermediate_instructions:
|
||||||
|
- RUN /usr/bin/apt-get update
|
||||||
|
- RUN /usr/bin/apt-get install -y procps
|
||||||
|
- name: debian-8
|
||||||
|
driver:
|
||||||
|
image: debian:8
|
||||||
|
intermediate_instructions:
|
||||||
|
- RUN /usr/bin/apt-get update
|
||||||
|
- RUN /usr/bin/apt-get install -y procps
|
||||||
|
pid_one_command: /bin/systemd
|
||||||
|
|
||||||
suites:
|
suites:
|
||||||
- name: default
|
- name: default
|
||||||
run_list:
|
run_list:
|
||||||
- recipe[os_prepare]
|
- recipe[apt]
|
||||||
attributes:
|
- recipe[yum]
|
||||||
|
- recipe[ssh-hardening]
|
||||||
|
- recipe[os_prepare]
|
||||||
|
attributes:
|
||||||
|
osprepare:
|
||||||
|
docker: true
|
||||||
|
application: false
|
||||||
|
|
|
@ -17,6 +17,12 @@ matrix:
|
||||||
script: bundle exec rake lint test test:resources config=test/test.yaml
|
script: bundle exec rake lint test test:resources config=test/test.yaml
|
||||||
- rvm: 2.2
|
- rvm: 2.2
|
||||||
script: N=5 bundle exec rake test:functional test:resources config=test/test-extra.yaml
|
script: N=5 bundle exec rake test:functional test:resources config=test/test-extra.yaml
|
||||||
|
- rvm: 2.2
|
||||||
|
bundler_args: "--without guard tools"
|
||||||
|
script: DOCKER=true bundle exec rake test:integration OS='default-ubuntu-1204'
|
||||||
|
- rvm: 2.2
|
||||||
|
bundler_args: "--without guard tools"
|
||||||
|
script: DOCKER=true bundle exec rake test:integration OS='default-ubuntu-1604'
|
||||||
deploy:
|
deploy:
|
||||||
provider: rubygems
|
provider: rubygems
|
||||||
on:
|
on:
|
||||||
|
|
|
@ -4,3 +4,4 @@ source 'https://supermarket.chef.io'
|
||||||
cookbook 'apt'
|
cookbook 'apt'
|
||||||
cookbook 'os_prepare', path: './test/cookbooks/os_prepare'
|
cookbook 'os_prepare', path: './test/cookbooks/os_prepare'
|
||||||
cookbook 'runit', github: 'hw-cookbooks/runit'
|
cookbook 'runit', github: 'hw-cookbooks/runit'
|
||||||
|
cookbook 'ssh-hardening', git: 'https://github.com/dev-sec/chef-ssh-hardening.git'
|
||||||
|
|
1
Gemfile
1
Gemfile
|
@ -23,6 +23,7 @@ group :integration do
|
||||||
gem 'kitchen-vagrant'
|
gem 'kitchen-vagrant'
|
||||||
gem 'kitchen-inspec', '0.12.5'
|
gem 'kitchen-inspec', '0.12.5'
|
||||||
gem 'kitchen-ec2'
|
gem 'kitchen-ec2'
|
||||||
|
gem 'kitchen-dokken'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :tools do
|
group :tools do
|
||||||
|
|
8
Rakefile
8
Rakefile
|
@ -49,10 +49,10 @@ namespace :test do
|
||||||
sh(Gem.ruby, 'test/docker_test.rb', *tests)
|
sh(Gem.ruby, 'test/docker_test.rb', *tests)
|
||||||
end
|
end
|
||||||
|
|
||||||
task :vm do
|
task :integration do
|
||||||
concurrency = ENV['CONCURRENCY'] || 4
|
concurrency = ENV['CONCURRENCY'] || 1
|
||||||
path = File.join(File.dirname(__FILE__), 'test', 'integration')
|
os = ENV['OS'] || ''
|
||||||
sh('sh', '-c', "cd #{path} && bundle exec kitchen test -c #{concurrency} -t .")
|
sh('sh', '-c', "bundle exec kitchen test -c #{concurrency} #{os}")
|
||||||
end
|
end
|
||||||
|
|
||||||
task :ssh, [:target] do |_t, args|
|
task :ssh, [:target] do |_t, args|
|
||||||
|
|
2
test/cookbooks/os_prepare/attributes/default.rb
Normal file
2
test/cookbooks/os_prepare/attributes/default.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
default['osprepare']['docker'] = false
|
||||||
|
default['osprepare']['application'] = true
|
|
@ -7,19 +7,21 @@
|
||||||
|
|
||||||
# basic tests
|
# basic tests
|
||||||
include_recipe('os_prepare::file')
|
include_recipe('os_prepare::file')
|
||||||
include_recipe('os_prepare::mount')
|
include_recipe('os_prepare::mount') unless node['osprepare']['docker']
|
||||||
include_recipe('os_prepare::service')
|
include_recipe('os_prepare::service')
|
||||||
include_recipe('os_prepare::package')
|
include_recipe('os_prepare::package')
|
||||||
include_recipe('os_prepare::registry_key')
|
include_recipe('os_prepare::registry_key')
|
||||||
include_recipe('os_prepare::iptables')
|
include_recipe('os_prepare::iptables') unless node['osprepare']['docker']
|
||||||
|
|
||||||
|
# config file parsing
|
||||||
|
include_recipe('os_prepare::json_yaml_csv_ini')
|
||||||
|
|
||||||
# configure repos, eg. nginx
|
# configure repos, eg. nginx
|
||||||
include_recipe('os_prepare::apt')
|
include_recipe('os_prepare::apt')
|
||||||
|
|
||||||
# application configuration
|
# application configuration
|
||||||
include_recipe('os_prepare::postgres')
|
if node['osprepare']['application']
|
||||||
include_recipe('os_prepare::auditctl')
|
include_recipe('os_prepare::postgres')
|
||||||
include_recipe('os_prepare::apache')
|
include_recipe('os_prepare::auditctl') unless node['osprepare']['docker']
|
||||||
|
include_recipe('os_prepare::apache')
|
||||||
# config file parsing
|
end
|
||||||
include_recipe('os_prepare::json_yaml_csv_ini')
|
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
if os.linux?
|
# TODO: do not run those tests on docker yet
|
||||||
|
return if ENV['DOCKER']
|
||||||
|
return unless os.linux?
|
||||||
|
|
||||||
# direct access to params of apache conf
|
# direct access to params of apache conf
|
||||||
describe apache_conf do
|
describe apache_conf do
|
||||||
its('LogLevel') { should eq 'warn' }
|
its('LogLevel') { should cmp 'warn' }
|
||||||
its('MaxKeepAliveRequests') { should eq '100' }
|
its('MaxKeepAliveRequests') { should cmp 100 }
|
||||||
end
|
end
|
||||||
|
|
||||||
# only read one param
|
# only read one param
|
||||||
describe apache_conf.params('LogLevel') do
|
describe apache_conf.params('LogLevel') do
|
||||||
it { should include 'warn' }
|
it { should include 'warn' }
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,12 +11,12 @@ if os.linux?
|
||||||
its('Port') { should cmp 22.0 }
|
its('Port') { should cmp 22.0 }
|
||||||
its('Port') { should_not cmp 22.1 }
|
its('Port') { should_not cmp 22.1 }
|
||||||
|
|
||||||
its('LogLevel') { should eq 'INFO' }
|
its('LogLevel') { should eq 'VERBOSE' }
|
||||||
its('LogLevel') { should_not eq 'info'}
|
its('LogLevel') { should_not eq 'verbose'}
|
||||||
|
|
||||||
its('LogLevel') { should cmp 'INFO' }
|
its('LogLevel') { should cmp 'VERBOSE' }
|
||||||
its('LogLevel') { should cmp 'info' }
|
its('LogLevel') { should cmp 'verbose' }
|
||||||
its('LogLevel') { should cmp 'InfO' }
|
its('LogLevel') { should cmp 'VerBose' }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe passwd.passwords.uniq do
|
describe passwd.passwords.uniq do
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
# TODO: do not run those tests on docker yet
|
||||||
|
return if ENV['DOCKER']
|
||||||
|
|
||||||
|
# lets define our own group
|
||||||
root_group = 'root'
|
root_group = 'root'
|
||||||
|
|
||||||
if os[:family] == 'aix'
|
if os[:family] == 'aix'
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
# TODO: do not run those tests on docker yet
|
||||||
|
return if ENV['DOCKER']
|
||||||
|
|
||||||
if os[:family] == 'freebsd'
|
if os[:family] == 'freebsd'
|
||||||
filedata = {
|
filedata = {
|
||||||
user: 'root',
|
user: 'root',
|
||||||
|
@ -56,8 +59,8 @@ if os.unix?
|
||||||
# it { should have_mode }
|
# it { should have_mode }
|
||||||
its('mode') { should eq 00765 }
|
its('mode') { should eq 00765 }
|
||||||
it { should be_mode 00765 }
|
it { should be_mode 00765 }
|
||||||
its('mode') { should cmp '0765' }
|
its('mode') { should cmp 0765 }
|
||||||
its('mode') { should_not cmp '0777' }
|
its('mode') { should_not cmp 0777 }
|
||||||
|
|
||||||
it { should be_readable }
|
it { should be_readable }
|
||||||
it { should be_readable.by('owner') }
|
it { should be_readable.by('owner') }
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
# TODO: do not run those tests on docker yet
|
||||||
|
return if ENV['DOCKER']
|
||||||
|
|
||||||
case os[:family]
|
case os[:family]
|
||||||
when 'ubuntu', 'fedora'
|
when 'ubuntu', 'fedora'
|
||||||
describe iptables do
|
describe iptables do
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
# TODO: do not run those tests on docker yet
|
||||||
|
return if ENV['DOCKER']
|
||||||
|
return unless os.linux?
|
||||||
|
|
||||||
# Test kernel modules on all linux systems
|
# Test kernel modules on all linux systems
|
||||||
if os.linux?
|
describe kernel_module('video') do
|
||||||
|
it { should be_loaded }
|
||||||
describe kernel_module('video') do
|
end
|
||||||
it { should be_loaded }
|
|
||||||
end
|
describe kernel_module('bridge') do
|
||||||
|
it { should_not be_loaded }
|
||||||
describe kernel_module('bridge') do
|
end
|
||||||
it { should_not be_loaded }
|
|
||||||
end
|
describe kernel_module('dhcp') do
|
||||||
|
it { should_not be_loaded }
|
||||||
describe kernel_module('dhcp') do
|
|
||||||
it { should_not be_loaded }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
# TODO: do not run those tests on docker yet
|
||||||
|
return if ENV['DOCKER']
|
||||||
|
|
||||||
# prepare values
|
# prepare values
|
||||||
if ['ubuntu', 'centos', 'fedora', 'opensuse', 'debian'].include?(os[:family])
|
if ['ubuntu', 'centos', 'fedora', 'opensuse', 'debian'].include?(os[:family])
|
||||||
test_values = {
|
test_values = {
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
if os.linux?
|
# TODO: do not run those tests on docker yet
|
||||||
# instead of `.with` or `.only_with` we recommend to use the `mount` resource
|
return if ENV['DOCKER']
|
||||||
describe mount '/mnt/iso-disk' do
|
return unless os.linux?
|
||||||
it { should be_mounted }
|
|
||||||
its('count') { should eq 1 }
|
# instead of `.with` or `.only_with` we recommend to use the `mount` resource
|
||||||
its('device') { should eq '/tmp/empty.iso' }
|
describe mount '/mnt/iso-disk' do
|
||||||
its('type') { should eq 'iso9660' }
|
it { should be_mounted }
|
||||||
its('options') { should eq ['ro'] }
|
its('count') { should eq 1 }
|
||||||
end
|
its('device') { should eq '/tmp/empty.iso' }
|
||||||
|
its('type') { should eq 'iso9660' }
|
||||||
|
its('options') { should eq ['ro'] }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
# TODO: do not run those tests on docker yet
|
||||||
|
return if ENV['DOCKER']
|
||||||
|
|
||||||
# check that ssh runs
|
# check that ssh runs
|
||||||
if os.unix?
|
if os.unix?
|
||||||
describe port(22) do
|
describe port(22) do
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
# TODO: do not run those tests on docker yet
|
||||||
|
return if ENV['DOCKER']
|
||||||
|
|
||||||
# postgres-server is installed on these platforms
|
# postgres-server is installed on these platforms
|
||||||
if ['ubuntu', 'centos'].include? os['family']
|
if ['ubuntu', 'centos'].include? os['family']
|
||||||
postgres = postgres_session('postgres', 'inspec')
|
postgres = postgres_session('postgres', 'inspec')
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
return unless os.windows?
|
||||||
|
|
||||||
script = <<-EOH
|
script = <<-EOH
|
||||||
Write-Output 'hello'
|
Write-Output 'hello'
|
||||||
EOH
|
EOH
|
||||||
|
|
|
@ -1,67 +1,66 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
if os.windows?
|
return unless os.windows?
|
||||||
|
|
||||||
describe registry_key('HKLM\System\Test') do
|
describe registry_key('HKLM\System\Test') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
it { should have_value('test') }
|
it { should have_value('test') }
|
||||||
it { should have_property('binary value', :binary) }
|
it { should have_property('binary value', :binary) }
|
||||||
it { should have_property('Binary value', :binary) }
|
it { should have_property('Binary value', :binary) }
|
||||||
it { should have_property('string value') }
|
it { should have_property('string value') }
|
||||||
it { should have_property('String value') }
|
it { should have_property('String value') }
|
||||||
it { should have_property('dword value', :dword) }
|
it { should have_property('dword value', :dword) }
|
||||||
it { should have_property_value('multistring value', :multi_string, ['test', 'multi','string','data']) }
|
it { should have_property_value('multistring value', :multi_string, ['test', 'multi','string','data']) }
|
||||||
it { should have_property_value('Multistring Value', :multi_string, ['test', 'multi','string','data']) }
|
it { should have_property_value('Multistring Value', :multi_string, ['test', 'multi','string','data']) }
|
||||||
it { should have_property_value('qword value', :qword, 0) }
|
it { should have_property_value('qword value', :qword, 0) }
|
||||||
it { should have_property_value('Qword value', :qword, 0) }
|
it { should have_property_value('Qword value', :qword, 0) }
|
||||||
it { should have_property_value('binary value', :binary, 'dfa0f066') }
|
it { should have_property_value('binary value', :binary, 'dfa0f066') }
|
||||||
it { should have_property_value('Binary value', :binary, 'dfa0f066') }
|
it { should have_property_value('Binary value', :binary, 'dfa0f066') }
|
||||||
end
|
end
|
||||||
|
|
||||||
# serverspec compatability
|
# serverspec compatability
|
||||||
describe windows_registry_key('HKLM\System\Test') do
|
describe windows_registry_key('HKLM\System\Test') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
it { should have_value('test') }
|
it { should have_value('test') }
|
||||||
it { should have_property('string value') }
|
it { should have_property('string value') }
|
||||||
it { should have_property('binary value', :type_binary) }
|
it { should have_property('binary value', :type_binary) }
|
||||||
it { should have_property('dword value', :type_dword) }
|
it { should have_property('dword value', :type_dword) }
|
||||||
it { should have_property_value('multistring value', :type_multistring, ['test', 'multi','string','data']) }
|
it { should have_property_value('multistring value', :type_multistring, ['test', 'multi','string','data']) }
|
||||||
it { should have_property_value('qword value', :type_qword, 0) }
|
it { should have_property_value('qword value', :type_qword, 0) }
|
||||||
it { should have_property_value('binary value', :type_binary, 'dfa0f066') }
|
it { should have_property_value('binary value', :type_binary, 'dfa0f066') }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe registry_key('HKLM\Software\Policies\Microsoft\Windows\EventLog\System') do
|
describe registry_key('HKLM\Software\Policies\Microsoft\Windows\EventLog\System') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
its('MaxSize') { should_not eq nil }
|
its('MaxSize') { should_not eq nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe registry_key('HKLM\System\CurrentControlSet\Control\Session Manager') do
|
describe registry_key('HKLM\System\CurrentControlSet\Control\Session Manager') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
it { should_not have_property_value('SafeDllSearchMode', :type_dword, 0) }
|
it { should_not have_property_value('SafeDllSearchMode', :type_dword, 0) }
|
||||||
# case-insensitive test
|
# case-insensitive test
|
||||||
it { should_not have_property_value('safedllsearchmode', :type_dword, 0) }
|
it { should_not have_property_value('safedllsearchmode', :type_dword, 0) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe registry_key('HKLM\System\CurrentControlSet\Services\LanManServer\Parameters') do
|
describe registry_key('HKLM\System\CurrentControlSet\Services\LanManServer\Parameters') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
its('NullSessionShares') { should eq [''] }
|
its('NullSessionShares') { should eq [''] }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe registry_key('HKLM\Software\Policies\Microsoft\Internet Explorer\Main') do
|
describe registry_key('HKLM\Software\Policies\Microsoft\Internet Explorer\Main') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
its('Isolation64Bit') { should eq 1 }
|
its('Isolation64Bit') { should eq 1 }
|
||||||
# check that its is case-insensitive
|
# check that its is case-insensitive
|
||||||
its('isolation64bit') { should eq 1 }
|
its('isolation64bit') { should eq 1 }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe registry_key('HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services') do
|
describe registry_key('HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
its('MinEncryptionLevel') { should eq 3 }
|
its('MinEncryptionLevel') { should eq 3 }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe registry_key('HKLM\System\CurrentControlSet\Control\Lsa\MSV1_0') do
|
describe registry_key('HKLM\System\CurrentControlSet\Control\Lsa\MSV1_0') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
its('NTLMMinServerSec') { should eq 537_395_200 }
|
its('NTLMMinServerSec') { should eq 537_395_200 }
|
||||||
its('NtlmMinServerSec') { should eq 537_395_200 }
|
its('NtlmMinServerSec') { should eq 537_395_200 }
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
if os.windows?
|
return unless os.windows?
|
||||||
describe security_policy do
|
|
||||||
its('EnableAdminAccount') { should eq 1 }
|
describe security_policy do
|
||||||
its('EnableGuestAccount') { should eq 0 }
|
its('EnableAdminAccount') { should eq 1 }
|
||||||
end
|
its('EnableGuestAccount') { should eq 0 }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
# TODO: do not run those tests on docker yet
|
||||||
|
return if ENV['DOCKER']
|
||||||
|
|
||||||
# based on operating system we select the available service
|
# based on operating system we select the available service
|
||||||
if ['centos', 'fedora', 'freebsd', 'opensuse'].include?(os[:family])
|
if ['centos', 'fedora', 'freebsd', 'opensuse'].include?(os[:family])
|
||||||
# CentOS, Fedora
|
# CentOS, Fedora
|
||||||
|
@ -38,8 +41,8 @@ describe service(available_service) do
|
||||||
end
|
end
|
||||||
|
|
||||||
# extra test for ubuntu upstart with systemv service
|
# extra test for ubuntu upstart with systemv service
|
||||||
if os[:family] == 'ubuntu'
|
if os[:family] == 'ubuntu' && os[:release] == '12.04'
|
||||||
describe service('ntp') do
|
describe upstart_service('ssh') do
|
||||||
it { should be_enabled }
|
it { should be_enabled }
|
||||||
it { should be_installed }
|
it { should be_installed }
|
||||||
it { should be_running }
|
it { should be_running }
|
||||||
|
|
|
@ -85,7 +85,8 @@ else
|
||||||
|
|
||||||
# check that the user is part of the groups
|
# check that the user is part of the groups
|
||||||
if k.to_s == 'groups'
|
if k.to_s == 'groups'
|
||||||
its(k) { should include v }
|
# TODO: do not run those tests on docker yet
|
||||||
|
its(k) { should include v } unless ENV['DOCKER']
|
||||||
# default eq comparison
|
# default eq comparison
|
||||||
else
|
else
|
||||||
its(k) { should eq v }
|
its(k) { should eq v }
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
return unless os.windows?
|
||||||
|
|
||||||
# script that may have multiple lines
|
# script that may have multiple lines
|
||||||
vbscript = <<-EOH
|
vbscript = <<-EOH
|
||||||
WScript.Echo "hello"
|
WScript.Echo "hello"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
return unless os.windows?
|
||||||
|
|
||||||
# Get-WmiObject win32_service
|
# Get-WmiObject win32_service
|
||||||
# Get-WmiObject -class win32_service
|
# Get-WmiObject -class win32_service
|
||||||
# returns an array of service objects
|
# returns an array of service objects
|
||||||
|
|
Loading…
Reference in a new issue