Skip to content

Commit

Permalink
Merge pull request #162 from artem-sidorenko/debian-shadow
Browse files Browse the repository at this point in the history
Proper permissions for shadow on debian family
  • Loading branch information
artem-sidorenko authored May 22, 2017
2 parents f7d7d7e + 285946d commit 2c68b00
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions recipes/minimize_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@
end
end

# shadow must only be accessible to user root
# limit access to shadow. On debian family group shadow should be able to read it
# (otherwise screensavers might break etc)
file '/etc/shadow' do
owner 'root'
group 'root'
mode '0600'
if node['platform_family'] == 'debian'
group 'shadow'
mode '0640'
else
group 'root'
mode '0600'
end
end

# su must only be accessible to user and group root
Expand Down
4 changes: 2 additions & 2 deletions spec/recipes/minimize_access_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
it 'creates /etc/shadow' do
is_expected.to create_file('/etc/shadow').with(
user: 'root',
group: 'root',
mode: '0600'
group: 'shadow',
mode: '0640'
)
end

Expand Down

0 comments on commit 2c68b00

Please sign in to comment.