问题
Quick question. I'm using rundeck 3.1.2-20190927 installed via the yum repo on Centos7/RHEL7.
I'm trying to generate the MD5 password using the command line but it looks like its only through the interactive prompts using the WAR file.
ie: java -jar rundeck-3.1.2-20190927.war --encryptpwd Jetty
Is there a way I can feed it the username/password so I can grep out the MD5 hash instead of having to do this interactively? The documentation is a bit of a mess and I'm seeing references to jetty-all JAR being able to do this but that file isn't in the bootstrap directory, just the WAR.
回答1:
You can use expect as inline script or "external" script to do that without any interaction
#!/usr/bin/expect
spawn java -jar rundeckpro-cluster-3.1.2-20190927.war --encryptpwd Jetty
expect -exact "Username (Optional, but necessary for Crypt encoding):"
send -- "user\r"
expect -exact "*Value To Encrypt (The text you want to encrypt):"
send -- "user\r"
expect eof
来源:https://stackoverflow.com/questions/58495654/automating-rundeck-password-md5-generation