weblogic wlst connect 加密连接
weblogicWLST管理的连接方法一般使用明文密码,如果需要隐藏,可用如下方法
IwillstartoutwithaseriesofshortpostsaboutWLST.Ihaverecentlywrittenabunchofscriptsandthesetipswouldhavesavedmesometimehadaknownthembeforehand.
YoucanconnecttoarunningWeblogicserverlikethis:
1
2
3
./app/oracle/domains/wlsTestDomain/bin/setDomainEnv.sh
javaweblogic.WLST
connect(username='weblogic',password='mypw',url='t3://testwls01:7001')
Butifyouarewritingascriptyoudon’treallywanttostoreacleartextpassword.Insteadyoucanencrypttheusernameandpassword:
1
2
3
4
5
6
./app/oracle/domains/wlsTestDomain/bin/setDomainEnv.sh
javaweblogic.WLST
connect(username='weblogic',password='mypw',url='t3://testwls01:7001')
storeUserConfig(userConfigFile='/app/oracle/scripts/userconfig.secure',
userKeyFile='/app/oracle/scripts/userkey.secure',
nm='false')
Thiswillsaveafilethatcontainstheencryptedusernameandpassword.Theotherfilecontainsthekeythatisusedwhendecrypting.
Nowyoucanconnecttotheserverlikethis:
1
2
3
4
5
./app/oracle/domains/wlsTestDomain/bin/setDomainEnv.sh
javaweblogic.WLST
connect(userConfigFile='/app/oracle/scripts/userconfig.secure',
userKeyFile='/app/oracle/scripts/userkey.secure',
url='t3://testwls01:7001')
Thisisofcausenotaperfectsolutionandyoumustensurethatthattheykeyfileiskeptsecure.Butitismuchbetterthancleartextpasswords.
ItisalsopossibletousethiswhenconnectingtoaNodeManager:
1
2
3
4
5
nmConnect(username='nodemgr',password='mypw',
domainName='wlsTestDomain',port='5556',nmType='plain')
storeUserConfig(userConfigFile='/app/oracle/scripts/userconfigNM.secure',
userKeyFile='/app/oracle/scripts/userkeyNM.secure',
nm='true')
Nowconnectusingthekeyfile:
1
2
3
nmConnect(userConfigFile='/app/oracle/scripts/userconfigNM.secure',
userKeyFile='/app/oracle/scripts/userkeyNM.secure',
domainName='wlsTestDomain',port='5556',nmType='plain')
Pleasebeawarethatthecodesnippetsinthisposthasbeenformattedforeasyreadingandcannotbeexecuteddirectlywithoutreformatting!
转发来自http://theheat.dk/blog/?p=157