fix integration tests for suse 11

This commit is contained in:
Christoph Hartmann 2016-09-01 18:27:00 +02:00
parent 3346d7e1a9
commit 3ddcb4c418
6 changed files with 23 additions and 16 deletions

View file

@ -70,4 +70,5 @@ platforms:
suites: suites:
- name: default - name: default
run_list: run_list:
- recipe[ssh-hardening]
- recipe[os_prepare] - recipe[os_prepare]

View file

@ -4,8 +4,9 @@ if ENV['DOCKER']
return return
end end
if !os.linux? supported = %w{ubuntu centos amazon fedora}
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__} because we are not on linux.\033[0m" unless supported.include?(os[:name])
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__} because we are not on #{supported.join(', ')}.\033[0m"
return return
end end

View file

@ -8,10 +8,12 @@ end
# lets define our own group # lets define our own group
root_group = 'root' root_group = 'root'
if os[:family] == 'aix' if os[:name] == 'aix'
root_group = 'system' root_group = 'system'
elsif os[:family] == 'freebsd' elsif os[:name] == 'freebsd'
root_group = 'wheel' root_group = 'wheel'
elsif os[:name] == 'suse'
root_group = 'sfcb'
elsif os.solaris? elsif os.solaris?
root_group = 'sys' root_group = 'sys'
end end
@ -23,7 +25,9 @@ if os.unix?
its('users') { should include 'root' } its('users') { should include 'root' }
end end
puts "ROOT GROUP: " + root_group
describe etc_group.where(name: root_group) do describe etc_group.where(name: root_group) do
its('users') { should_not eq [] }
its('users') { should include 'root' } its('users') { should include 'root' }
end end
end end

View file

@ -4,7 +4,7 @@ if ENV['DOCKER']
return return
end end
if os[:family] == 'freebsd' if os[:name] == 'freebsd'
filedata = { filedata = {
user: 'root', user: 'root',
group: 'wheel', group: 'wheel',
@ -12,7 +12,7 @@ if os[:family] == 'freebsd'
dir_md5sum: '598f4fe64aefab8f00bcbea4c9239abf', dir_md5sum: '598f4fe64aefab8f00bcbea4c9239abf',
dir_sha256sum: '9b4fb24edd6d1d8830e272398263cdbf026b97392cc35387b991dc0248a628f9', dir_sha256sum: '9b4fb24edd6d1d8830e272398263cdbf026b97392cc35387b991dc0248a628f9',
} }
elsif os[:family] == 'aix' elsif os[:name] == 'aix'
filedata = { filedata = {
user: 'root', user: 'root',
group: 'system', group: 'system',
@ -111,7 +111,7 @@ if os.unix?
its('type') { should eq :file } its('type') { should eq :file }
end end
describe file('/tmp/file') do describe file('/tmp/sfile') do
its('suid') { should eq true } its('suid') { should eq true }
its('sgid') { should eq true } its('sgid') { should eq true }
its('sticky') { should eq true } its('sticky') { should eq true }

View file

@ -5,7 +5,7 @@ if ENV['DOCKER']
end end
# prepare values # prepare values
if ['ubuntu', 'centos', 'fedora', 'opensuse', 'debian'].include?(os[:family]) if ['ubuntu', 'centos', 'fedora', 'opensuse', 'debian', 'suse'].include?(os[:name])
test_values = { test_values = {
kernel_panic: 0, kernel_panic: 0,
ip_local_port_range: "32768\t61000", ip_local_port_range: "32768\t61000",
@ -15,17 +15,18 @@ if ['ubuntu', 'centos', 'fedora', 'opensuse', 'debian'].include?(os[:family])
} }
# configue parameter derivations for different OS # configue parameter derivations for different OS
test_values[:sched_autogroup_enabled] = 0 if ['centos', 'debian'].include?(os[:family]) test_values[:sched_autogroup_enabled] = 0 if ['centos', 'debian'].include?(os[:name])
if (os[:family] == 'ubuntu' && os[:release].to_f == 10.04) || if (os[:name] == 'ubuntu' && os[:release].to_f == 10.04) ||
(os[:family] == 'debian' && os[:release].to_i == 6) || (os[:name] == 'debian' && os[:release].to_i == 6) ||
(os[:family] == 'centos' && os[:release].to_i == 5) || (os[:name] == 'centos' && os[:release].to_i == 5) ||
(os[:family] == 'opensuse') (os[:name] == 'opensuse') ||
(os[:name] == 'suse')
test_values[:sched_autogroup_enabled] = nil test_values[:sched_autogroup_enabled] = nil
end end
test_values[:nf_log] = nil if os[:family] == 'centos' && os[:release].to_i == 5 test_values[:nf_log] = nil if os[:name] == 'centos' && os[:release].to_i == 5
test_values[:kernel_panic] = 90 if os[:family] == 'opensuse' test_values[:kernel_panic] = 90 if os[:name] == 'opensuse'
else else
test_values = {} test_values = {}

View file

@ -5,7 +5,7 @@ if ENV['DOCKER']
end end
# 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', 'suse'].include?(os[:family])
# CentOS, Fedora # CentOS, Fedora
unavailable_service = 'ssh' unavailable_service = 'ssh'
available_service = 'sshd' available_service = 'sshd'