mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
Merge pull request #4314 from inspec/ja/add-shadow-example
Add SHA512 password example to `shadow` resource
This commit is contained in:
commit
e88468736a
1 changed files with 12 additions and 0 deletions
|
@ -87,6 +87,18 @@ Use `where` to match any of the supported [filter criteria](#filter_criteria). `
|
|||
its('users') { should be_empty }
|
||||
end
|
||||
|
||||
Use `where` with [expect syntax](https://www.inspec.io/docs/reference/profiles/#should-vs-expect-syntax) to show all users (that aren't disabled or locked) without SHA512 hashed passwords.
|
||||
|
||||
# Users with password fields that are not *, !, or don't begin with $6$
|
||||
bad_users = inspec.shadow.where { password !~ /^[*!]$|^\$6\$.*/ }.users
|
||||
|
||||
describe 'Password hashes in /etc/shadow' do
|
||||
it 'should only contain SHA512 hashes' do
|
||||
message = "Users without SHA512 hashes: #{bad_users.join(', ')}"
|
||||
expect(bad_users).to be_empty, message
|
||||
end
|
||||
end
|
||||
|
||||
<br>
|
||||
|
||||
## Properties
|
||||
|
|
Loading…
Reference in a new issue