You can follow these step
1) In your file standalone.xml after </extensions>
you have to add
<vault>
<vault-option name="KEYSTORE_URL" value="/home/mino/jboss-eap7/vault.keystore"/>
<vault-option name="KEYSTORE_PASSWORD" value="MASK-1l/Uou6siko"/>
<vault-option name="KEYSTORE_ALIAS" value="vault"/>
<vault-option name="SALT" value="12345678"/>
<vault-option name="ITERATION_COUNT" value="44"/>
<vault-option name="ENC_FILE_DIR" value="/home/mino/jboss7/"/>
</vault>
2) In datasources tag
you have add
<datasource jta="true" jndi-name="java:/mydb" pool-name="my_pool" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/mydb</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>${VAULT::password::password::ODRkMGMwYjMtMjVmYy00YmUyLTk0MjQtNTk0MTdmZDA4ZDY5TElORV9CUkVBS3ZhdWx0}</password>
</security>
<validation>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
<exception-sorter class-name="org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter"/>
</validation>
<statement>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
If you don't know VAULT follow these step:
1) YOU RUN vault.sh
root@mino-giralatina:/home/mino/jboss7maven/jboss/bin# ./vault.sh
=========================================================================
JBoss Vault
JBOSS_HOME: /home/mino/jboss7maven/jboss-eap-6.0
JAVA: java
VAULT Classpath: /home/mino/jboss7maven/jboss/modules/org/picketbox/main/*:/home/mino/jboss7maven/jboss/modules/org/jboss/logging/main/*:/home/mino/jboss7maven/jboss/modules/org/jboss/common-core/main/*:/home/mino/jboss7maven/jboss/modules/org/jboss/as/security/main/*
=========================================================================
**********************************
**** JBoss Vault ********
**********************************
Please enter a Digit:: 0: Start Interactive Session 1: Remove Interactive Session 2: Exit
// YOU HAVE DIGIT 0
0
Starting an interactive session
//in this path will be saved the encrypted files
Enter directory to store encrypted files (end with either / or \ based on Unix or Windows:/home/enac/jdk1.6.0_14/bin/asdoc7/
//you must have the keystore file
Enter Keystore URL:/home/enac/jdk1.6.0_14/bin/vault.keystore
Enter Keystore password:
Enter Keystore password again:
Values match
Enter 8 character salt:12345678
Enter iteration count as a number (Eg: 44):44
//Save these notes you will need to use tags in vault, See above
Please make note of the following:
********************************************
Masked Password:MASK-1l/Uou6siko
salt:12345678
Iteration Count:44
********************************************
Enter Keystore Alias:vault
8-ott-2012 15.41.10 org.jboss.security.vault.SecurityVaultFactory get
INFO: Getting Security Vault with implementation of org.picketbox.plugins.vault.PicketBoxSecurityVault
Obtained Vault
Initializing Vault
8-ott-2012 15.41.11 org.picketbox.plugins.vault.PicketBoxSecurityVault init
INFO: Default Security Vault Implementation Initialized and Ready
Vault is initialized and ready for use
Handshake with Vault complete
Please enter a Digit:: 0: Store a password 1: Check whether password exists 2: Exit
0
Task: Store a password
//the encrypt attribute (in this case password)
Please enter attribute value:
Please enter attribute value again:
Values match
Enter Vault Block:password
Enter Attribute Name:password
Attribute Value for (password, password) saved
Please make note of the following:
********************************************
Vault Block:password
Attribute Name:password
Shared Key:NWUyNTNhZjMtMzgxOS00YjkwLTk1YmEtMzI1NjE2OTlmODViTElORV9CUkVBS3ZhdWx0
Configuration should be done as follows:
// Now, you can copy this string forn encrypt password database
VAULT::password::password::NWUyNTNhZjMtMzgxOS00YjkwLTk1YmEtMzI1NjE2OTlmODViTElORV9CUkVBS3ZhdWx0
ain't that simple
Utils link for generate keystore file.
You have to follow alone first spep
https://community.jboss.org/wiki/CREATEKEYSTORECONNECTORHTTPS
Comments