Weblogic更改、破解、重置密码_weblogic修改密码
1.更改密码
1.1 在浏览器输入:http://ip:7001/console,打开之后输入用户名和密码,登录到weblogic控制台,并按下面执行:
1.2 登录进来之后点击安全领域-myrealm
1.3 找到用户和组-选择weblogic用户
1.4 点击口令,并输入新的密码之后点击保存
1.5 在weblogic控制台页面改了密码之后,还需要登录服务器修改每一个serve(包括adminserver)boot.properties文件内的密码,然后重启服务,文件内容会自动加密。
2.破解密码
如果忘记weblogic的登陆密码,可以通过下边操作进行破解密码
2.1 对于解决weblogic控制台账号重置的方法是利用解密脚本:wlsdecrypt.py对boot.properties进行反编译。(创建一个wlsdecrypt.py文件)
#Jython script for displaying de-cryted WebLogic boo.properties files# to run,change to a weblogic domain directory and executeimport osfrom java.io import FileInputStreamfrom java.util import Propertiesfrom weblogic.management import EncryptionHelperfrom weblogic.security.service import SecurityManagerfrom weblogic.security.subject import SubjectManager################################################### Main##################################################def main():#for arg in sys.argv:#if arg.count(arg.strip()):#printUsageAndExit()saltFilePath=os.path.join(\'security\',\'SerializedSystemIni.dat\')if not os.path.exists(saltFilePath):print \"Error: The Script must be run from a weblogic domain directory or a directory containing \'%s\'\" % saltFilePathprintUsageAndExit()try:open(saltFilePath,\'r\').close()except IOError:print \"Error: The file \'%s\' is not readable - check file permissions \" % saltFilePathprintUsageAndExit()processBootFiles(os.curdir,descryptPropsFile)##Decrypt (Note,to encrypt just use:EncryptionHelper.encrypt(text))#def decrypt(text):getKernelIdMethod = SecurityManager.getDeclaredMethod(\'getKernelIdentity\',None)getKernelIdMethod.accessible=1return EncryptionHelper.decrypt(text,getKernelIdMethod.invoke(SecurityManager,None))##process boot files#def processBootFiles(rootPath,processFunc):if not os.path.isdir(rootPath):returnfileNames = os.listdir(rootPath)for fileName in fileNames:path = os.path.join(rootPath,fileName)if os.path.isfile(path):if fileName == \'boot.properties\':processFunc(path)elif os.path.isdir(path):processBootFiles(path,processFunc)processFunc(\"./boot.properties\")##Decrypt Props File#def descryptPropsFile(filepath):print print \'-------Decrypting %s ------\' % filepathtry:properties = Properties()file = FileInputStream(filepath)properties.load(file)file.close()for entry in properties.entrySet():print \'%s = %s\' %(entry.key.strip(),java.lang.String(decrypt(entry.value.strip())))except IOError:print \"Error : Unable to read file \'%s\' ---check file permissions\" %filepathprint####################################print usage and exit###################################def printUsageAndExit():print print \'wlsdecrypt.py\'print \'-------------\'print print \"Jython script for displaying de-cryptde boot.properties files from a weblogic domian.before running the script ,change directory to the directory that contains a weblogic domain \"print print \'Example Usage\'##invoke main#main()
2.2 将该脚本放置domain下,复制一份server下的boot.properties到domain下,在domain下执行:
11g
{WLS_HOME}/wlserver_10.3/common/bin/wlst.sh wlsdecrypt.py
12c
{WLS_HOME}/oracle_common/common/bin/wlst.sh wlsdecrypt.py
3.重置密码
3.1 备份DefaultAuthenticatorInit.ldift
cd {DOMAIN_HOME}/security
mv DefaultAuthenticatorInit.ldift DefaultAuthenticatorInit.ldift.bak
3.2 生成DefaultAuthenticatorInit.ldift文件
11g
cd DOMAIN_HOME/security
JAVA_HOME/bin/java - cp {WLS_HOME}/wlserver_10.3/server/lib/weblogic.jar weblogic.security.utils.AdminAccount weblogic weblogic123 . (注意:命令的末尾有一个句号,句号前有一个空格,weblogic是用户、weblogic123是密码)
12c
cd DOMAIN_HOME/security
JAVA_HOME/bin/java - cp {WLS_HOME}/wlserver/server/lib/weblogic.jar weblogic.security.utils.AdminAccount weblogic weblogic123 . (注意:命令的末尾有一个句号,句号前有一个空格,weblogic是用户、weblogic123是密码)