Created
May 20, 2014 15:08
-
-
Save aderixon/863e730bc61dea958abe to your computer and use it in GitHub Desktop.
Example of enabling password history in PAM using Puppet/Augeas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class pam::passwd_history( | |
$num = 4 | |
) { | |
case $::osfamily { | |
/(?i-mx:redhat)/: { | |
# enable password history | |
# if not present: | |
augeas { 'passwd-hist': | |
context => '/files/etc/pam.d/system-auth', | |
changes => ["set *[module =~ regexp('.*pam_unix.so')][type = 'password']/argument[last()+1] remember=${num}"], | |
onlyif => "match *[module =~ regexp('.*pam_unix.so')][type = 'password'][argument = 'remember=${num}'] size == 0" | |
} | |
} | |
default: { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment