Weblogic配置SSl使用Https
一 .可以開啟自帶的SSL連接
啟動weblogic,進入左側菜單,點擊左側的安全領域-->點擊myrealm-->點擊角色和策略-->點擊服務器AdminServer
點擊保存,weblogic12的版本,不需要重啟服務器,weblogic12以下的要重啟服務器。重啟后即可以生效。
注意一下,配置SSL后可以通過https://ip+端口/console登錄weblogic控制台,要是登錄成功了,就說明SSL配置成功。
點擊不安全,可以查看證書信息。
這里注意一點,weblogic12中的SSL使用的是sha256RSA的簽名算法,weblogic12以下的SSL使用的是MD5RSA的簽名算法,在進行安全漏洞的時候會報中危漏洞,如圖所示:
此刻就要通過自己生成的SSL證書進行測試了。
二、自己生成SSL證書配置過程。
2.1 手動制作identity.jks和trust.jks
新建jks文件夾
[weblogic@Weblogic201 ~]$ mkdir jksHL
[weblogic@Weblogic201 ~]$ cd jksHL/
生成標識identity.jks**庫
例如以下標黃色背景部分的說明:
weblogicHL為“SSL—私有**別名”。
keypass123為“SSL—私有**password短語”;
storepass123為“**—標識(identity)—定制標識**庫password短語”。
storepass123為“**庫—信任(trust)—定制標識**庫password短語”。
3650為自己定義證書的有效期,單位為天;
[weblogic@Weblogic201 jksHL]$ keytool -genkey -alias weblogicHL -keyalg RSA -keypass keypass123 -keystore identity.jks -storepass storepass123 -validity 3650
What is your first and last name?
[Unknown]: HaiLang
What is the name of your organizationalunit?
[Unknown]: GZCSS
What is the name of your organization?
[Unknown]: GZCSS
What is the name of your City or Locality?
[Unknown]: GZ
What is the name of your State or Province?
[Unknown]: GD
What is the two-letter country code forthis unit?
[Unknown]: CN
Is CN=HaiLang, OU=GZCSS, O=GZCSS, L=GZ,ST=GD, C=CN correct?
[no]: yes
導出公鑰證書的cer文件
[weblogic@Weblogic201 jksHL]$ keytool -export -alias weblogicHL -file root.cer -keystore identity.jks
Enter keystore password: storepass123
Certificate stored in file <root.cer>
生成信任trust.jks**庫
將上一步生成的root.cer公鑰證書導入並生成trust.jks**庫
[weblogic@Weblogic201 jksHL]$ keytool -import -alias weblogicHL -trustcacerts -file root.cer -keystore trust.jks
Enter keystore password: storepass123
Re-enter new password: storepass123
Owner: CN=HaiLang, OU=GZCSS, O=GZCSS, L=GZ,ST=GD, C=CN
Issuer: CN=HaiLang, OU=GZCSS, O=GZCSS,L=GZ, ST=GD, C=CN
Serial number: 559a5ac9
Valid from: Mon Jul 06 18:39:05 HKT 2015until: Thu Jul 03 18:39:05 HKT 2025
Certificate fingerprints:
MD5: 04:F2:4F:97:5B:8B:32:23:AB:69:D0:6A:42:1D:C7:77
SHA1:A0:B3:6F:90:08:0D:6B:55:6F:A6:13:C6:3B:C0:F4:CE:E1:B5:72:F9
Signature algorithm name: SHA1withRSA
Version: 3
Trust this certificate? [no]: yes
Certificate was added to keystore
至此identity.jks和trust.jks制作完畢!
2.2、在Console配置新的**庫和SSL
改動默認的Demo**庫
“**庫—更改”
選擇“定制標識和定制信任”—“保存”
填寫**庫的配置
定制標識**庫:/home/weblogic/jksHL/identity.jks 【根據實際路徑修改】
定制信任**庫:/home/weblogic/jksHL/trust.jks
定制標識/信任**類型:jks
點擊“保存”。設置完畢。
SSL的配置
私有**別名:weblogicHL
私有**password短語:keypass123
點擊“保存”;重新啟動Server。**庫和SSL配置完畢。
weblogic12以下的要重啟服務器,日志信息,當看到紅色信息的,則說明配置成功。
<Jul 6, 2015 7:20:47PM HKT> <Notice> <Security> <BEA-090171> <Loading theidentity certificate and private key stored under the alias weblogicHL from thejks keystore file /home/weblogic/jksHL/identity.jks.>
<Jul 6, 2015 7:20:47PM HKT> <Notice> <Security> <BEA-090169> <Loadingtrusted certificates from the jks keystore file /home/weblogic/jksHL/trust.jks.>
<Jul 6, 2015 7:20:47 PM HKT><Notice> <Server> <BEA-002613> <Channel"DefaultSecure" is now listening on 150.18.23.201:8012 for protocolsiiops, t3s, CLUSTER-BROADCAST-SECURE, ldaps, https.>
<Jul 6, 2015 7:20:47 PM HKT><Notice> <Server> <BEA-002613> <Channel"Default" is now listening on 150.18.23.201:8002 for protocols iiop,t3, CLUSTER-BROADCAST, ldap, snmp, http.>
<Jul 6, 2015 7:20:47 PM HKT><Notice> <WebLogicServer> <BEA-000332> <Started WebLogicManaged Server "appSrv02" for domain "myDomain" running inDevelopment Mode>
<Jul 6, 2015 7:20:48 PM HKT><Notice> <WebLogicServer> <BEA-000365> <Server statechanged to RUNNING>
<Jul 6, 2015 7:20:48 PM HKT><Notice> <WebLogicServer> <BEA-000360> <Server started inRUNNING mode>
有時候會報非法錯誤
<07-Aug-2013 13:52:53 o’clock UTC> <Error> <WebLogicServer> <BEA-000297> <Inconsistent security configuration, java.lang.RuntimeException: Cannot convert identity certificate>
<07-Aug-2013 13:52:53 o’clock UTC> <Error> <Server> <BEA-002618> <An invalid attempt was made to configure a channel for unconfigured protocol “Cannotconvert identity certificate”.>
SHA as HASH ALgorithm : If while signing the Certificate, signature hash algorithm used by CA is SHA256 (to find Algorithm,
click certificate and then Details) then this is supported only on WebLogic 10.3.3 or higher version (for prior version of WebLogic use SHA1).
For WebLogic 10.3.3 or higher with SHA256, select option Use JSSE SSL in SSL tab
大致原因,是因為weblogic版本的原因導致的。如果weblogic是10.3.3以下的就要在SSL
Configuration -> SSL (sub tab) : Click on Advanced at bottom of the Page , select check box Use JSSE SSL and then save . Activate Change and restart WebLogic Server.
勾選Use JSSE SSL,重啟服務器即可。