mirror of
https://github.com/inspec/inspec
synced 2024-12-23 11:33:14 +00:00
cda492af96
Signed-off-by: Jeremy J. Miller <jm@chef.io>
69 lines
1.4 KiB
Ruby
69 lines
1.4 KiB
Ruby
# encoding: utf-8
|
|
# author: Christoph Hartmann
|
|
# author: Dominik Richter
|
|
#
|
|
# prepares a sample file for verification
|
|
|
|
if node['platform_family'] != 'windows'
|
|
|
|
gid = case node['platform_family']
|
|
when 'aix'
|
|
'system'
|
|
when 'freebsd'
|
|
'wheel'
|
|
when 'solaris', 'solaris2'
|
|
'sys'
|
|
else
|
|
'root'
|
|
end
|
|
|
|
|
|
file '/tmp/file' do
|
|
mode '0765'
|
|
owner 'root'
|
|
group gid
|
|
content 'hello world'
|
|
end
|
|
|
|
file '/tmp/sfile' do
|
|
mode '7765'
|
|
owner 'root'
|
|
group gid
|
|
content 'hello suid/sgid/sticky'
|
|
end
|
|
|
|
directory '/tmp/folder' do
|
|
mode '0567'
|
|
owner 'root'
|
|
group gid
|
|
end
|
|
|
|
else
|
|
|
|
user 'TestUser' do
|
|
password 'p@ssw0rd'
|
|
end
|
|
|
|
directory 'C:\Test Directory' do
|
|
rights :read, 'Administrators'
|
|
rights :read_execute, 'Administrators'
|
|
rights :write, 'Administrators'
|
|
rights :modify, 'Administrators'
|
|
rights :full_control, 'Administrators', :applies_to_children => true
|
|
deny_rights :read, 'TestUser'
|
|
deny_rights :write, 'TestUser'
|
|
deny_rights :read_execute, 'TestUser'
|
|
end
|
|
|
|
file 'C:\Test Directory\test file.txt' do
|
|
rights :read, 'Administrators'
|
|
rights :read_execute, 'Administrators'
|
|
rights :write, 'Administrators'
|
|
rights :modify, 'Administrators'
|
|
rights :full_control, 'Administrators'
|
|
deny_rights :read, 'TestUser'
|
|
deny_rights :write, 'TestUser'
|
|
deny_rights :read_execute, 'TestUser'
|
|
end
|
|
|
|
end
|