Chef shadow resource

I'm totally new to chef and has zero knowledge in ruby. But my goal is to change specific Linux user password before it expires. I have found shadow resource which I hope can be used to determine when its time to change password for that one specific user. shadow resource says :


A list of integers, indicating the number of days since Jan 1, 1970 since the password for each matching entry was changed.

Ensure all entries have changed their password in the last 90 days. (Probably want a filter on that)

describe shadow do
its('last_changes.min') { should be < - 90 -,1,1) }

Is there any chance to use this for user resource as guard? Or somehow to get that number and set to some variable which could be later used in recipe ?

I'm currently stuck since have no idea what need to be read about to understand how this describe ... could be used.

Any hint or help will be appreciated.


Unfortunately No. Inspec resources run after chef-client in the compliance phase and are used for reporting/auditing/verifying configurations meet standards set in the profile. You'd have to use the ruby-shadow gem and write your own code to get the info you're looking for as a guard.GitHub - apalmblad/ruby-shadow: Ruby-shadow on github, ruby19 support

Thanks @Stromweld for your reply and clarification. Will look for other methods then.