Sometimes while we deal with interactive systems, we may not be able to set the password via stdin method.
Such as HP-UX, there is a possible workaround that may solve this problem: using "Expect".
#!/usr/bin/expect
# Usage: /opt/custom/bin/chpasswd -p <password> <userid>
set arglen [llength $argv]
set index 0
while {$index < $arglen} {
set arg [lindex $argv $index]
switch -exact $arg {
-p {
set args($arg) [lindex $argv [incr index]]
}
default {
set filename [lindex $argv $index]
}
}
incr index
}
set user [lindex $argv 2]
if {[info exists args(-p)]} {
puts "-p switch set with arg $args(-p)"
set password $args(-p)
}
spawn passwd $user
set password $password
expect "New password:"
send "$password\n"
expect "Retype new password:"
send "$password\n"
expect eof
Unlike bash, Except uses Tcl Commands,
Please reference the step below.
After setting, let's try to do provisioning, we may found out that is will execute as follow in side the debug:
<TSUDO /opt/custom/bin/chpasswd -p "Passwr0d" uat_test_01
-p switch set with arg Passwr0d
spawn passwd uat_test_01
Changing password for user uat_test_01.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
SAILPOINT>sudo -p %SAILPOINTSUDO echo $?
0
Using Expect might be powerful and can be customized for your need, also it provide a workaround, however, the endpoint need to be install and support Expect, so it does have some other concerns.
Regarding set password for interactive application, we can simply add the follow entry to the application xml:
<entry key="interactiveSetPassword" value="true" />
And configure related PasswordPrompts correlate to your system passwd output.
This will execute in the SAILPOINT Prompt instead of stdin by setPassword()
- Last Updated 12/16/2016
If there is any wrong info, please indicate my false, thanks.
- Mike