weblogic wlst connect 加密连接

weblogic WLST 管理的连接方法一般使用明文密码, 如果需要隐藏, 可用如下方法

I will start out with a series of short posts about WLST. I have recently written a bunch of scripts and these tips would have saved me some time had a known them beforehand.

You can connect to a running Weblogic server like this:

1
2
3
. /app/oracle/domains/wlsTestDomain/bin/setDomainEnv.sh
java weblogic.WLST
connect(username='weblogic', password='mypw', url='t3://testwls01:7001')
But if you are writing a script you don’t really want to store a clear text password. Instead you can encrypt the user name and password:

1
2
3
4
5
6
. /app/oracle/domains/wlsTestDomain/bin/setDomainEnv.sh
java weblogic.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')
This will save a file that contains the encrypted user name and password. The other file contains the key that is used when decrypting.

Now you can connect to the server like this:

1
2
3
4
5
. /app/oracle/domains/wlsTestDomain/bin/setDomainEnv.sh
java weblogic.WLST
connect(userConfigFile='/app/oracle/scripts/userconfig.secure',
userKeyFile='/app/oracle/scripts/userkey.secure',
url='t3://testwls01:7001')
This is of cause not a perfect solution and you must ensure that that they key file is kept secure. But it is much better than clear text passwords.

It is also possible to use this when connecting to a Node Manager:

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')
Now connect using the key file:

1
2
3
nmConnect(userConfigFile='/app/oracle/scripts/userconfigNM.secure',
userKeyFile='/app/oracle/scripts/userkeyNM.secure',
domainName='wlsTestDomain', port='5556', nmType='plain')
Please be aware that the code snippets in this post has been formatted for easy reading and cannot be executed directly without reformatting!


转发来自 http://theheat.dk/blog/?p=157
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值