Monday, August 22, 2016

JBOSS Security Password Generator

Ever struggling to generate Encrypted password using JBOSS Security Login Module ??
Here is how you can do it, go to JBOSS_INSTALLATION directory.

Run below command in Unix (some jars are required, locate that and give proper path in below command):
dmodi__Jboss$ java -cp ./DEPLOY_NAME/lib/jboss-common.jar:./DEPLOY_NAME/lib/jboss-jca.jar:./DEPLOY_NAME/lib/jbosssx.jar org.jboss.resource.security.SecureIdentityLoginModule PASSWORD
Encoded password: 5f78dc15b9a559cbdf8592078de921bc


//That's it. You are done with. But do you see any problem here, yes people KNOW what is PASSWORD, when you set this in PRODUCTION environment, where many people were present.
To hide that, you need to write a Shell Script, assume file name is "HidePassword.sh"

vi HidePassword.sh
echo "Enter Password to Encrypt for followed by Enter:"
stty -echo
read pass
stty echo
java -cp ./DEPLOY_NAME/lib/jboss-common.jar:./DEPLOY_NAME/lib/jboss-jca.jar:./DEPLOY_NAME/lib/jbosssx.jar  org.jboss.resource.security.SecureIdentityLoginModule $pass
echo 'Done'

//EXIT now=>   :wq

Run Now:

dmodi__Jboss$    sh HidePassword.sh
Enter Password to Encrypt for followed by Enter:   ( I entered same PASSWORD, but it will not be visible in console)
Encoded password: 5f78dc15b9a559cbdf8592078de921bc
Done


//Now this password you need to put into Databse security Domain files. That you can see in many links. 
For reference:    https://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html/Encrypting_Data_Source_Passwords.html
=======================END============================


No comments:

Post a Comment