针对这几年来WebLogic软件经常报出的java反序列化漏洞问题,因为weblogic底层也使用Apache Commons Collections库,WebLogic 存在Java反序列化漏洞无疑的,在漏洞修复这方面,Oracle可是很不走心,每个季度更新补丁包,还是未修完,本文针对Weblogic反序列化漏洞补丁提供升级方案以及升级过程遇到问题问题过程处理。
[root@dbtest ~]# ps -ef|grep weblogic
执行结果如下:
根据执行结果得知Weblogic安装目录为:/home/oracle/Oracle/Middleware1036/wlserver_10.3;并且看到有两个Weblogic进程(是由于Weblogic存在两个域都处于启用状态),以及两个进程的进程ID分别为8014、11039,补丁升级必须要停掉所有的服务。
执行命令 kill -9 XXX XXX为进程ID,执行后可再次查看Weblogic进程,说明Weblogic服务已停(可通过Weblogic启停命令执行停服务操作)。
[root@dbtest ~]# kill -9 8014
[root@dbtest ~]# kill -9 11039
[root@dbtest ~]# ps -ef|grep weblogic
root 11780 11743 0 17:37 pts/1 00:00:00 grep weblogic
通过SFTP将补丁包(pXXXXXX_1036_Generic.zip)上传至服务器任一个目录下(例如:/weblogic_cd/weblogic_patch)。
[root@dbtest bsu]# cd /weblogic_cd/weblogic_patch/
[root@dbtest weblogic_patch]# ll
总计 125376
-rw-r--r-- 1 root root 128252982 10-29 17:06 p30109677_1036_Generic.zip
然后复制到 /home/oracle/Oracle/Middleware1036 /utils/bsu/cache_dir/目录下(weblogic部署的根目录下的bsu路径,如果没有这个文件夹就创建,保证这个文件夹有读写权限)。
[root@dbtest weblogic_patch]# cp -p /weblogic_cd/weblogic_patch/p30109677_1036_Generic.zip /home/oracle/Oracle/Middleware1036/utils/bsu/cache_dir/p30109677_1036_Generic.zip
然后切换目录位置,通过uzip进行解压。
[root@dbtest weblogic_patch]# cd /home/oracle/Oracle/Middleware1036/utils/bsu/cache_dir
[root@dbtest cache_dir]# ll
总计 1325224
-rw-r--r-- 1 root root 91704553 2018-08-20 GENM.jar
-rw-r--r-- 1 root root 91264134 2018-02-22 GFWX.jar
-rw-r--r-- 1 root root 7874 05-20 05:52 IL49.jar
-rw-r--r-- 1 root root 97388803 2018-04-18 p27395085_1036_Generic.zip
-rw-r--r-- 1 root root 98642020 2018-10-22 p28343311_1036_Generic.zip
-rw-r--r-- 1 root root 101146352 07-03 17:28 p29204678_1036_Generic.zip
-rw-r--r-- 1 root root 128252982 10-29 17:06 p30109677_1036_Generic.zip
-rw-r--r-- 1 root root 100263902 2018-02-22 patch-catalog_25890.xml
-rw-r--r-- 1 root root 121290241 2018-08-20 patch-catalog_26256.xml
-rw-r--r-- 1 root root 136403408 2019-02-04 patch-catalog_26516.xml
-rw-r--r-- 1 root root 148026605 05-20 05:52 patch-catalog_26697.xml
-rw-r--r-- 1 root root 148026605 07-03 15:35 patch-catalog.xml
-rw-rw-r-- 1 root root 61520 05-09 15:44 README.txt
-rw-r--r-- 1 root root 93124490 2019-02-04 U5I2.jar
[root@dbtest cache_dir]# unzip p30109677_1036_Generic.zip
Archive: p30109677_1036_Generic.zip
replace README.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
inflating: README.txt
inflating: patch-catalog_26853.xml
inflating: 3L3H.jar
由于该目录下已经包含README.txt文件,提示是否需要替换,输入y然后回车即可(新打补丁无此问题),解压后看到一个jar文件3L3H.jar,3L3H即为补丁ID,也可以通过README.txt查询此次补丁包ID 。
[root@dbtest cache_dir]# more README.txt
[root@dbtest ~]# cd /home/oracle/Oracle/Middleware1036/utils/bsu
[root@dbtest bsu]# pwd
/home/oracle/Oracle/Middleware1036/utils/bsu
[root@dbtest bsu]# ./bsu.sh -view -prod_dir=/home/oracle/Oracle/Middleware1036/wlserver_10.3 -status=applied -verbose
ProductName: WebLogic Server
ProductVersion: 10.3 MP6
Components: WebLogic Server/Core Application Server,WebLogic Server/Admi
nistration Console,WebLogic Server/Configuration Wizard and
Upgrade Framework,WebLogic Server/Web 2.0 HTTP Pub-Sub Serve
r,WebLogic Server/WebLogic SCA,WebLogic Server/WebLogic JDBC
Drivers,WebLogic Server/Third Party JDBC Drivers,WebLogic S
erver/WebLogic Server Clients,WebLogic Server/WebLogic Web S
erver Plugins,WebLogic Server/UDDI and Xquery Support,WebLog
ic Server/Evaluation Database,WebLogic Server/Workshop Code
Completion Support
BEAHome: /home/oracle/Oracle/Middleware1036
ProductHome: /home/oracle/Oracle/Middleware1036/wlserver_10.3
PatchSystemDir: /home/oracle/Oracle/Middleware1036/utils/bsu
PatchDir: /home/oracle/Oracle/Middleware1036/patch_wls1036
Profile: Default
DownloadDir: /home/oracle/Oracle/Middleware1036/utils/bsu/cache_dir
JavaVersion: 1.6.0_29
JavaVendor: Sun
Patch ID: U5I2
PatchContainer: U5I2.jar
Checksum: 1091735558
Severity: optional
Category: General
CR/BUG: 29204678
Restart: true
Description: WLS PATCH SET UPDATE 10.3.6.0.190416
WLS PATCH SET UPDATE 10
.3.6.0.190416
Patch ID: IL49
PatchContainer: IL49.jar
Checksum: 1345789832
Severity: optional
Category: General
CR/BUG: 29800003
Restart: true
Description: 10.3.6.0.190416 Overlay : MERGE REQUEST ON TOP OF WLS PSU 10
.3.6.0.190416 FOR BUGS 29694149 29726561
Oracle WebLogic Sev
er overlay patch for 10.3.6.0.190416 which requires WLS 10.3
.6.0.190416 PSU (Patch Number: 29204678 , Patch ID :U5I2) in
the environment
可以查看到已经安装的补丁有两个,补丁ID分别为:IL49、U5I2;由于本次补丁升级是问题叠加包升级,打补丁时针对已有的补丁会检测补丁冲突,这里就先卸载这两个补丁后在进行补丁升级(注:一般情况下是打补丁时进行检查冲突时发现补丁才进行此操作,这里就先进行补丁卸载操作啦)
卸载补丁执行命令:./bsu.sh -remove -verbose -patchlist=XXXX -prod_dir=…/…/wlserver_10.3/
XXXX 为补丁包ID(IL49)
…/…/ 为相对于目录bsu的相对目录,不建议使用绝对路径奥
[root@dbtest bsu]# ./bsu.sh -remove -verbose -patchlist=IL49 -prod_dir=../../wlserver_10.3/
检查冲突.................
未检测到冲突
开始删除补丁程序 ID: IL49
删除 /home/oracle/Oracle/Middleware1036/patch_wls1036/patch_jars/BUG29800003_1036.jar
更新 /home/oracle/Oracle/Middleware1036/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar
旧清单值: Class-Path= ../../../patch_jars/BUG29800003_1036.jar ../../../patch_jars/BUG29204678_10360190416.jar ../../../patch_jars/com.bea.core.apache.commons.fileupload_1.0.0.0_1-3-1.jar ../../../patch_jars/com.bea.core.stax2_2.0.0.0_3-0-3.jar ../../../patch_jars/glassfish.jaxb_1.2.0.0_2-1-14.jar ../../../patch_jars/glassfish.jaxb.xjc_1.2.0.0_2-1-14.jar ../../../patch_jars/glassfish.jaxp_1.4.5.0.jar ../../../patch_jars/glassfish.jaxws.mimepull_1.1.0.0_1-3-8.jar ../../../patch_jars/glassfish.jaxws.rt_1.4.0.0_2-1-5.jar ../../../patch_jars/glassfish.jaxws.saaj.impl_1.0.0.0_2-1-5.jar
新清单值: Class-Path= ../../../patch_jars/BUG29800003_1036.jar ../../../patch_jars/BUG29204678_10360190416.jar ../../../patch_jars/com.bea.core.apache.commons.fileupload_1.0.0.0_1-3-1.jar ../../../patch_jars/com.bea.core.stax2_2.0.0.0_3-0-3.jar ../../../patch_jars/glassfish.jaxb_1.2.0.0_2-1-14.jar ../../../patch_jars/glassfish.jaxb.xjc_1.2.0.0_2-1-14.jar ../../../patch_jars/glassfish.jaxp_1.4.5.0.jar ../../../patch_jars/glassfish.jaxws.mimepull_1.1.0.0_1-3-8.jar ../../../patch_jars/glassfish.jaxws.rt_1.4.0.0_2-1-5.jar ../../../patch_jars/glassfish.jaxws.saaj.impl_1.0.0.0_2-1-5.jar
结果: 成功
同样卸载另外一个冲突补丁包(U5I2)
开始删除补丁程序 ID: U5I2
删除 /home/oracle/Oracle/Middleware1036/wlserver_10.3/server/lib/DefaultAuthorizerUpdate_62.ldift
删除 /home/oracle/Oracle/Middleware1036/modules/com.bea.core.stax2_2.0.0.0_3-0-3.jar
....略去一部分....
删除 /home/oracle/Oracle/Middleware1036/patch_wls1036/patch_jars/glassfish.jaxws.saaj.impl_1.0.0.0_2-1-5.jar
更新 /home/oracle/Oracle/Middleware1036/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar
旧清单值: Class-Path= ../../../patch_jars/BUG29204678_10360190416.jar ../../../patch_jars/com.bea.core.apache.commons.fileupload_1.0.0.0_1-3-1.jar ../../../patch_jars/com.bea.core.stax2_2.0.0.0_3-0-3.jar ../../../patch_jars/glassfish.jaxb_1.2.0.0_2-1-14.jar ../../../patch_jars/glassfish.jaxb.xjc_1.2.0.0_2-1-14.jar ../../../patch_jars/glassfish.jaxp_1.4.5.0.jar ../../../patch_jars/glassfish.jaxws.mimepull_1.1.0.0_1-3-8.jar ../../../patch_jars/glassfish.jaxws.rt_1.4.0.0_2-1-5.jar ../../../patch_jars/glassfish.jaxws.saaj.impl_1.0.0.0_2-1-5.jar
新清单值: Class-Path=
结果: 成功
至此冲突补丁包已经卸载完毕。
执行命令:./bsu.sh -install -patch_download_dir=./cache_dir -patchlist=XXXX -prod_dir=…/…/wlserver_10.3/
【注1】-patch_download_dir=./cache_dir 该目录地址是补丁包存在的目录,且我们在操作的过程中已经退出到bsu目录下,所以填写格式为./cache_dir,切记千万别填写绝对路径。
【注2】-prod_dir=…/…/wlserver_10.3/ 该目录是wlserver的地址目录也就是weblogic的程序目录,填写格式是非绝对路径,根据现在的目录位置是BSU,所以填写的路径为…/…/ wlserver_10.3/
【注3】-patchlist=XXXX 是补丁包ID。在补丁包的REDME.txt文件中有写(本次新补丁ID(3L3H))。
[root@dbtest bsu]# ./bsu.sh -install -patch_download_dir=./cache_dir -patchlist=3L3H -prod_dir=../../wlserver_10.3/
检查冲突.................
未检测到冲突
正在安装补丁程序 ID: 3L3H..
结果: 成功
经过漫长的检查冲突之后会出现安装,将出现安装补丁包3L3H字眼然后出现,则表示安装成功,至此补丁包已经升级成功。
切换到Weblogic安装目录的bin目录下,执行setWLSEnv.sh
[root@dbtest bsu]# cd/home/oracle/Oracle/Middleware1036/wlserver_10.3/server/bin
[root@dbtest bin]# pwd
/home/oracle/Oracle/Middleware1036/wlserver_10.3/server/bin
[root@dbtest bin]# ll
总计 16
drwxr-x--- 2 root root 4096 2018-01-29 international
-rwxr-x--- 1 root root 3901 2018-01-29 setWLSEnv.sh
-rwxr-x--- 1 root root 4604 2018-01-29 startNodeManager.sh
[root@dbtest bin]# ./setWLSEnv.sh
CLASSPATH=/home/oracle/Oracle/Middleware1036/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/oracle/Oracle/Middleware1036/patch_ocp371/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/usr/java/jdk1.8.0_161/lib/tools.jar:/home/oracle/Oracle/Middleware1036/wlserver_10.3/server/lib/weblogic_sp.jar:/home/oracle/Oracle/Middleware1036/wlserver_10.3/server/lib/weblogic.jar:/home/oracle/Oracle/Middleware1036/modules/features/weblogic.server.modules_10.3.6.0.jar:/home/oracle/Oracle/Middleware1036/wlserver_10.3/server/lib/webservices.jar:/home/oracle/Oracle/Middleware1036/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/home/oracle/Oracle/Middleware1036/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:
PATH=/home/oracle/Oracle/Middleware1036/wlserver_10.3/server/bin:/home/oracle/Oracle/Middleware1036/modules/org.apache.ant_1.7.1/bin:/usr/java/jdk1.8.0_161/jre/bin:/usr/java/jdk1.8.0_161/bin:/usr/local/openssl/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin
Your environment has been set.
记得上次进行补丁升级时遇到冲突问题,然后进行冲突补丁卸载,卸载时发现冲突补丁包ID(GFDX)无法识别。
首先要确认补丁的patch id是否存在,操作命令如下(保证在bsu目录下执行):
./bsu.sh -view -prod_dir=/…/…/…/wlserver_10.3 -status=applied -verbose(/…/…/…部分为orale安装根目录)。
如上图所示没有看到patch id 则有以下几种可能
重新解压已安装的旧的季度更新包到/…/…/cache_dir目录下,重新执行安装命令
./bsu.sh -install -patch_download_dir=./cache_dir -patchlist=GFWX -prod_dir=…/…/wlserver_10.3/
等待完成,提示已安装,再查看patch id,如下图所示:
问题解决,执行卸载命令:./bsu.sh -remove -verbose -patchlist=GFWX -prod_dir=…/…/wlserver_10.3/
【更新】 今天生产环境进行补丁包升级时遇到Exception in thread “main” Exception in thread “Thread-0” java.lang.OutOfMemoryError: GC overhead limit exceeded 的问题。
[root@server4 bsu]# ./bsu.sh -install -patch_download_dir=./cache_dir -patchlist=3L3H -prod_dir=../../wlserver_10.3/
Exception in thread "main" Exception in thread "Thread-0" java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.bea.cie.common.dao.xbean.XBeanDataHandler.createDataHandler(XBeanDataHandler.java:559)
at com.bea.cie.common.dao.xbean.XBeanDataHandler.getComplexValue(XBeanDataHandler.java:455)
at com.bea.plateng.patch.dao.cat.PatchCatalogHelper.getPatchDependencies(PatchCatalogHelper.java:442)
at com.bea.plateng.patch.dao.cat.PatchCatalogHelper.getPatchDependencies(PatchCatalogHelper.java:464)
at com.bea.plateng.patch.dao.cat.PatchCatalog.getPatchDependencies(PatchCatalog.java:56)
at com.bea.plateng.patch.dao.cat.PatchCatalogHelper.getInvalidatedPatchMap(PatchCatalogHelper.java:1621)
at com.bea.plateng.patch.PatchSystem.updatePatchCatalog(PatchSystem.java:436)
at com.bea.plateng.patch.PatchSystem.refresh(PatchSystem.java:130)
at com.bea.plateng.patch.PatchSystem.(PatchSystem.java:114)
at com.bea.plateng.patch.PatchSystem.(PatchSystem.java:41)
at com.bea.plateng.patch.Patch.main(Patch.java:279)
java.lang.NoClassDefFoundError: Could not initialize class com.bea.plateng.patch.PatchSystem
at com.bea.plateng.patch.PatchClientHelper.getAllPatchDetails(PatchClientHelper.java:74)
at com.bea.plateng.patch.PatchInstallationHelper.cleanupPatchSets(PatchInstallationHelper.java:130)
at com.bea.plateng.patch.PatchTarget.(PatchTarget.java:272)
at com.bea.plateng.patch.PatchTargetFactory.create(PatchTargetFactory.java:30)
at com.bea.plateng.patch.ProductAliasTarget.constructPatchTargetList(ProductAliasTarget.java:88)
at com.bea.plateng.patch.ProductAliasTarget.(ProductAliasTarget.java:46)
at com.bea.plateng.patch.ProductAliasTargetHelper.getProdAliasTargetList(ProductAliasTargetHelper.java:55)
at com.bea.plateng.patch.ProductAliasTargetHelper.getAllHomeToProdAliasesTargetMap(ProductAliasTargetHelper.java:32)
at com.bea.plateng.patch.ProductAliasTargetHelper.checkProfilesInProductAliases(ProductAliasTargetHelper.java:133)
at com.bea.plateng.patch.Patch$1.run(Patch.java:376)
at java.lang.Thread.run(Thread.java:748)
You have mail in /var/spool/mail/root
进入到bsu目录下查看bsu.sh 中的MEM_ARGS ,并适当增大内存配置,可以通过查看README.txt 文件,官方建议设置大小进行设置。
[root@server4 bsu]# more bsu.sh
#!/bin/sh
JAVA_HOME="/usr/lib/jdk1.8.0_161"
MEM_ARGS="-Xms512m -Xmx1024m"
"$JAVA_HOME/bin/java" ${MEM_ARGS} -jar patch-client.jar $*
查看README.txt 文件中建议值大小,README.txt文件位于解压缩文件中(例如本文位于:/root/Oracle/Middleware1036/utils/bsu/cache_dir),经查看文档官方建议MEM_ARGS="-Xms1024m -Xmx3072m"
使用vi命令修改文件bsu.sh 中的MEM_ARGS 配置。执行命令vi bsu.sh 进行编辑,编辑完后:按ESC 后键入命令:(:wq)保存并退出。
[root@server4 bsu]# vi bsu.sh
#!/bin/sh
JAVA_HOME="/usr/lib/jdk1.8.0_161"
MEM_ARGS="-Xms1024m -Xmx3072m"
"$JAVA_HOME/bin/java" ${MEM_ARGS} -jar patch-client.jar $*
~
#!/bin/sh
JAVA_HOME="/usr/lib/jdk1.8.0_161"
"bsu.sh" 7L, 137C written
然后在执行补丁升级命令即可。
[root@server4 bsu]# ./bsu.sh -install -patch_download_dir=./cache_dir -patchlist=3L3H -prod_dir=../../wlserver_10.3/
检查冲突..............
未检测到冲突
正在安装补丁程序 ID: 3L3H..
结果: 成功
You have mail in /var/spool/mail/root