Issue #5620 has been updated by derek olsen.
Assignee set to Paul Berry
Paul.
I'm looking into creating a test for this patch. I'm hoping you can help
get me moving. This will be my first forray into rspec.
I guess my main question is through the rspec test would I be able to get the
access to "line_arr[2]" or "line" in the following method?
This is the method I modified to update the lastchg field. I've been
noodling around with an rspec test and can't quite figure out how to get access
to the value associated with "line_arr[2" or "line". It makes me wonder if I
should be able to get inside of the method or if I need to modify the patch to
change how the information is passed into the method so I can intercept it with
a test? Any pointers are appreciated. Basically I'm happy with answers at
the level of "you need to redo the patch to be able to write a test" or "you
can get that value with rspec".
<pre>
def password=(cryptopw)
begin
File.open("/etc/shadow", "r") do |shadow|
File.open("/etc/shadow_tmp", "w", 0600) do |shadow_tmp|
while line = shadow.gets
line_arr = line.split(':')
if line_arr[0] == @resource[:name]
line_arr[1] = cryptopw
line_arr[2] = Time.now.to_i / 86400
line = line_arr.join(':')
end
shadow_tmp.print line
end
end
end
File.rename("/etc/shadow_tmp", "/etc/shadow")
rescue => detail
fail "Could not write temporary shadow file: #{detail}"
ensure
</pre>
Thanks. Derek.
----------------------------------------
Bug #5620: user password age not updating "lastchg" field in shadow file on
solaris
https://projects.puppetlabs.com/issues/5620
Author: derek olsen
Status: Tests Insufficient
Priority: Normal
Assignee: Paul Berry
Category: user
Target version: 2.6.x
Affected Puppet version:
Keywords: solaris lastchg password age
Branch:
Hello.
env is puppet 2.6.4, facter 1.5.8, ruby 1.8.7p302, solaris 10 x86
We are excited to get away from our super exec hacks to manage user password
expiry. As part of our migration to 2.6 we are testing the new password age
management. While the min and max password age get's adjusted correctly the
all important "lastchg" field in the solaris shadow file does not get updated
when the password changes. I consider this a bug because because if the
"lastchg" field does not get updated then the min and max ages don't provide
the functionality they had been intended to provide.
This example illustrates what I'm seeing.
<pre>
grep liluser /etc/shadow (note the date string "14364" that's when the
password was last changed)
liluser:$2a$04$qJzZqI2839382jdCbXhJ8eJUhng48J/PCUuOG6jk422J/pWZDjASW:14364:7:90::::
cat pass-age.pp (i've changed the crypt to force a password update)
user { 'liluser':
uid => '516',
gid => '10',
password_min_age => "7",
password_max_age => "90",
password => '$2a$04$qJzZqI2839382jdCbXhJ8eJUhng48J/PCU283l3h3l22J/pWZDj
ASW',
comment => 'pass age test',
shell => '/bin/bash',
ensure => 'present',
}
puppet apply --debug pass-age.pp
[stuff removed here]
notice: /Stage[main]//User[liluser]/password: changed password
debug: Finishing transaction 76130560
debug: Storing state
debug: Stored state in 0.04 seconds
grep liluser /etc/shadow (lastchg field unchanged)
liluser:$2a$04$qJzZqI2839382jdCbXhJ8eJUhng48J/PCUuOG6jk48kJ/pWZDjASW:14364:7:90::::
</pre>
Thanks. Derek.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.