File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 command ( 'ssh' ) . exist?
2323end
2424
25+ custom_user = attribute (
26+ 'custom_user' ,
27+ value : 'root' ,
28+ description : 'The SSH user is not always root. It must be an unprivileged user in a container'
29+ )
30+
31+ custom_path = attribute (
32+ 'custom_path' ,
33+ value : '/etc/ssh' ,
34+ description : 'Sometimes ssh configuration files are present in another location and ssh use them with the -f flag'
35+ )
36+
2537control 'ssh-01' do
2638 impact 1.0
2739 title 'client: Check ssh_config owner, group and permissions.'
28- desc 'The ssh_config should owned by root, only be writable by owner and readable to all.'
40+ desc 'The ssh_config should owned by root or a specified user , only be writable by owner and readable to all.'
2941
30- describe file ( '/etc/ssh /ssh_config') do
42+ describe file ( custom_path + ' /ssh_config') do
3143 it { should exist }
3244 it { should be_file }
33- it { should be_owned_by 'root' }
34- it { should be_grouped_into os . darwin? ? 'wheel' : 'root' }
45+ it { should be_owned_by custom_user }
46+ it { should be_grouped_into os . darwin? ? 'wheel' : custom_user }
3547 it { should_not be_executable }
3648 it { should be_readable . by ( 'owner' ) }
3749 it { should be_readable . by ( 'group' ) }
You can’t perform that action at this time.
0 commit comments