mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
implement security policy resource tests
This commit is contained in:
parent
e9e24a6bd5
commit
1b643ae1da
4 changed files with 28 additions and 1 deletions
|
@ -15,7 +15,10 @@ def loadResource (resource, *args)
|
|||
}
|
||||
|
||||
@cmd_mapping = {
|
||||
'ps aux' => IO::File.join(scriptpath, '/unit/mock/cmd/ps-aux')
|
||||
'ps aux' => IO::File.join(scriptpath, '/unit/mock/cmd/ps-aux'),
|
||||
'type win_secpol.cfg' => IO::File.join(scriptpath, '/unit/mock/cmd/secedit-export'),
|
||||
'secedit /export /cfg win_secpol.cfg' => IO::File.join(scriptpath, '/unit/mock/cmd/success'),
|
||||
'del win_secpol.cfg' => IO::File.join(scriptpath, '/unit/mock/cmd/success')
|
||||
}
|
||||
|
||||
# create mock backend
|
||||
|
|
7
test/unit/mock/cmd/secedit-export
Normal file
7
test/unit/mock/cmd/secedit-export
Normal file
|
@ -0,0 +1,7 @@
|
|||
[System Access]
|
||||
MaximumPasswordAge = 42
|
||||
[Registry Values]
|
||||
MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole\SecurityLevel=4,0
|
||||
[Privilege Rights]
|
||||
SeUndockPrivilege = *S-1-5-32-544
|
||||
SeRemoteInteractiveLogonRight = *S-1-5-32-544,*S-1-5-32-555
|
0
test/unit/mock/cmd/success
Normal file
0
test/unit/mock/cmd/success
Normal file
17
test/unit/resource_security_policy_test.rb
Normal file
17
test/unit/resource_security_policy_test.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'helper'
|
||||
require 'vulcano/resource'
|
||||
|
||||
describe 'Vulcano::Resources::SecurityPolicy' do
|
||||
describe 'security_policy' do
|
||||
let(:resource) { loadResource('security_policy') }
|
||||
|
||||
it 'verify processes resource' do
|
||||
_(resource.MaximumPasswordAge).must_equal 42
|
||||
_(resource.send('MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole\SecurityLevel')).must_equal '4,0'
|
||||
_(resource.SeUndockPrivilege).must_equal '*S-1-5-32-544'
|
||||
_(resource.SeRemoteInteractiveLogonRight).must_equal '*S-1-5-32-544,*S-1-5-32-555'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue