Skip to content

Commit

Permalink
Merge pull request #87 from nathanlcarlson/password_capacity
Browse files Browse the repository at this point in the history
Provide password capacity parameter to set password command
  • Loading branch information
jhoblitt authored Sep 24, 2024
2 parents 287b744 + 9d071bd commit 5bf52f8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion manifests/user.pp
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,24 @@
notify => [Exec["ipmi_user_enable_${title}"], Exec["ipmi_user_enable_sol_${title}"], Exec["ipmi_user_channel_setaccess_${title}"]],
}

if $real_password.length > 20 {
fail('ipmi v2 restricts passwords to 20 or fewer characters')
}
# Password capacity parameter defaults to 16 if not provided
# and will result in truncated passwords
if $real_password.length <= 16 {
$password_capacity = '16'
} else {
$password_capacity = '20'
}

$unless_cmd = @("CMD"/L$)
/usr/bin/ipmitool user test ${user_id} 16 "\$PASSWORD" || \
/usr/bin/ipmitool user test ${user_id} 20 "\$PASSWORD"
|- CMD
exec { "ipmi_user_setpw_${title}":
environment => ["PASSWORD=${real_password}"],
command => "/usr/bin/ipmitool user set password ${user_id} \"\$PASSWORD\"",
command => "/usr/bin/ipmitool user set password ${user_id} \"\$PASSWORD\" ${password_capacity}",
unless => $unless_cmd,
notify => Exec[
"ipmi_user_enable_${title}",
Expand Down

0 comments on commit 5bf52f8

Please sign in to comment.