ablog

不器用で落着きのない技術者のメモ

WebLogic で自己署名証明書を作成する手順

古い WebLogic をインストールして、SSL を使おうと思ったらサーバ証明書の有効期限が切れていたので、自己署名証明書を作成したときの手順をメモっておく。


環境: BEA WebLogic Platform 7.0 on Windows XP Professional
証明書作成に使用したもの: keytool(JDKに同梱)

  • 秘密鍵・公開鍵・自己証明書を作成する。
> cd C:\mydomain
> C:\bea\jdk131_06\bin\keytool -genkey -keyalg rsa -keystore mykeystore.jks -alias weblogic -keysize 512 -keypass weblogic -storepass weblogic -validity 365

What is your first and last name?
  [Unknown]:  apsvr01
What is the name of your organizational unit?
  [Unknown]:  IT
What is the name of your organization?
  [Unknown]:  Hoge,Inc.
What is the name of your City or Locality?
  [Unknown]:  Minato-ku
What is the name of your State or Province?
  [Unknown]:  Tokyo
What is the two-letter country code for this unit?
  [Unknown]:  JP
Is <CN=apsvr01, OU=IT, O=Hoge,Inc., L=Minato-ku, ST=Tokyo, C=JP> correct?
  [no]:  yes
  • 自己証明書をエクスポートする。
> C:\bea\jdk131_06\bin\keytool -export -alias weblogic -file trust.pem -keystore mykeystore.jks -storepass weblogic -rfc

Certificate stored in file <trust.pem>
  • 自己証明書をキーストアにインポートする。
> C:\bea\jdk131_06\bin\keytool -import -alias weblogic -file trust.pem -keystore trust.jks -storepass weblogic

Owner: CN=apsvr01, OU=IT, O=Hoge,Inc., L=Minato-ku, ST=Tokyo, C=JP
Issuer: CN=apsvr01, OU=IT, O=Hoge,Inc., L=Minato-ku, ST=Tokyo, C=JP
Serial number: 4a5432e9
Valid from: Wed Jul 08 14:47:21 JST 2009 until: Thu Jul 08 14:47:21 JST 2010
Certificate fingerprints:
         MD5:  C2:B8:F3:CC:13:09:6A:A6:F1:9A:24:E5:14:18:FF:1C
         SHA1: F8:DB:EF:7A:49:D0:70:C7:C9:C8:33:92:A5:96:19:4E:56:CF:28:72
Trust this certificate? [no]:  yes
Certificate was added to keystore
  • キーストアの設定を行う(WebLogic 管理コンソール*1から)。
  • [セキュリティ]-[レルム]-[myrealm]-[プロバイダ]-[キーストア]-[DefaultKeyStore]
    • プライベート キー ストアの場所: mykeystore.jks
    • プライベート キー ストアの Pass Phrase: weblogic
    • ルート CA キー ストアの場所: trust.jks
    • ルート CA キー ストアの Pass Phrase: weblogic
  • WebLogic を停止する(WebLogic 管理コンソールから)。
    • [mydomain]-[サーバ]-[apsvr01]-[制御]-[起動/停止]-[このサーバを停止]
  • config.xml を編集する。
    • 変更前
<SSL Enabled="true" HostnameVerificationIgnored="true"
    ListenPort="443" Name="apsvr01"
    ServerCertificateFileName="democert.pem"
    ServerPrivateKeyAlias="demokey" ServerPrivateKeyPassPhrase="{3DES}aHAUC6uehHRBD5sW4bajZg=="/>
    • 変更後
<SSL Enabled="true" HostnameVerificationIgnored="true"
    ListenPort="443" Name="apsvr01"
    ServerCertificateFileName="trust.pem"
    ServerPrivateKeyAlias="weblogic" ServerPrivateKeyPassPhrase="weblogic"/>
  • WebLogic を起動する。
    • [スタート]-[すべてのプログラム]-[BEA WebLogic Platform 7.0]-[User Projects]-[mydomain]-[Start Server]


[参考]
http://www.secomtrust.net/service/ninsyo/reforweb/4_9.html
http://www.secomtrust.net/service/ninsyo/reforweb/si_b10.html
keytool | nDiki