Thursday, October 14, 2010

Encrypt weblogic username & password to avoid hard coded in scripts

If you don't want to hard coded your username & password in your WLST scripts -




1. Go to domain directory

for example -
cd /opt/appsvr/product/wls_103/user_projects/domains/mydomain

2. connect with WLST

java weblogic.WLST
wls:/offline>

3. Connect with NM then WLS

nmConnect("weblogic","webl0gic","localhost","5557","mydomain","/opt/appsvr/product/wls_103/user_projects/domains/mydomain","plain")

connect('weblogic','webl0gic', localhost.com:7001')

4. Run below command ( Don't forget to update domain path accordingly )

wls:/offline> storeUserConfig('/opt/appsvr/product/wls_103/user_projects/domains/mydomain/configfile.secure', '/opt/appsvr/product/wls_103/user_projects/domains/mydomain /keyfile.secure')

Above command will create configfile.secure and keyfile.secure under your domain directory

5. Now use it like –

Connect with node manager -

nmConnect (userConfigFile='/opt/appsvr/product/wls_103/user_projects/domains/mydomain/configfile.secure',userKeyFile='/opt/appsvr/product/wls_103/user_projects/domains/mydomain/keyfile.secure',host='localhost',port='5557',domainName='mydomain',domainDir='/opt/appsvr/product/wls_103/user_projects/domains/mydomain',nmType='plain')


Connect with Weblogic -


connect(userConfigFile='/opt/appsvr/product/wls_103/user_projects/domains/mydomain/configfile.secure',userKeyFile='/opt/appsvr/product/wls_103/user_projects/domains/mydomain/keyfile.secure',url='localhost':7001')

No comments:

Post a Comment