当我执行以下命令时,我得到了我所期望的完美哈希值。
/opt/Jboss/dc/bin/add-user.sh --silent --user testuser --password testuser*1 --realm ManagementRealm
哈希逻辑 = md5(testuser:ManagementRealm:testuser*1)
预期哈希值 = e72bfb358dd2116ad0033c01e357c1b2
但是当我用 puppet exec 尝试过同样的事情时。我得到不同的哈希值。我不知道如何调试或修复它。任何帮助深表感谢。
我的木偶代码:
define jboss::useradd(
$home,
$username,
$password,
) {
$jbossuserfix = '2>&1 | awk \'BEGIN{a=0}{if (/Error/){a=1};print}END{if (a==1) exit 1}\''
$realm = "ManagementRealm"
$filepath = "${home}/domain/configuration/mgmt-users.properties"
$encrypasswd = md5("${username}:ManagementRealm:${password}")
notify { " ${title} Encry ${encrypasswd} ": }
exec { "${title}::user::add":
environment => ["JBOSS_HOME=${home}","__PASSWD=${password}"],
command => "${home}/bin/add-user.sh --silent --user '${username}' --password \"\$__PASSWD\" --realm '{realm}' ${jbossuserfix}",
unless => "/bin/egrep -e '^${username}=${encrypasswd}' ${filepath}",
require => File["${home}/domain/configuration/domain.xml"],
logoutput => true,
}
}
以下是我使用上述代码得到的结果。
结果哈希值:fb8ed958ba3d535fb8314d4da4b96d42