Monday, April 1, 2013

How to use encrypted password in JBoss EAP 6 datasource


In order to use encrypted password in EAP 6 datasource follow the bellow mentioned steps:
Step-1). Encrypt the database password by running the following script:
JBOSS_HOME=/apps/jboss-jpp-6.0
echo "Please enter the password to be encrypted"
read password
java -cp $JBOSS_HOME/modules/org/picketbox/main/picketbox-4.0.14.Final-redhat-3.jar:$JBOSS_HOME/modules/org/picketbox/main/picketbox-commons-1.0.0.final-redhat-2.jar:$JBOSS_HOME/modules/org/picketbox/main/picketbox-infinispan-4.0.14.Final-redhat-2.jar:$JBOSS_HOME/modules/org/jboss/logging/main/jboss-logging-3.1.2.GA-redhat-1.jar org.picketbox.datasource.security.SecureIdentityLoginModule $password
Step-2). In your JBoss configuration file like "standalone.xml", "standalone-full.xml", "domain.xml"...etc in the [subsystem xmlns="urn:jboss:domain:security:1.2"] subsystem create a by specifying the encrypted database password as following:

 
  
    
    
    
  
 

Step-3). Create a DataSource like following by specifying the rather than passing the cleartext username & password:

  jdbc:mysql://localhost:3306/testDB
  com.mysql.jdbc.Driver
  mysql-connector-java-5.1.13-bin.jar
  
   encryptedSecurityDomain
  

Step-4). Restart your JBoss EAP6 and then with the help of CLI utility you can test your DataSource as following:
In Standalone mode:
[standalone@localhost:9999 /] /subsystem=datasources/data-source=MySqlDS_Pool:test-connection-in-pool { "outcome" => "success", "result" => [true] } Reference : https://access.redhat.com/knowledge/solutions/184963


3 comments:

Shweta said...

hey please help ...
how to run the following script :-
java -cp $JBOSS_HOME/modules/org/picketbox/main/picketbox-4.0.14.Final-redhat-3.jar:$JBOSS_HOME/modules/org/picketbox/main/picketbox-commons-1.0.0.final-redhat-2.jar:$JBOSS_HOME/modules/org/picketbox/main/picketbox-infinispan-4.0.14.Final-redhat-2.jar:$JBOSS_HOME/modules/org/jboss/logging/main/jboss-logging-3.1.2.GA-redhat-1.jar org.picketbox.datasource.security.SecureIdentityLoginModule $password

I am using windows xp ...whenevr i run this command i get an error message "Exception in thread "main" java.lang.NoClassDefFoundError: org/picketbox/datasource/security/SecureIdentityLoginModule"
"Could not find the main class: org.picketbox.datasource.security.SecureIdentityLoginModule. Program will exit."

danowardo said...

On Windows, you must use semi-colon instead of colon. Also, use %% instead of ${}

java -cp %JBOSS_HOME%/modules/org/picketbox/main/picketbox-4.0.14.Final-redhat-3.jar;%JBOSS_HOME%/modules/org/picketbox/main/picketbox-commons-1.0.0.final-redhat-2.jar;%JBOSS_HOME%/modules/org/picketbox/main/picketbox-infinispan-4.0.14.Final-redhat-2.jar;%JBOSS_HOME%/modules/org/jboss/logging/main/jboss-logging-3.1.2.GA-redhat-1.jar org.picketbox.datasource.security.SecureIdentityLoginModule your_password_goes_here

Unknown said...

I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Alfresco , kindly contact us http://www.maxmunus.com/contact
MaxMunus Offer World Class Virtual Instructor led training on Alfresco. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
For Demo Contact us:
Name : Arunkumar U
Email : arun@maxmunus.com
Skype id: training_maxmunus
Contact No.-+91-9738507310
Company Website –http://www.maxmunus.com